Repository navigation
Conversation
Assisted-by: OpenAI Codex
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4149 +/- ##
==========================================
+ Coverage 86.41% 86.42% +0.01%
==========================================
Files 524 524
Lines 20421 20421
==========================================
+ Hits 17644 17646 +2
+ Misses 2777 2775 -2
🚀 New features to boost your workflow:
|
| * @param severity severity of the log | ||
| * @param event_id event identifier of the log | ||
| * @param format an utf-8 string following https://messagetemplates.org/ | ||
| * @param format a UTF-8 string stored as the log record body |
There was a problem hiding this comment.
I think the new note about no SDK-side interpolation is useful, but should we avoid removing the message-template intent entirely? My understanding is that format was kept as a user-facing API concept so custom exporters or upstream agents could interpret it as a message template, even though the OpenTelemetry spec does not require the SDK itself to format it. Maybe this should say that the SDK stores the string as the log record body and does not interpolate attributes, while preserving that exporters/agents may choose to interpret it as a message template.
cc @ThomsonTan - I believe he added the original comment.
There was a problem hiding this comment.
The original intention is recommending the user to pass in message-template. It is not required for SDK or exporter (we don't do that) to do the interpolation, but everything are there for the interpolation so it could be done later, like in the storage backend. Let's add clarification on this instead of revoing the intention.
There was a problem hiding this comment.
The spec has some guidance on the ergonomic API to emit events now and this is new since the C++ event API was implemented.
https://opentelemetry.io/docs/specs/otel/logs/api/#ergonomic-api
Ergonomic API
Status: DevelopmentLanguages MAY additionally provide a more ergonomic and convenient logging API.
The ergonomic API SHOULD make it more convenient to emit event records following the event semantics.
The design of the ergonomic API SHOULD be idiomatic for its language.
I think the change to the comment in this PR is a good one as it clarifies what member of the log record the arg sets.
If we follow the event semantics then we should also rename the format arg to body and leave it to the caller to use as they wish (which may be a format string following https://messagetemplates.org/).
[DOCS] clarify logger format handling (open-telemetry#4149)
Description
Clarifies the logger API documentation for the
formatparameter. The current wording links to message templates, which can imply that placeholders are interpolated from attributes. This change documents the current behavior: the format string is stored as the log record body, and structured data should be passed through attributes.Fixes #2628
Type of change
Verification
git diff --checkscripts/assert-cncf-github-identity.ps1 -RepoPath upstreams\open-telemetry\opentelemetry-cppNo runtime behavior changed.