[#548] Move OTel sample from JS repository#571
Merged
Conversation
MattB-msft
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #548
This pull request introduces a new OpenTelemetry (OTel) instrumented agent sample for Node.js, called
OTelAgent, to the samples directory. The sample demonstrates how to integrate OpenTelemetry tracing, metrics, and logs into a Microsoft 365 Agent, and export telemetry to the .NET Aspire Dashboard. The changes include all source code, configuration, documentation, and build scripts needed to run and understand the sample.Addition of OTelAgent sample:
OTelAgent, with its own directory, demonstrating end-to-end OpenTelemetry instrumentation in a Node.js Microsoft 365 Agent. The sample includes custom spans, counters, histograms, and enrichment for HTTP operations. (samples/nodejs/README.md,samples/nodejs/otel/README.md) [1] [2]Source code and instrumentation:
agent.ts, including message handling, welcome messages, and telemetry events for both. (samples/nodejs/otel/src/agent.ts)agentTelemetry.tsto define and export custom OpenTelemetry metrics and tracers used by the agent. (samples/nodejs/otel/src/agentTelemetry.ts)instrumentation.tsto configure and initialize the OpenTelemetry SDK, supporting both OTLP and console exporters, and handling graceful shutdown. (samples/nodejs/otel/src/instrumentation.ts)Configuration and build:
env.TEMPLATE) with all necessary configuration keys for authentication and telemetry export. (samples/nodejs/otel/env.TEMPLATE)package.jsonwith all dependencies and build/start scripts for the sample. (samples/nodejs/otel/package.json)tsconfig.jsonfor TypeScript compilation targeting Node.js. (samples/nodejs/otel/tsconfig.json)Testing
This image shows the traces exported by the sample.
