-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Reorganize propagation code (shrink PR 381) #444
Reorganize propagation code (shrink PR 381) #444
Conversation
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 restructuring all looks good.
The package names tpropagation
and bpropagation
do not seem like good package names to me. The first letter coming from each of their containing directory seems like a stutter and a decision made based on another packages existence. The fact that the api/context/propagation
package is also not named api/context/cpropagation
seem to me like we are being inconsistent.
I'm in favor of just calling all the packages propagation
and scoping the package based on the directory they are in. Using the language's package renaming syntax to resolve the naming collisions I think is an acceptable approach. That is the reason it was included in the language.
That all being said, it seems to me that naming is not the main point of this PR. I'm fine with merging it as is if we want to address the package naming later. Or, if I'm the only one with this view, I'm fine with going along with this decision.
I'd say the reason for it in the language is the inevitable existence of name clashes between various libraries imported in the same file. But within a library, I'd prefer to avoid having such clashes.
Thanks for the review. I'm still on the fence with the organization. Maybe |
I won't object if we change package structure, and I don't know what's best. I can imagine the contents of |
+1 |
Sounds good, thanks. |
Got an import cycle, yeeeey…
Will move the tests into a |
Correlation is the name we agreed upon.
The trace propagators tests had to be moved to a testtrace subpackage to avoid import cycles between api/trace and internal/trace. Needed to shut up golint about stutter in trace.TraceContext - TraceContext is a name of a W3C spec, so this stutter is expected. It's certainly still better than golint's suggestion of having trace.Context.
This package will not contain any propagators in the long run, just the interface definitions.
d06f837
to
5b636c7
Compare
Updated. I moved the trace propagators test to the already existing |
How about renaming it trace.ContextPropagator? |
I'm reluctant. TraceContext is a name of the W3C spec that this propagator implements. It also sounds too generic - might give an idea that this is the propagator you want to use (while there is also b3 propagator to choose from). I was rather thinking about keeping the name and adding the But I'd prefer to just move on now and I could file an issue about names after this PR gets merged. WDYT? |
Long, but I don't have better suggestion.
sure. Opened #448 |
This PR moves some propagation-related files around without the significant changes to the code (most of the diff is because of the package renames). This is to shrink #381. The propagation interfaces will be later reworked, but at least they will stay in the packages as proposed here.
The organization of the files proposed here is as follows:
The changes I have made (compared to #381) is that I have renamed the trace propagation package to tpropagation and baggage propagation package to bpropagation. This is to avoid name clashes on imports that would always be fixed by using a named import (like
import traceprop "go.opentelemetry.io/api/trace/propagation"
).There is one change I haven't made, but I'm still inclined to do is to remove the "context" package from api/context/* packages, so we would have api/propagation with propagation interfaces, api/baggage with the map and api/baggage/bpropagation with the baggage propagation code. What do you think?