Skip to content

Add output plugins (incl. OpenTelemetry support) - #316

Merged
christiand93 merged 7 commits into
mainfrom
opentelemetry-v8
Sep 14, 2026
Merged

christiand93 merged 7 commits into
mainfrom
opentelemetry-v8

Conversation

@christiand93

@christiand93 christiand93 commented May 28, 2026

Copy link
Copy Markdown
Member

Add Output Plugins

Output plugins receive Record objects, including the payload (key-value map of log fields) as well as associated metadata.
For now we have two output plugins:

Built-in Plugins

StdoutOutputPlugin

This output plugin implements the previous behavior (stringify key-value payload output to stdout or a custom sink function)

OpenTelemetryLogsOutputPlugin

This (experimental) plugin bridges to the OpenTelemetry Logs API. When a log record is written, it translates the severity levels to OTel SeverityNumber values, maps exception metadata (error.name, error.message, stack trace) to the standard OTel exception.* attributes, and emits the log via an OTel Logger (either a user-supplied LoggerProvider or the global one).

A configurable FieldInclusionMode controls how much of the log payload is forwarded as OTel attributes: nothing extra, only custom fields, or the full payload. For now request-type records are silently dropped. OTel traces should be used instead

Custom Plugins

For now, there is no support for custom plugins. Supporting them would require exporting internal types (for example, Record) as part of the public API. Since these internals are subject to change, doing so could introduce breaking changes.

Note

This feature is available for testing in v8.1.0-beta.0.

@christiand93 christiand93 changed the title Add OpenTelemetry output plugin Add output plugins (incl. OpenTelemetry support) May 28, 2026
@christiand93
christiand93 force-pushed the opentelemetry-v8 branch 2 times, most recently from 75a3bc9 to 116930b Compare September 10, 2026 08:22
@christiand93
christiand93 marked this pull request as ready for review September 10, 2026 08:24
Comment thread docs/advanced-usage/07-output-plugins.md
Comment thread docs/advanced-usage/07-output-plugins.md
Comment thread src/lib/plugins/otelOutput.ts
nicklasDohrn

This comment was marked as low quality.

@nicklas-dohrn nicklas-dohrn 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.

LGTM

@christiand93
christiand93 merged commit 384f961 into main Sep 14, 2026
7 checks passed
@christiand93
christiand93 deleted the opentelemetry-v8 branch September 14, 2026 11:50
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.

4 participants