-
Notifications
You must be signed in to change notification settings - Fork 196
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
Template types: define type-safe examples #1740
Comments
Thanks for digging into this! I do agree on the examples side - template examples are not strongly typed and are confusing. E.g. If someone reports Content-Length as a single value From schema perspective, I wonder if we should tackle template attributes as a part of #1669 - we could as well record them as
and it would be exported as {
...
"attributes" [
"http.request.headers": {
"foo": ["bar"],
"baz": ["...", "..."]
}
]
...
} I believe we don't have full consensus on using complex attribute types on spans, so the actionable part seem to be improving examples.
Does this data have any indication of where it came from in the instrumentation scope? Maybe we can create issues for those instrumentations to fix it? |
@lmolkova - You are right of course. Turns out the non-compliant examples I found for However, there are examples of mixed-types in the semconvs examples today (non-stable). Also, your example Anyway, as you say, the actionable part of this issue is the examples definitions. Does the key-value list look suitable? |
Changed the title of this issue to better represent the task following the discussion. |
There are real-world examples of template types in use that already create non-compliant output. For exampleThere arehttp.request.header.KEY
is defined with type:template[string[]]
. However, it is common to see a single string rather than an array of strings in the data sent out.alsoexamples already defined that suggest a mixed-type for the dictionary values would be preferable.Secondly, the definition of template type examples (with or without a mixed-type) is not strongly-typed. This makes it hard/impossible to check with weaver and therefore ensure correctness.
Here are some examples from the current semconv definitions:
Mismatch key:
Missing keys:
Mixed types:
Suggestions:
Allow mixed type values within template types. Either remove the strict typing:
Replaced with just
template
.Or, add a mixed-type definition:
template[any]
Make examples type and correctness checkable:
Note: I've included a mixed type case here
The generated documentation can combine the
key
with theid
preventing mistakes as seen in the rpc example above.The text was updated successfully, but these errors were encountered: