Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[all] migrate from deprecated addMetricReader to MeterProvider constructor option #2646

Open
64 tasks
pichlermarc opened this issue Jan 14, 2025 · 3 comments · May be fixed by #2654
Open
64 tasks

[all] migrate from deprecated addMetricReader to MeterProvider constructor option #2646

pichlermarc opened this issue Jan 14, 2025 · 3 comments · May be fixed by #2654
Labels
type:feature-tracking A feature with sub-issues that need to be addressed

Comments

@pichlermarc
Copy link
Member

pichlermarc commented Jan 14, 2025

Description

MeterProvider#addMetricReader() is deprecated in favor of a constructor option and will be removed in SDK 2.0. To ensure a smoother transition for the contrib repo when we publish SDK 2.0, we should take care of this before we release 2.0 on February 17.

This issue is considered done when we have applied these changes in all packages of this repository

  • we moved from MeterProvider#addMetricReader() to the constructor option
  • we made the necessary changes to the documentation

Packages checklist:

Note

For traigers/approvers/maintainers please link the appropriate PRs and update check boxes as we work through them. Some of these packages may not use this method anywhere. In that case, please simple mark them as done and add a comment "not used" by editing this issue.

  • @opentelemetry/resource-detector-alibaba-cloud
  • @opentelemetry/instrumentation-user-interaction
  • @opentelemetry/resource-detector-container
  • @opentelemetry/instrumentation-generic-pool
  • @opentelemetry/instrumentation-document-load
  • @opentelemetry/resource-detector-instana
  • @opentelemetry/instrumentation-nestjs-core
  • @opentelemetry/resource-detector-github
  • @opentelemetry/instrumentation-aws-lambda
  • @opentelemetry/resource-detector-azure
  • @opentelemetry/instrumentation-cassandra-driver
  • @opentelemetry/instrumentation-memcached
  • @opentelemetry/instrumentation-long-task
  • @opentelemetry/resource-detector-aws
  • @opentelemetry/resource-detector-gcp
  • @opentelemetry/instrumentation-aws-sdk
  • @opentelemetry/instrumentation-connect
  • @opentelemetry/instrumentation-express
  • @opentelemetry/instrumentation-fastify
  • @opentelemetry/instrumentation-graphql
  • @opentelemetry/instrumentation-ioredis
  • @opentelemetry/instrumentation-mongodb
  • @opentelemetry/instrumentation-redis-4
  • @opentelemetry/instrumentation-restify
  • @opentelemetry/instrumentation-winston
  • @opentelemetry/instrumentation-bunyan
  • @opentelemetry/instrumentation-mysql2
  • @opentelemetry/instrumentation-router
  • @opentelemetry/instrumentation-mysql
  • @opentelemetry/instrumentation-redis
  • @opentelemetry/instrumentation-hapi
  • @opentelemetry/instrumentation-knex
  • @opentelemetry/instrumentation-pino
  • @opentelemetry/instrumentation-dns
  • @opentelemetry/instrumentation-koa
  • @opentelemetry/instrumentation-net
  • @opentelemetry/propagator-ot-trace
  • @opentelemetry/instrumentation-pg
  • @opentelemetry/id-generator-aws-xray
  • @opentelemetry/propagator-instana
  • @opentelemetry/auto-configuration-propagators
  • @opentelemetry/plugin-react-load
  • @opentelemetry/instrumentation-lru-memoizer
  • @opentelemetry/instrumentation-runtime-node
  • @opentelemetry/propagation-utils
  • @opentelemetry/auto-instrumentations-node
  • @opentelemetry/instrumentation-dataloader
  • @opentelemetry/auto-instrumentations-web
  • @opentelemetry/propagator-aws-xray-lambda
  • @opentelemetry/instrumentation-socket.io
  • @opentelemetry/instrumentation-cucumber
  • @opentelemetry/instrumentation-mongoose
  • @opentelemetry/instrumentation-amqplib
  • @opentelemetry/instrumentation-kafkajs
  • @opentelemetry/instrumentation-tedious
  • @opentelemetry/host-metrics
  • @opentelemetry/redis-common
  • @opentelemetry/instrumentation-undici
  • @opentelemetry/sql-common
  • @opentelemetry/contrib-test-utils
  • @opentelemetry/baggage-span-processor
  • @opentelemetry/propagator-aws-xray
  • @opentelemetry/instrumentation-fs
  • @opentelemetry/winston-transport
@pichlermarc pichlermarc changed the title [all] migrate from deprecated addMetricReader to MeterProvider constructor option #2645 [all] migrate from deprecated addMetricReader to MeterProvider constructor option #2645 Jan 14, 2025
@pichlermarc pichlermarc changed the title [all] migrate from deprecated addMetricReader to MeterProvider constructor option #2645 [all] migrate from deprecated addMetricReader to MeterProvider constructor option #2645 Jan 14, 2025
@pichlermarc pichlermarc changed the title [all] migrate from deprecated addMetricReader to MeterProvider constructor option #2645 [all] migrate from deprecated addMetricReader to MeterProvider constructor option Jan 14, 2025
@trentm
Copy link
Contributor

trentm commented Jan 15, 2025

Current usages in the contrib repo:
% rg addMetricReader
plugins/node/instrumentation-runtime-node/test/event_loop_utilization.test.ts
33:    meterProvider.addMetricReader(metricReader);

plugins/node/instrumentation-runtime-node/test/instrumentation.test.ts
31:    meterProvider.addMetricReader(metricReader);

plugins/node/instrumentation-runtime-node/test/event_loop_delay.test.ts
31:    meterProvider.addMetricReader(metricReader);

plugins/node/instrumentation-runtime-node/test/event_loop_time.test.ts
33:    meterProvider.addMetricReader(metricReader);

plugins/node/instrumentation-runtime-node/test/heap_space_and_used.test.ts
35:    meterProvider.addMetricReader(metricReader);

examples/mysql/src/tracer.ts
30:  meterProvider.addMetricReader(metricReader);

plugins/node/opentelemetry-instrumentation-aws-lambda/test/integrations/lambda-handler.force-flush.test.ts
156:    provider.addMetricReader(
202:    meterProvider.addMetricReader(

plugins/node/opentelemetry-instrumentation-mongodb/test/mongodb-v4-v5-v6.metrics.test.ts
88:    otelTestingMeterProvider.addMetricReader(metricReader);

plugins/node/instrumentation-undici/test/metrics.test.ts
45:  meterProvider.addMetricReader(metricReader);

plugins/node/opentelemetry-instrumentation-mysql/test/index.metrics.test.ts
80:    otelTestingMeterProvider.addMetricReader(metricReader);

Also, note that there are a number of hits (in examples/docs) in the core repo still that should be cleaned up. Perhaps this issue isn't the best place to note these:

Current usage in the core repo
% rg addMetricReader -g '!CHANGELOG.md'
doc/metrics.md
508:meterProvider.addMetricReader(exporter);
546:meterProvider.addMetricReader(new PeriodicExportingMetricReader({

experimental/packages/opentelemetry-exporter-prometheus/README.md
33:meterProvider.addMetricReader(exporter);

experimental/packages/opentelemetry-exporter-metrics-otlp-proto/README.md
33:meterProvider.addMetricReader(new PeriodicExportingMetricReader({

experimental/packages/opentelemetry-exporter-metrics-otlp-http/README.md
40:meterProvider.addMetricReader(new PeriodicExportingMetricReader({
63:meterProvider.addMetricReader(new PeriodicExportingMetricReader({

experimental/examples/prometheus/index.js
20:meterProvider.addMetricReader(exporter);

experimental/examples/opencensus-shim/setup.js
62:  meterProvider.addMetricReader(

experimental/packages/shim-opencensus/src/OpenCensusMetricProducer.ts
54: * meterProvider.addMetricReader(reader);

experimental/packages/shim-opencensus/README.md
82:meterProvider.addMetricReader(

experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/README.md
41:meterProvider.addMetricReader(new PeriodicExportingMetricReader({

examples/otlp-exporter-node/metrics.js
44:meterProvider.addMetricReader(

examples/opentelemetry-web/examples/metrics/index.js
24:  meterProvider.addMetricReader(new PeriodicExportingMetricReader({

chancancode added a commit to tildeio/opentelemetry-js-contrib that referenced this issue Jan 16, 2025
This migrates from the deprecated `addMetricReader` method to the
constructor option in preparation for the upcoming SDK 2.0 release.

All usages are in tests and example code, there are no user-facing
changes.

Fixes open-telemetry#2646
@chancancode
Copy link

#2654 takes care of all usages in this repository, after that's been merged this can be closed

@chancancode
Copy link

Also, note that there are a number of hits (in examples/docs) in the core repo still that should be cleaned up.

open-telemetry/opentelemetry-js#5349 @trentm

@pichlermarc pichlermarc added the type:feature-tracking A feature with sub-issues that need to be addressed label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature-tracking A feature with sub-issues that need to be addressed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants