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 to Zipkin Mapping #221

Closed
wants to merge 3 commits into from

Conversation

hekike
Copy link
Member

@hekike hekike commented Aug 18, 2019

Define mapping between OpenTelemetry and Zipkin Span(s).
This is my very first spec here, probably I'd need some guidance to carry this to the finish line.

Some of the things in this spec requires further discussion, this initial version is mainly based on the current opencensus-node behavior.

https://github.com/openzipkin/zipkin-api/blob/master/zipkin2-api.yaml
Related issue: #220

@hekike hekike mentioned this pull request Aug 18, 2019
@hekike hekike changed the title feat(zipkin): add mapping OpenTelemetry to Zipkin Mapping Aug 18, 2019
|`span.attributes` | `span.tags`
|`span.status.code` | tag as `ot.status_code: OK`
|`span.status.message` | optional tag as `ot.status_description: {msg}`
|`span.events` | `span.annotations`, skip on event attributes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe encode the attributes as well: $name + "{" + $attr.key + " : " + $attr.value + ", " + ...}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Event with the same name can happen multiple times. Maybe we could add a counter like:
$name + ($index) + "{" + $attr.key + " : " + $attr.value + ", " + ...} for example:

{"my-event-name(1): { "key1": "value1", "key2": "value2" },
{"my-event-name(2): { "key1": "value1", "key2": "value2" }

### SpanKind

Zipkin doesn't support OpenTelemetry's `SpanKind.INTERNAL`.
`SpanKind.INTERNAL` type MUST be reported to Zipkin as `SERVER`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpanKind.INTERNAL means no present for Zipkin, that's how I read their description.

Copy link
Member Author

@hekike hekike Aug 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that we shouldn't even send it?
I don't see mention of INTERNAL here: https://github.com/openzipkin/zipkin-api/blob/master/zipkin2-api.yaml

I'd prefer to report them because SpanKind.INTERNAL is our default SpanKind type in OpenTelemetry. We can easily confuse people at integration time when they create spans but don't see them in the backend. Or force them to change their code in the case of switching exporters.

I'd vote for mapping INTERNAL to a different SpanKind or make mapping configurable with an option of skipping it with. The default could be SERVER. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am suggesting to not set the type in Zipkin for these spans.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a member of the Zipkin team +1 to what @bogdandrutu has said, default value, which SpanData.INTERNAL signifies, is null in Zipkin


Status|Tag Key| Tag Value
|--|--|--|
|Code | `ot.status_code` | Name of the code, for example: `OK`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is opentracing standardization, does Zipkin follow that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my understanding, it doesn't. Status is a nonexisting concept in Zipkin. No mention of Status here https://github.com/openzipkin/zipkin-api/blob/master/zipkin2-api.yaml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I would suggest probably to put a TODO and change this when opentelemetry defines this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writing "status" as some specific tag is what was requested in OC Zipkin Java: census-instrumentation/opencensus-java#1931 (comment)

The only thing is that the prefix ot may get people thinking that this is OpenTracing...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and Zipkin pre-dates OpenTracing and has its own conventions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In OpenCensus service we tried to capture the handling of status and conversions at this doc https://github.com/Omnition/internal-opencensus-service/blob/internal-production/translator/trace/README.md

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pjanotti his file must be in private repo. Link shows 404 for me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tigrannajaryan do you think you can share this document somehow?

Copy link
Member

@tigrannajaryan tigrannajaryan Oct 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the exact same code and README in public OpenTelemetry Collector: https://github.com/open-telemetry/opentelemetry-collector/tree/master/translator/trace

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hekike I'd suggest to follow the OC Agent conversion logic whenever possible

### SpanKind

Zipkin doesn't support OpenTelemetry's `SpanKind.INTERNAL`.
`SpanKind.INTERNAL` type MUST be reported to Zipkin as `SERVER`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a member of the Zipkin team +1 to what @bogdandrutu has said, default value, which SpanData.INTERNAL signifies, is null in Zipkin


## Unit of Time

Zipkin times like `timestamp`, `duration` and `event.timestamp` MUST be reported
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Zipkin times like `timestamp`, `duration` and `event.timestamp` MUST be reported
Zipkin times like `timestamp`, `duration` and `annotation.timestamp` MUST be reported

@SergeyKanzhelev SergeyKanzhelev added this to the Alpha v0.3 milestone Oct 16, 2019
@tigrannajaryan
Copy link
Member

@hekike we have a working translation (in Collector code) between Zipkin and OpenCensus (which is close to OpenTelemetry). Did you have a chance to see if your proposal matches the existing translation or it is different: https://github.com/open-telemetry/opentelemetry-collector/tree/master/translator/trace#zipkin-to-oc

@SergeyKanzhelev
Copy link
Member

@open-telemetry/specs-approvers this PR was stale for a while. Any takers to move it forward? It seems that there is enough reference materials to get going


OpenTelemetry `Event` has an optional `Attribute`(s) which is not supported by
Zipkin.
These `Event` attributes are may be left out from the final Zipkin payload.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zipkin doesn't have an Event field does it? In the OpenCensus Erlang reporter I turned them into annotations.

If that is the case, why not define a way to include them. In the opencensus reporter for Erlang I include them when buliding annotations by making a string https://github.com/opencensus-beam/opencensus_zipkin/blob/master/src/oc_reporter_zipkin.erl#L95 and https://github.com/opencensus-beam/opencensus_zipkin/blob/master/src/oc_reporter_zipkin.erl#L101

If there is going to be a mapping we may as well go all the way and not leave out data :)

TuckTuckFloof pushed a commit to TuckTuckFloof/opentelemetry-specification that referenced this pull request Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants