Skip to content

feat: add console exporter - #35

Merged
Hector Hernandez (hectorhdzg) merged 5 commits into
microsoft:mainfrom
hectorhdzg:hectorhdzg/console-exporter-and-export-target
Apr 22, 2026
Merged

Hector Hernandez (hectorhdzg) merged 5 commits into
microsoft:mainfrom
hectorhdzg:hectorhdzg/console-exporter-and-export-target

Conversation

@hectorhdzg

Copy link
Copy Markdown
Member

Adds enableConsoleExporters option to MicrosoftOpenTelemetryOptions that registers ConsoleSpanExporter, ConsoleMetricExporter, and ConsoleLogRecordExporter.

Behavior:

  • Auto-enabled when no other exporter (Azure Monitor, OTLP, A365) is active, ensuring telemetry is always visible during local development with zero configuration.
  • Can be explicitly set to true to use alongside other exporters, or false to suppress.

Fix ./loader subpath exports

Add ExportTarget enum (None, AzureMonitor, Agent365, Otlp, Console) with
the same values as the .NET distro for cross-platform consistency.

- Add 'exporters' option to MicrosoftOpenTelemetryOptions for explicit
  exporter selection via bitwise OR (e.g. ExportTarget.Console | ExportTarget.AzureMonitor)
- When 'exporters' is not set, auto-detection preserves existing behavior
- Console exporter is never auto-detected (must be explicitly enabled)
- Wire ConsoleSpanExporter, ConsoleMetricExporter, ConsoleLogRecordExporter
  using SimpleSpanProcessor/SimpleLogRecordProcessor for immediate output
- Gate all exporter sections (AzureMonitor, OTLP, Agent365) through ExportTarget flags
- Fix ./loader subpath export paths in package.json (dist/*/loader.js -> dist/*/azureMonitor/loader.js)
- Export ExportTarget and ExportTargetFlags from public API
Copilot AI review requested due to automatic review settings April 22, 2026 20:18
@hectorhdzg Hector Hernandez (hectorhdzg) changed the title feat: add console exporter and ExportTarget flags matching .NET distro feat: add console exporter Apr 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in/auto-enabled console export path to the distro so traces/metrics/logs can be emitted to stdout (useful for local dev), and fixes the ./loader subpath export mapping to point at the built Azure Monitor loader artifact.

Changes:

  • Adds enableConsoleExporters?: boolean to MicrosoftOpenTelemetryOptions.
  • Wires up ConsoleSpanExporter, ConsoleMetricExporter, and ConsoleLogRecordExporter in useMicrosoftOpenTelemetry() with auto-enable logic.
  • Fixes package.json exports["./loader"] paths to match the actual build output layout.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/types.ts Adds the new enableConsoleExporters option to the public options interface.
src/distro/distro.ts Registers console exporters and determines when they are enabled.
package.json Updates ./loader subpath exports to dist/*/azureMonitor/loader.*.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/distro/distro.ts Outdated
Comment thread src/distro/distro.ts
Comment thread src/distro/distro.ts
Comment thread src/distro/distro.ts Outdated
@hectorhdzg
Hector Hernandez (hectorhdzg) merged commit 35d121c into microsoft:main Apr 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants