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

opentelemetry-instrumentation-redis occasionally produces unnamed spans #3337

Open
pete-layerhealth opened this issue Mar 5, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@pete-layerhealth
Copy link

pete-layerhealth commented Mar 5, 2025

Describe your environment

OS: debian
Python version: 3.10.16
Package version: 0.51b0
running in a docker container with base image python:3.10.16-slim

What happened?

i periodically get unnamed spans emitted like this

{
    "name": "",
    "context": {
        "trace_id": "0xdeacb55c16eb0739902e1725a402f3ed",
        "span_id": "0x99b9f7b1e23d6c9a",
        "trace_state": "[]"
    },
    "kind": "SpanKind.CLIENT",
    "parent_id": null,
    "start_time": "2025-03-05T17:05:36.028629Z",
    "end_time": "2025-03-05T17:05:36.028652Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "db.statement": "",
        "db.system": "redis",
        "db.redis.database_index": 0,
        "net.peer.name": "redis",
        "net.peer.port": 6379,
        "net.transport": "ip_tcp",
        "db.redis.pipeline_length": 0
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.30.0",
            "service.name": "my-service",
            "service.namespace": "test-namespace",
            "service.version": "0.0.1",
            "service.instance.id": "192b2cb571f4"
        },
        "schema_url": ""
    }
}

this span cannot be exported, and causes a bunch of annoying error spam downstream. how can i find out what's responsible for this nameless span?

in the meantime, i have worked around by defaulting the name like so:

    RedisInstrumentor().instrument(
        tracer_provider=tracer_provider,
        response_hook=lambda span, _instance, _response: span.update_name(
            "unknown redis operation"
        )
        if not span.name
        else None,
    )

Steps to Reproduce

i set up redis instrumentation as follows

    RedisInstrumentor().instrument(tracer_provider=tracer_provider)

and redis as follows

connection=Redis(
    host=config.REDIS_HOST,
    port=config.REDIS_PORT,
    password=config.REDIS_PASSWORD,
    ssl=config.REDIS_ENABLE_SSL,
    ssl_ca_data=config.REDIS_SSL_CA_DATA,
),

Expected Result

all spans have names

Actual Result

some spans are unnamed

Additional context

No response

Would you like to implement a fix?

None

@pete-layerhealth pete-layerhealth added the bug Something isn't working label Mar 5, 2025
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

No branches or pull requests

1 participant