Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Design document for otelhttpconv package #6859
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
base: main
Are you sure you want to change the base?
Design document for otelhttpconv package #6859
Changes from all commits
800942f
e7e8c88
87a12f6
cdd2a52
4895dc2
65ba119
fbc47f1
63f9061
96054d1
4084bc3
5efaca9
2e58049
f51a9fa
d96c7ec
77d428d
1468bfd
9231a54
fc9dd8c
c7c2fe6
2788ed3
cfd8b48
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be a problem to use a
struct
? They can still be used as foundations. The users can always create their own interfaces if they need to support different implementation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you do that?
If we provide the following API:
And
otelhttp.WithHTTPConv
takes a struct, you can't extend it. It has to be our implementation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otelhttp
would define the interface as this is the package that accepts input and nototelhttpconv
which provides an implementation.otelhttp
should not exposeotelhttpconv
typesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss this during today's SIG meeting. We have different views here.
While otelhttp would definitely use this package, the idea here is that other packages which currently use the generated
semconv
package would too.Then, they need the types exposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Sure but these can be
struct
and notinterface
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to support custom semconv implementations?
I think it is an overkill (and footgun). Shouldn't we just focus on OTel SemConv?
People not happy with OTel SemConv can create their own instrumentation libraries.
I propose that
otelhttpconv
has "concrete" implementations (functions, structs).If we want to ever provide customization of semconv, I would rather add it on the instrumentation library layer as this is the API that the user is interacting with.
otelhttpconv
should be used "internally" by instrumentation libraries.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think being able to support custom semantic conventions is just a side effect of the modularity. The real interesting thing here would be to be able to support unstable semantic conventions, with no breaking changes on the code that supports stable ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it hard to evaluate without code and examples.
Unstable semantic conventions could be also controlled by env vars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then what is our plan if we would like to add a new functionality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as for the interfaces in the SDK. We either introduce a new interface, or we release a v2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a struct we could simply add new fields/method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of exposing an interface if we want to provide only one implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that folks can provide their own implementation.
Also, I do mention that we may provide additional implementations later on, for unstable conventions for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The places where we want to allow passing custom implementations should define the interface (e.g.
otelhttp
).otelhttpconv
does not accept any custom implementation.Reference: https://go.dev/wiki/CodeReviewComments#interfaces
To be honest, I am not even sure if we need to support custom semantic conventions (we never did that).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NewHTTPConv
is not defined in the design.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, that seemed clear to me. It creates an instance of our official implementation of the interface.
Since the implementation itself isn't in the design, I didn't add this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this coupled to
otelhttpconv.NewHTTPConv
?Are we sure that it would work with other custom semantic conventions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this goes with your other comment. If we make the body and response wrapper structs and internalize their logic then, this will indeed change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, even with structs for the wrappers, I think this design makes sense.
Building a response wrapper from an
HTTPConv
would be strange, as then each implementations would need to know how to build a wrapper as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But wouldn't the wrapper functionalities by detriment by what
httpconv.Record
is supposed to do? I feel like those structures are coupled to each other. E.g. I guess that for somehttpconv
the reponse needsBytesWritten
but for other it is unnecessary.