-
Notifications
You must be signed in to change notification settings - Fork 524
AttributeSet in the OpenTelemetry API #1508
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
Comments
This feels like an arbitrary requirement to me. How many real users are
Is this just a theoretical concern or has this really been a legitimate issue in the past? We could make the We can remove precached attributes and only support bounded instruments. This means you still pay the cost of creation when a single attributeset can be used for multiple instruments. This isn't theoretical, for example every packet we receive uses the same attribute set for the "bytes received" counter and the "packet count" counter. This means you can't do an LRU cache of attribute sets, so if your web server handles a request from a tenant it can cache tenant specific attribute sets assuming the load balancer will probably send another request for that tenant to the server again. We could make |
After talking with Cijo a bit, we came to the conclusion to revert the precached attribute set work, pause the bound instruments API, and add the concept of instrument level attributes at instrument (e.g. counter) creation time. I'll investigate what that will look like. |
Adding some more context:
The idea of adding attributes at Instrument creation time, and then providing nothing more at the measurement reporting time, can allow the SDK to offer a very fast Metrics SDK, for those scenarios where the attributes are known ahead of time (as in the case @KallDrexx is primarily after.) This is similar to bound-instrument concept, but there is no need of strictly providing a bound-instrument API, as it is possible to achieve this with instrument level attributes. counter = meter.CreateCounterWithAttributes(name,descp, attributes); In the SDK, counter.Add(1) (measurements with no attributes) can be implemented very efficiently as there is no need to spend time on attributes (which we know are a huge overhead), and there is no need of hashmap lookup (as we can special case the 0-attribute case). This does not prohibit future re-addition of AttributeSet or addition of a more formal Bound instrument idea - just starting with the above, so as to unblock some high-perf scenarios. (A significant amount of efforts already went into AttributeSet/Bound - we hope they are not totally wasted. we should be able to leverage them in the future) |
SIG call:
|
#1421 allowed pre-creation of
AttributeSet
for scenarios requiring high performance. This also movedAttributeSet
to the opentelemetry api. This has an undesired/unintended side effect: The entire cost of creatingAttributeSet
is now paid in the API itself (like sort/hash/de-duplication), making it impossible to do optimizations in the SDK, as the perf hit is already paid in the API itself.This violates the core OTel requirement that the overhead of using the OTel API should be zero/close-to-zero, without an SDK configured. Because right now, even without an SDK configured, the OTel API does the
AttributeSet
creation which is a far from the zero/close-to-zero overhead. i.e the NoOp implementation is broken.This is similar to #1189, but this is much more serious due to the perf hit.
Need to find a way to achieve the intended perf gains, but yet move off entire
AttributeSet
creation to the actual SDK. Will discuss some ideas in the next community meeting.cc : @lalitb @KallDrexx
The text was updated successfully, but these errors were encountered: