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

Validate links during span creation #3990

Closed
emdneto opened this issue Jun 22, 2024 · 1 comment · Fixed by #3991
Closed

Validate links during span creation #3990

emdneto opened this issue Jun 22, 2024 · 1 comment · Fixed by #3991
Labels
bug Something isn't working

Comments

@emdneto
Copy link
Member

emdneto commented Jun 22, 2024

Describe your environment

OS: Ubuntu
Python version: 3.12
SDK version: 1.25.0
API version: 1.25.0

What happened?

We are recording invalid links when adding links during span creation.

Steps to Reproduce

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
   SimpleSpanProcessor,
   ConsoleSpanExporter,
)


trace.set_tracer_provider(TracerProvider())
trace.get_tracer_provider().add_span_processor(SimpleSpanProcessor(ConsoleSpanExporter()))

tracer = trace.get_tracer("my.tracer")
with tracer.start_as_current_span("root", links=[trace.Link(trace.INVALID_SPAN_CONTEXT)]) as root:
   pass

Expected Result

"links": []

Since this is the preferred method to add links, I suppose we should also validate links at span creation

Actual Result

    "links": [
        {
            "context": {
                "trace_id": "0x00000000000000000000000000000000",
                "span_id": "0x0000000000000000",
                "trace_state": "[]"
            },
            "attributes": {}
        }
    ],

Additional context

No response

Would you like to implement a fix?

Yes

@emdneto emdneto added the bug Something isn't working label Jun 22, 2024
@UjjwalSaini07
Copy link

Great Change

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

Successfully merging a pull request may close this issue.

2 participants