@thecodenebula/apollo-prometheus-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Apollo Prometheus Plugin Tests npm (scoped)

Install

npm install @thecodenebula/apollo-prometheus-plugin

Usage

import { ApolloServer, gql } from 'apollo-server-express';
import { prometheusPlugin } from 'apollo-prometheus-plugin';
import { Registry } from 'prom-client';
import { prometheusPlugin } from '@thecodenebula/apollo-prometheus-plugin';

const register = new Registry();

const app = express();

app.get('/metrics', (_, res) => res.send(register.metrics()));

const server = new ApolloServer({
  typeDefs,
  resolvers,
  plugins: [prometheusPlugin(register, { enableNodeMetrics: true })],
});

server.applyMiddleware({ app, path: '/' });
app.listen({ port: 8080 }, () => {
  console.log('Listening');
});

Available metrics and labels

metric type labels
errors_encountered Counter operationName
operation
error
requests_resolved Counter operationName
operation
attributes_requested Counter fieldName
parentType
resolver_time Histogram fieldName
parentType
returnType
total_request_time Histogram operationName
operation

/@thecodenebula/apollo-prometheus-plugin/

    Package Sidebar

    Install

    npm i @thecodenebula/apollo-prometheus-plugin

    Weekly Downloads

    267

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    339 kB

    Total Files

    25

    Last publish

    Collaborators

    • grillorafael