Add typed collector resource attributes based on declarative config#14412
Add typed collector resource attributes based on declarative config#14412mx-psi merged 32 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (94.87%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #14412 +/- ##
=======================================
Coverage 91.31% 91.32%
=======================================
Files 702 700 -2
Lines 45265 45314 +49
=======================================
+ Hits 41334 41381 +47
- Misses 2781 2782 +1
- Partials 1150 1151 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aebf0c4 to
81457be
Compare
Merging this PR will improve performance by 41.21%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | BenchmarkTraceSizeSpanCount |
60 ns | 47 ns | +27.66% |
| ⚡ | BenchmarkHTTPProtoLogsSequential |
5.1 ms | 3.6 ms | +40.76% |
| ⚡ | BenchmarkGRPCLogsSequential |
6.2 ms | 4.4 ms | +41.21% |
Comparing iblancasa:14411 (5642768) with main (f9d2c94)
Footnotes
-
76 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
Do you think it would be possible to use configoptional.MapList instead of reimplementing the fallback logic? I'm not sure if it would work for your use case, but just in case you hadn't heard of it. |
Thanks for the suggestion. You comment actually points to I looked into it. |
There was a problem hiding this comment.
Sorry for the delayed review. I think implementing the declarative config's resource struct in service/internal/resource and using it in service/telemetry/otelconftelemetry is not a good idea and goes against the existing architecture.
Like for the rest of the internal telemetry config, I think we should be relying on otelconf's implementation (see Resource struct here) to implement the config specification, with "migration" logic to preserve backward compatibility with the old format, then use its output directly when instantiating the SDK, and convert it into a pcommon.Resource when necessary.
I see. I will take a look and come back. Thanks! |
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
Let me check. I reused some stuff from the previous changes and other PRs opened before. Very likely there are things in otelconf I'm not aware of. Will take a look to see what I can do. Thanks again for your fast review. |
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
jade-guiton-dd
left a comment
There was a problem hiding this comment.
Thank you for the update. I still think there's some simplification we can do here. I left some suggestions, but haven't tested them, so take them with a grain of salt.
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
|
Thank you for filing these go-contrib and spec issues; since I'm the one who suggested that change in otelconf, feel free to tag me in those threads. I'll try to chime in if necessary. |
jade-guiton-dd
left a comment
There was a problem hiding this comment.
Looks good! Thank you for all your work
Do we mark it as discouraged somewhere?
Will the sdk detectors work with opamp extension/supervisor? I'm not against this. I'm a bit concerned about two separate solutions in the same binary that could potentially diverge and produce different results. We probably should start using the sdk detectors libraries in the detection processor going forward |
Since we mostly agree on this PR, I will create another one for the supervisor open-telemetry/opentelemetry-collector-contrib#45116
Very likely. |
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
No. We used to document it as a discouraged option on the "Internal telemetry" docs page, but in the end after discussion on the opentelemetry.io repo, it was decided this option was so unreliable it shouldn't even be mentioned. Considering some vendors (*coughs*) recommend it in their own docs regardless, maybe we should reintroduce an explicit warning about it? |
Yes. The SDK resource detectors will define the Collector internal telemetry's resource attributes, which is what the OpAMP extension surfaces. But I share your concern about divergence. The SDK detectors are certainly not going away, so I agree it would be better to contribute to them and base Collector processors on them than the other way around. |
|
I think this got some approvals. Maybe we can merge? |
The argument I have heard is that if the Collector is overloaded, sending it's own telemetry to itself before processing makes the problem worse and risks that telemetry not making it to a backend in a timely manner. Therefore the recommendation is to remove that hop and send it to a separate Collector if necessary. |
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
d772145
Description
Implement OpenTelemetry configuration schema for OpenTelemetry Collector resource attributes.
It keeps backward compatibility.
Link to tracking issue
Updates #14411