Nestjs-OpenTelemetry icon indicating copy to clipboard operation
Nestjs-OpenTelemetry copied to clipboard

Error in configuring for PrometheusExporter

Open Gerromie opened this issue 1 year ago • 4 comments

According to the README, the code below should result in configuring a PrometheusExporter, but perhaps there is a missing step or the versions with the required libraries are a little out of alignment? The IDE reports an error.

        OpenTelemetryModule.forRoot({
            applicationName: 'myApplicationName',
            metricExporter: new PrometheusExporter({
                endpoint: 'metrics',
                port: 9464,
            }),
            metricInterval: 1000,
        })

Error

Property 'export' is missing in type 'PrometheusExporter' but required in type 'MetricExporter'.ts(2741)
types.d.ts(71, 5): 'export' is declared here.
types.d.ts(13, 5): The expected type comes from property 'metricExporter' which is declared here on type 'Partial<OpenTelemetryModuleConfig>'

It seems that the PrometheusExporter extends MetricReader (now?) while the OpenTelemetryModule is expecting to have a MetricExporter.

Gerromie avatar Jun 22 '22 22:06 Gerromie

:eyes:

hygo2025 avatar Jun 23 '22 19:06 hygo2025

Last version without problems is 0.27.0

hygo2025 avatar Jun 23 '22 19:06 hygo2025

Thanks! Are there any plans to support newer versions?

Gerromie avatar Jun 23 '22 22:06 Gerromie

Also having this issue, any idea on how to adjust configs for this?

joaogl avatar Jul 05 '22 08:07 joaogl

#49

MetinSeylan avatar Oct 15 '22 17:10 MetinSeylan