Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Superfluous trace id/span id in console log output #3545

Closed
tigrannajaryan opened this issue Nov 22, 2023 · 3 comments
Closed

Superfluous trace id/span id in console log output #3545

tigrannajaryan opened this issue Nov 22, 2023 · 3 comments
Labels
bug Something isn't working logging

Comments

@tigrannajaryan
Copy link
Member

Describe your environment
Mac OS X
Python 3.9.6

Steps to reproduce
Run Getting Started, metrics example.

What is the expected behavior?
Trace id/span id fields present once in the log records.

What is the actual behavior?
Trace id/span id fields are present in two different places in the log records, once as subkeys of the "attributes", once as top-level "trace_id", "span_id" fields.

{
    "body": "Anonymous player is rolling the dice: 5",
    "severity_number": "<SeverityNumber.WARN: 13>",
    "severity_text": "WARNING",
    "attributes": {
        "otelSpanID": "7d0581e1f3f51bea",
        "otelTraceID": "8b346ee9af8718bf73a4318d073cbbb1",
        "otelTraceSampled": true,
        "otelServiceName": "dice-server"
    },
    "dropped_attributes": 0,
    "timestamp": "2023-11-22T17:01:36.027744Z",
    "trace_id": "0x8b346ee9af8718bf73a4318d073cbbb1",
    "span_id": "0x7d0581e1f3f51bea",
    "trace_flags": 1,
    "resource": "BoundedAttributes({'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.21.0', 'service.name': 'dice-server', 'telemetry.auto.version': '0.42b0'}, maxlen=None)"
}

I think it is sufficient to have trace_id/span_id top-level fields.

Additional context
Part of review open-telemetry/community#1751

@tigrannajaryan tigrannajaryan added the bug Something isn't working label Nov 22, 2023
@tigrannajaryan tigrannajaryan changed the title Superfluous attributes in console log output Superfluous trace id/span id in console log output Nov 22, 2023
@lzchen lzchen added the logging label Nov 22, 2023
@garry-cairns
Copy link
Contributor

I believe this is also covered by my comment on the analogous service name issue.

@lzchen
Copy link
Contributor

lzchen commented Jun 27, 2024

Related to this comment. Since the issue relates to the logging instrumentation, it is not a blocker for logging sdk rc.

@lzchen lzchen closed this as completed Jun 27, 2024
@lzchen
Copy link
Contributor

lzchen commented Jun 27, 2024

Doc improvement issue: open-telemetry/opentelemetry-python-contrib#2642

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working logging
Projects
Status: Done
Development

No branches or pull requests

3 participants