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

Convert span attribute values to strings #8

Open
garthk opened this issue May 15, 2019 · 7 comments
Open

Convert span attribute values to strings #8

garthk opened this issue May 15, 2019 · 7 comments

Comments

@garthk
Copy link

garthk commented May 15, 2019

As reported in opencensus-beam/opencensus_absinthe#10:

DD: Unable to send spans, DD reported an error: 400: 'json: cannot unmarshal number into Go struct field Span.meta of type string\n'

If DataDog can't cope with numbers, I think we'd better fix that in our DataDog adapters, because it doesn't make sense to change the rest of the OpenCensus ecosystem to cast attributes to strings just in case the spans might get sent to DataDog.

Nailing it down a little:

attribute_value() = any()
opencensus Erlang typespec

AttributeValueoneofTruncatableString …int64bool_valuedouble_value
OpenCensus protocol definition

A span contains a SpanContext and allows users to record tracing events based on the data model defined here
OpenCensus specification

@garthk
Copy link
Author

garthk commented May 15, 2019

@sneako, it occurs to me another good point to get this fixed is at DataDog's end. Their API reference says only:

a dictionary of key-value metadata. e.g. tags

… and doesn't express much about what types the values might be. Perhaps they're open to casting all the values they get to strings at receipt time?

@hauleth
Copy link
Member

hauleth commented May 15, 2019

I think it should be fixed in DD adapter.

@sneako
Copy link
Contributor

sneako commented May 15, 2019

@hauleth When you say 'DD adapter' are you referring to the Datadog agent, or this library?

@hauleth
Copy link
Member

hauleth commented May 15, 2019

This library.

@hauleth
Copy link
Member

hauleth commented May 15, 2019

@sneako DD probably should fix either their agent or documentation as well, but we do not have control over these. Fixing it there is better solution for now.

@sneako
Copy link
Contributor

sneako commented May 15, 2019

I have also opened a ticket with Datadog's support team to improve their documentation or the agent. Thanks everyone!

@sneako
Copy link
Contributor

sneako commented May 16, 2019

Datadog has updated their docs as well DataDog/documentation#4609

garthk pushed a commit to opencensus-beam/opencensus_absinthe that referenced this issue May 17, 2019
As we discovered during opencensus-beam/opencensus_datadog#8, OpenCensus
span attribute values [MUST] be one of:

* an integer
* a number
* a string
* a boolean

`:oc_trace.start_span/3` won't crash if we give it an attribute value of
`%Absinthe.Type.List{of_type: :string}`, but anything upstream encoding
to JSON or OpenCensus protobuf certainly will.

I've also renamed the attribute keys (also strings!) to match the period
delimited style used by `Opencensus.Plug.Trace`.

[MUST]: https://tools.ietf.org/html/rfc2119#section-1
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

No branches or pull requests

3 participants