Skip to content

Commit

Permalink
[Monitor OpenTelemetry] Update Configuration Documentation to Include…
Browse files Browse the repository at this point in the history
… Log/Span Processors and Use SpanProcessors in Default Config (#28597)

### Packages impacted by this PR
@monitor-opentelemetry

### Describe the problem that is addressed by this PR
README should account for all configuration options.
We should not rely on the deprecated `SpanProcessor` field on the SDK
config.
  • Loading branch information
JacksonWeber authored Mar 13, 2024
1 parent 7ee995b commit 75526c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions sdk/monitor/monitor-opentelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const options: AzureMonitorOpenTelemetryOptions = {
},
samplingRatio: 1,
instrumentationOptions: {
// Instrumentations generating traces
// Instrumentations generating traces
azureSdk: { enabled: true },
http: { enabled: true },
mongoDb: { enabled: true },
Expand All @@ -79,6 +79,8 @@ const options: AzureMonitorOpenTelemetryOptions = {
connectionString: "",
},
resource: resource
logRecordProcessors: [],
spanProcessors: []
};

useAzureMonitor(options);
Expand All @@ -88,14 +90,16 @@ useAzureMonitor(options);

|Property|Description|Default|
| ------------------------------- |------------------------------------------------------------------------------------------------------------|-------|
| azureMonitorExporterOptions | Azure Monitor OpenTelemetry Exporter Configuration. [More info here](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/monitor/monitor-opentelemetry-exporter) | | | |
| samplingRatio | Sampling ratio must take a value in the range [0,1], 1 meaning all data will sampled and 0 all Tracing data will be sampled out. | 1|
| azureMonitorExporterOptions | Azure Monitor OpenTelemetry Exporter Configuration. [More info here](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/monitor/monitor-opentelemetry-exporter) | | | |
| samplingRatio | Sampling ratio must take a value in the range [0,1], 1 meaning all data will sampled and 0 all Tracing data will be sampled out. | 1|
| instrumentationOptions| Allow configuration of OpenTelemetry Instrumentations. | {"http": { enabled: true },"azureSdk": { enabled: false },"mongoDb": { enabled: false },"mySql": { enabled: false },"postgreSql": { enabled: false },"redis": { enabled: false },"bunyan": { enabled: false }}|
| browserSdkLoaderOptions| Allow configuration of Web Instrumentations. | { enabled: false, connectionString: "" }
| resource | Opentelemetry Resource. [More info here](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-resources) ||
| samplingRatio | Sampling ratio must take a value in the range [0,1], 1 meaning all data will sampled and 0 all Tracing data will be sampled out.
| enableLiveMetrics | Enable/Disable Live Metrics.
| enableStandardMetrics | Enable/Disable Standard Metrics.
| browserSdkLoaderOptions| Allow configuration of Web Instrumentations. | { enabled: false, connectionString: "" } |
| resource | Opentelemetry Resource. [More info here](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-resources) ||
| samplingRatio | Sampling ratio must take a value in the range [0,1], 1 meaning all data will sampled and 0 all Tracing data will be sampled out. |
| enableLiveMetrics | Enable/Disable Live Metrics. |
| enableStandardMetrics | Enable/Disable Standard Metrics. |
| logRecordProcessors | Array of log record processors to register to the global logger provider. |
| spanProcessors | Array of span processors to register to the global tracer provider. |

Options could be set using configuration file `applicationinsights.json` located under root folder of @azure/monitor-opentelemetry package installation folder, Ex: `node_modules/@azure/monitor-opentelemetry`. These configuration values will be applied to all AzureMonitorOpenTelemetryClient instances.

Expand Down
2 changes: 1 addition & 1 deletion sdk/monitor/monitor-opentelemetry/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function useAzureMonitor(options?: AzureMonitorOpenTelemetryOptions) {
logRecordProcessor: logHandler.getAzureLogRecordProcessor(),
resource: config.resource,
sampler: traceHandler.getSampler(),
spanProcessor: traceHandler.getAzureMonitorSpanProcessor(),
spanProcessors: [traceHandler.getAzureMonitorSpanProcessor()],
};
sdk = new NodeSDK(sdkConfig);
setSdkPrefix();
Expand Down

0 comments on commit 75526c0

Please sign in to comment.