Skip to content

Export structured log properties with CommonJS and ESM parity - #48

Open
Radek Maziarka (rmaziarka) wants to merge 1 commit into
Azure:mainfrom
rmaziarka:main
Open

Radek Maziarka (rmaziarka) wants to merge 1 commit into
Azure:mainfrom
rmaziarka:main

Conversation

@rmaziarka

@rmaziarka Radek Maziarka (rmaziarka) commented Sep 29, 2026 •

Copy link
Copy Markdown

Project

Problem

Proposed solution

  • Map hook properties to OpenTelemetry LogRecord.attributes in CommonJS and ESM.
  • Preserve message body, severity and active invocation correlation.
  • Include the ESM fix in this PR: emit runtime-owned CategoryName in both module variants.
  • Dispose manually registered ESM hooks through public disable(), including repeated calls.
  • Prevent application properties from overriding reserved telemetry fields.
  • Declare structured-property support only after exporter configuration is ready.
  • Enable worker-side suppression of host logs only with a ready exporter.
  • Document telemetryMode: OpenTelemetry for avoiding routine host/worker duplication; separate exporter filtering and sampling settings.
  • Tests: CommonJS/ESM parity, exporter readiness, concurrent correlation and Application Insights field readback.
  • Dependencies: worker metadata support from PR 1 and library hook contract from PR 2.
  • Three PRs total; no separate ESM PR.

Validation

  • 36 tests passed, including ESM hook disposal and TypeScript 4.9.5 public type checks. Build and lint passed.
  • Behavior change: log forwarding and host-log suppression now require explicit structuredLogExporterReady: true; the default only propagates context.
  • Combined integration test: local Functions host, modified packages and live Application Insights; 30 records verified across CommonJS, ESM, disabled opt-in, missing consumer and old-worker scenarios.
  • Verified message preservation, custom dimensions, severity and invocation correlation. Not tested in managed Azure Functions; rollout requires coordinated releases.

@rmaziarka
Radek Maziarka (rmaziarka) requested a review from a team as a code owner September 29, 2026 09:14
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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.

1 participant