bfmatei / apollo-prometheus-exporter

Plugin for Apollo Server to export metrics in Prometheus format
MIT License
55 stars 29 forks source link

Trying use skipMetrics, but it doesn't work #26

Open monicajss opened 3 years ago

monicajss commented 3 years ago

Hi, I'm trying to use skipMetrics to skip the label success=false from apollo_query_duration metrics. I tried as bellow:

import { createPrometheusExporterPlugin, MetricsNames} from '@bmatei/apollo-prometheus-exporter'
[...] 

const prometheusExporterPlugin = createPrometheusExporterPlugin({
      durationHistogramsBuckets: [0.5, 2],
      app,
     skipMetrics: { 
        [MetricsNames.QUERY_DURATION]: (labels) => {labels.success === 'false'}
         },
    })

Should I import something else? What am I doing wrong?

pbromley commented 1 year ago

I know this is really old but do you need to do either

 [MetricsNames.QUERY_DURATION]: (labels) => { return labels.success === 'false'; }

or

 [MetricsNames.QUERY_DURATION]: (labels) => labels.success === 'false'

I'm just looking at this type of thing myself at the moment