1.0.1 • Published 5 years ago

@thecodenebula/apollo-prometheus-plugin v1.0.1

Weekly downloads
247
License
MIT
Repository
github
Last release
5 years ago

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

metrictypelabels
errors_encounteredCounteroperationName operation error
requests_resolvedCounteroperationNameoperation
attributes_requestedCounterfieldNameparentType
resolver_timeHistogramfieldNameparentTypereturnType
total_request_timeHistogramoperationNameoperation
1.0.1

5 years ago

1.0.0

5 years ago