From 51785adb8aceff2e8d70ad1d565220f723de9345 Mon Sep 17 00:00:00 2001 From: "marc.pichler" Date: Fri, 2 Sep 2022 15:30:04 +0200 Subject: [PATCH] docs(node-sdk): update outdated metric documentation. --- .../packages/opentelemetry-sdk-node/README.md | 26 ++++++++----------- .../opentelemetry-sdk-node/src/sdk.ts | 5 +--- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/experimental/packages/opentelemetry-sdk-node/README.md b/experimental/packages/opentelemetry-sdk-node/README.md index e0ed90099c..8c1d01ae15 100644 --- a/experimental/packages/opentelemetry-sdk-node/README.md +++ b/experimental/packages/opentelemetry-sdk-node/README.md @@ -18,7 +18,7 @@ $ npm install @opentelemetry/sdk-node $ # Install exporters and plugins $ npm install \ @opentelemetry/exporter-jaeger \ # add tracing exporters as needed - @opentelemetry/exporter-prometheus # add metrics exporters as needed + @opentelemetry/exporter-prometheus \ # add metrics exporters as needed @opentelemetry/instrumentation-http # add instrumentations as needed $ # or install all officially supported core and contrib plugins @@ -26,7 +26,7 @@ $ npm install @opentelemetry/auto-instrumentations-node ``` -> Note: this example is for Node.js. See [examples/tracer-web](https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/tracer-web) for a browser example. +> Note: this example is for Node.js. See [examples/opentelemetry-web](https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/opentelemetry-web) for a browser example. ### Initialize the SDK @@ -50,7 +50,7 @@ const sdk = new opentelemetry.NodeSDK({ // Optional - if omitted, the tracing SDK will not be initialized traceExporter: jaegerExporter, // Optional - If omitted, the metrics SDK will not be initialized - metricExporter: prometheusExporter, + metricReader: prometheusExporter, // Optional - you can use the metapackage or load each instrumentation individually instrumentations: [getNodeAutoInstrumentations()], // See the Configuration section below for additional configuration options @@ -92,17 +92,17 @@ Use a custom context manager. Default: [AsyncHooksContextManager](../../../packa Use a custom propagator. Default: [CompositePropagator](../../../packages/opentelemetry-core/src/propagation/composite.ts) using [W3C Trace Context](../../../packages/opentelemetry-core/README.md#w3ctracecontextpropagator-propagator) and [Baggage](../../../packages/opentelemetry-core/README.md#baggage-propagator) -### metricProcessor +### metricReader -Use a custom processor for metrics. Default: UngroupedProcessor +Add a [MetricReader](../opentelemetry-sdk-metrics/src/export/MetricReader.ts) +that will be passed to the `MeterProvider`. If `metricReader` is not configured, +the metrics SDK will not be initialized and registered. -### metricExporter - -Configure a metric exporter. If an exporter is not configured, the metrics SDK will not be initialized and registered. - -### metricInterval +### views -Configure an interval for metrics export in ms. Default: 60,000 (60 seconds) +A list of views to be passed to the `MeterProvider`. +Accepts an array of [View](../opentelemetry-sdk-metrics/src/view/View.ts)-instances. +This parameter can be used to configure explicit bucket sizes of histogram metrics. ### instrumentations @@ -133,10 +133,6 @@ Configure a trace exporter. If an exporter OR span processor is not configured, Configure tracing parameters. These are the same trace parameters used to [configure a tracer](../../../packages/opentelemetry-sdk-trace-base/src/types.ts#L71). -### views - -Configure views of your instruments and accepts an array of [View](../opentelemetry-sdk-metrics-base/src/view/View.ts)-instances. The parameter can be used to configure the explicit bucket sizes of histogram metrics. - ### serviceName Configure the [service name](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service). diff --git a/experimental/packages/opentelemetry-sdk-node/src/sdk.ts b/experimental/packages/opentelemetry-sdk-node/src/sdk.ts index 11870ebf28..a48028760b 100644 --- a/experimental/packages/opentelemetry-sdk-node/src/sdk.ts +++ b/experimental/packages/opentelemetry-sdk-node/src/sdk.ts @@ -45,10 +45,7 @@ export type MeterProviderConfig = { */ reader?: MetricReader /** - * Lists the views that should be passed when meterProvider - * - * Note: This is only getting used when NodeSDK is responsible for - * instantiated an instance of MeterProvider + * List of {@link View}s that should be passed to the MeterProvider */ views?: View[] };