GoogleCloudPlatform/opentelemetry-operations-js

Is the Google Cloud Monitoring Exporter Actually Supported

mamidon opened this issue · 3 comments

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

"@opentelemetry/sdk-metrics-base": "0.27.0",
"@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.14.0",

What version of Node are you using?

v12.22.7

What did you do?

If possible, provide a recipe for reproducing the error.
I followed the example at the readme which has it's own minor syntax error.

What did you expect to see?

I expect code equivalent to the example, with a minor syntax fix, to compile successfully.

What did you see instead?

Compilation errors

../../node_modules/@google-cloud/opentelemetry-cloud-monitoring-exporter/build/src/monitoring.d.ts(26,5): error TS2416: Property 'export' in type 'MetricExporter' is not assignable to the same property in base type 'MetricExporter'.
Type '(metrics: import("/.../node_modules/@opentelemetry/sdk-metrics-base/build/src/export/types").MetricRecord[], resultCallback: (result: import("/.../node_modules/@opentelemetry/core/build/src/ExportResult").ExportResult) => void) => void' is not assignable to type '(metrics: import("/.../node_modules/@opentelemetry/sdk-metrics-base/build/src/export/types").MetricRecord[], resultCallback: (result: import("/.../node_modules/@opentelemetry/sdk-metrics-base/node_modules/@opentelemetry/core/build/src/ExportResult").E...'.
     Types of parameters 'resultCallback' and 'resultCallback' are incompatible.
       Types of parameters 'result' and 'result' are incompatible.
         Type 'import("/.../node_modules/@opentelemetry/core/build/src/ExportResult").ExportResult' is not assignable to type 'import("/.../node_modules/@opentelemetry/sdk-metrics-base/node_modules/@opentelemetry/core/build/src/ExportResult").ExportResult'.

Additional context

The code I've written is basically what's in the readme

import {MeterProvider} from '@opentelemetry/sdk-metrics-base';
import { MetricExporter } from '@google-cloud/opentelemetry-cloud-monitoring-exporter';

const exporter = new MetricExporter();

// Register the exporter
const meter = new MeterProvider({
    exporter,
    interval: 60000,
}).getMeter('meter');

Add any other context about the problem here.

I've tried picking specific versions of sdk-metrics-base & opentelemetry-cloud-monitoring-exporter, but to no avail.
Is there a different configuration I should be following, or is this package just broken?

Thank you

Thanks for the report. Re the specific error

Type 'import("/.../node_modules/@opentelemetry/core/build/src/ExportResult").ExportResult' is not assignable to type 'import("/.../node_modules/@opentelemetry/sdk-metrics-base/node_modules/@opentelemetry/core/build/src/ExportResult").ExportResult'.

it looks like npm is pulling in a different version of @opentelemetry/core for @opentelemetry/sdk-metrics-base where the types are incompatible which causes TS to fail to compile. Can you share the output of npm ls and what version of npm you're using? Ideally you would have a single version of @opentelemetry/sdk-metrics-base in your node_modules.


All that said, the metrics exporter is a bit out of date as there has been a lot of progress on OpenTelemetry JS Metrics SDK in the last month or two. However we are still waiting on those changes to be released

@aabmass , is there any updates on updates with Google Cloud Monitoring exporter getting some updates/love? Open-telemetry has released many updates, none of which are being reflected over here.

Working on updating things right now since the latest JS release has stable metrics