-
Notifications
You must be signed in to change notification settings - Fork 440
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
[API] Add InstrumentationScope attributes in MeterProvider::GetMeter() #2224
[API] Add InstrumentationScope attributes in MeterProvider::GetMeter() #2224
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2224 +/- ##
==========================================
- Coverage 87.43% 87.39% -0.04%
==========================================
Files 199 199
Lines 5997 6009 +12
==========================================
+ Hits 5243 5251 +8
- Misses 754 758 +4
|
Proof of concept, ready for review and discussion. This code assumes that #2222 is already merged in main, and is an example of how to deliver fixes with breaking changes. |
Thank you for the POC for supporting multiple ABI versions. I don't see any issue with this implementation to support the idea. However, I have concerns about the long-term management of these versions. Given that there may be ABI breaking changes that affect various files and components in the repository, we are using ifdef macros throughout these areas. As time goes on, the code may become increasingly challenging to handle. The question we need to address is whether it is truly necessary to maintain backward compatibility for ABI compliance. At present, when we talk about ABI compliance for the otel-api, it encompasses the following aspects:
|
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.
Thanks Mark for the great work as always. changes in this PR and #2222 look good.
However, I have similar concern as @lalitb. I think it will be very challenging to maintain backward compatibility. Even if we choose to follow this path, we need to decide how far we are going to be backward compatible. Let's discuss in the next SIG meeting :)
Thanks for looking at the proposal. Some comments below, organized by topics. Maintenance complexityAssume we implement 10 breaking changes, for 10 different unrelated reasons. The proposal is not to introduce a feature flag for each change, Instead, the proposal is to define only one additional configuration, This point alone makes a huge difference (and, keep in mind that if we do not By the time ABI v2 is introduced, Now, as long as ABI v2 is still in experimental status,
A single build in CI is not an issue, and should not be a burden. By the time ABI v2 is changed from experimental to stable, IF we want to maintain concurrently ABI v1 and ABI v2 in stable status for
in effect increasing the CI load. The next logical step is to declare ABI v1 deprecated, In this phase, the CI build can be simplified to:
In conclusion, and assuming we repeat the pattern, the complexity at any
Today we have:
In conclusion, yes, this increases complexity by having more combinations Maintain several ABIA valid discussion point is to decide if we do or do not need to maintain To evaluate this, let's first consider a typical usage scenario, Use caseAssume that a vendor delivers a library, instrumented for opentelemetry-cpp, All versions are for illustration. (1) Vendor LIB distributes a package compiled using opentelemetry-cpp 1.10.0. (2) Then, a different party, vendor APP, uses the package to build an application, Vendor APP:
Changing the ABIIn this scenario:
and the APP crashes. We all know this is to avoid, which is why no breaking changes are introduced This solution is not viable, the point of this section is to repeat why. Supporting only one ABI at a timeAssume a breaking change is implemented in opentelemetry-cpp 1.12.0, In this scenario:
The code links properly, and does not crash. At runtime however, LIB is not instrumented, Setting a global provider singleton in the APP, using in ABI v2, My opinion on this is that this is not viable. We can't ask applications to link with an old library, like APP using We can't tell people producing a LIB binary package for a library instrumented for Supporting multiple ABIIn this case: When compiling with opentelemetry-cpp 1.10.0, only one ABI is available, When compiling with opentelemetry-cpp 1.15.0, two ABI are available, ABI v1 The application, APP, decides to compile against opentelemetry-cpp 1.15.0 The application links, does not crash, AND provides instrumentation in LIB. By the time opentelemetry-cpp 1.20.0 is released, maybe ABI v1 will be The point here is that deciding to use one ABI versus another is a choice made |
Fix blocked by: |
Added unit tests.
Expanded unit tests
/easycla |
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.
LGTM. nicely done.
attributes->ForEachKeyValue( | ||
[&](nostd::string_view key, opentelemetry::common::AttributeValue value) noexcept { | ||
SetAttribute(key, value); | ||
return true; |
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.
nit - some code duplication, which can be moved to a separate utils method. But don't see it really required to fix
Do you want to have a second look, or ok to merge now ? |
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.
LGTM and thanks.
## Changes Update spec-compliance-matrix.md for C++: * `Get a Tracer with scope attributes` implemented by: * open-telemetry/opentelemetry-cpp#2371 * `Links can be recorded after span creation` implemented by: * open-telemetry/opentelemetry-cpp#2380 * `get_meter accepts attributes` implemented by: * open-telemetry/opentelemetry-cpp#2224
## Changes Update spec-compliance-matrix.md for C++: * `Get a Tracer with scope attributes` implemented by: * open-telemetry/opentelemetry-cpp#2371 * `Links can be recorded after span creation` implemented by: * open-telemetry/opentelemetry-cpp#2380 * `get_meter accepts attributes` implemented by: * open-telemetry/opentelemetry-cpp#2224
Fixes #2033
Changes
API:
GetMeter()
api with 4 parameters, only available inABI VERSION 2
CI:
ABI VERSION 2
.For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes