-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Split pdata package without using aliases #4919
Conversation
31094f2
to
7c4207a
Compare
7c4207a
to
9327fc3
Compare
I think that |
Did you mean #4918? I don't see a naming proposal in #4833 that looks relevant here, but I agree that the structure proposed in #4918 would probably be preferable. |
I agree we should have
You're right, I meant #4918 |
Sure, but in those cases we don't need those exported initializers, do we? I don't think that the |
SpanID/TraceID doesn't have an initializer but the struct is used directly https://github.com/open-telemetry/opentelemetry-collector/blob/main/model/pdata/generated_log.go#L604.
I think even we remove the indirection, we still want to restrict access the the private |
Yes, but they wouldn't be exposing internal types. The whole reason for jumping through hoops with internal packages and non-public initializers is that we don't want to expose the OTLP implementation we're using. That's a non-issue for span and trace IDs as they're well-defined to be |
This change demonstrates the approach outlined as Option 2 in #4832.
It splits /model/pdata package into multiple packages per signal using the following structure:
The naming is different from what is suggested in #4833 just to illustrate an example. IMO naming suggested in #4833 would work better with names of other packages and data structures within the collector repo.
This change introduces the following public functions that are needed only by the
p<signal>
packages frompcommon
package:func InstrumentationLibraryFromOrig(orig *otlpcommon.InstrumentationLibrary) InstrumentationLibrary
func AttributeValueFromOrig(orig *otlpcommon.AnyValue) AttributeValue
func AttributeMapFromOrig(orig *[]otlpcommon.KeyValue) AttributeMap
func ResourceFromOrig(orig *otlpresource.Resource) Resource
func SpanIDFromOrig(orig data.SpanID) SpanID
func SetSpanID(spanID SpanID, orig data.SpanID)
func TraceIDFromOrig(orig data.TraceID) TraceID
func SetTraceID(traceID TraceID, orig data.TraceID)
This change also introduces aliases from
model/pdata
tomodel/p<signal>
for backward compatibility that can be removed once clients are migrated tomodel/p<signal>