open-telemetry / opentelemetry-collector

OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
4.29k stars 1.42k forks source link

Setting InstrumentationScope when exporting OTLP from another format #6145

Open tsloughter opened 1 year ago

tsloughter commented 1 year ago

This feature/issue is related to the spec issue https://github.com/open-telemetry/opentelemetry-specification/issues/2833 but in the case of the collector this applies to all Signals.

When spans, metrics and logs come into the collector from sources that don't have InstrumentationScope how are the export protos constructed to export over OTLP? A blank or empty Scope?

bogdandrutu commented 1 year ago

This is what we do right now. Do you have a proposal on what to do?

tsloughter commented 1 year ago

I don't. @tigrannajaryan asked me to open this on the collector when I asked about what we do for logs in the SDK.

But which do you do in the collector, empty name/version or no scope? The former I guess would group together while the latter wouldn't necessarily mean they are grouped together.

bogdandrutu commented 1 year ago

But which do you do in the collector, empty name/version or no scope?

In the collector we do not distinguish between empty name/version and no scope. Based on the proto definition https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto#L66 they are equivalent.

tsloughter commented 1 year ago

Ok, maybe this isn't an issue in the collector (or the log spec as I take it it should also just be unset, but should still be mentioned in the spec). I'll wait to hear from Tigran if this can be closed and will open a PR for the log spec tomorrow to propose an addition to the log spec making it clear an empty scope should be used for those logs with no scope.

tigrannajaryan commented 1 year ago

@bogdandrutu I don't remember if we discussed this in the past. I was wondering if we want to have some explicit guidance about this in the Collector? Do we think that empty/no scope is the right approach for all Collector receivers except otlp?

bogdandrutu commented 1 year ago

Do we think that empty/no scope is the right approach for all Collector receivers except otlp?

I think we should have something, maybe similar to what metrics decides to do for the MetricProducer case as well. @dashpole any insight here?

dashpole commented 1 year ago

IMO receivers should set scope if they define the telemetry (e.g. hostmetrics receiver). If they don't, they can try and find a similar notion of scope for the telemetry they receive and use that. Otherwise, they should leave scope empty.

If scope just means "something that touched telemetry" as part of an ingestion pipeline, I don't think it is as meaningful or useful