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

Zipkin Receiver: Zero Duration Spans have no endtime #1749

Closed
chris-smith-zocdoc opened this issue Sep 8, 2020 · 0 comments · Fixed by #1750
Closed

Zipkin Receiver: Zero Duration Spans have no endtime #1749

chris-smith-zocdoc opened this issue Sep 8, 2020 · 0 comments · Fixed by #1750
Labels
bug Something isn't working

Comments

@chris-smith-zocdoc
Copy link
Contributor

Describe the bug
If a zipkin span is sent with a zero duration or without the duration set, the zipkin receiver does not set the end time on the span. This bug was introduced in #1446

With the endtime unset, this causes errors in other processors that may look at the span duration as they may do end - start to compute the duration, resulting in a large negative duration.

Steps to reproduce
Post a span to the collector like this

[
{
        "traceId": "98bea8e9894443d9",
        "id": "98bea8e9894443d9",
        "kind": "SERVER",
        "name": "fast-span",
        "timestamp": 1599577303251000,
        "localEndpoint": {
            "serviceName": "client-name",
            "ipv4": "127.0.0.1"
        },
        "tags": {
            "foo": "bar"
        }
    }
]

or like this

[
{
        "traceId": "98bea8e9894443d9",
        "id": "98bea8e9894443d9",
        "kind": "SERVER",
        "name": "fast-span",
        "timestamp": 1599577303251000,
        "duration": 0,
        "localEndpoint": {
            "serviceName": "client-name",
            "ipv4": "127.0.0.1"
        },
        "tags": {
            "foo": "bar"
        }
    }
]

What did you expect to see?
The endtime should be set to the starttime

What did you see instead?
endtime is the default value 0

What version did you use?
Version: 8e5c6065eb0e07e9f4d01552de22acccf174a41a

Additional context
I believe the fix should be to return to the previous implementation

https://github.com/open-telemetry/opentelemetry-collector/blob/master/translator/trace/zipkin/zipkinv2_to_traces.go#L169-L171

dest.SetStartTime(pdata.TimestampUnixNano(startNano))
dest.SetEndTime(pdata.TimestampUnixNano(startNano + zspan.Duration.Nanoseconds()))
@chris-smith-zocdoc chris-smith-zocdoc added the bug Something isn't working label Sep 8, 2020
chris-smith-zocdoc added a commit to Zocdoc/opentelemetry-collector that referenced this issue Sep 8, 2020
chris-smith-zocdoc added a commit to Zocdoc/opentelemetry-collector that referenced this issue Sep 8, 2020
MovieStoreGuy pushed a commit to atlassian-forks/opentelemetry-collector that referenced this issue Nov 11, 2021
* Update SamplingParameters

Remove HasRemoteParent fields from SamplingParameters. The
HasRemoteParent field is a duplicate of the Remote field of the parent
span context contained in the ParentContext.

Change the `ParentContext` field from storing a `SpanContext` to a
`context.Context` that holds the parent span. This is to conform with
the OpenTelemetry specification and resolve open-telemetry#1727.

* Update PR number
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.

1 participant