-
Notifications
You must be signed in to change notification settings - Fork 451
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
Add Resources to Recordable interface. #570
Conversation
Codecov Report
@@ Coverage Diff @@
## main #570 +/- ##
=======================================
Coverage 94.40% 94.40%
=======================================
Files 200 200
Lines 9067 9086 +19
=======================================
+ Hits 8560 8578 +18
- Misses 507 508 +1
|
{ | ||
attribute->mutable_value()->set_bool_value(nostd::get<bool>(value)); | ||
} | ||
|
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: remove blank line.
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.
IIUC, rather than passing resource to exporter, we're copying all the labels across spans and assuming they all share the same set?
This code was a bit harder to follow. WDYT about one of the following:
- Keep the
Resource
bundled into that type instead of using the name "resource attribtues" - Modify
MakeRecordable
interfaces to take in a resource - I'm happy to take a stab at an interface for sending resource from the TracerProvider. (Specifically I'd add a
setResource
onProcessor
that is called when a processor is added to theTracerProvider
).
auto resource = rec->GetResources(); | ||
if (resource.attributes_size()) | ||
{ | ||
// TODO |
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.
Is this ready for review?
* @return the resource of this span | ||
*/ | ||
const std::unordered_map<std::string, opentelemetry::sdk::common::OwnedAttributeValue> | ||
&GetResources() const noexcept |
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.
Why doesn't this return a Resource
object?
@@ -213,6 +223,14 @@ class SpanData final : public Recordable | |||
span_kind_ = span_kind; | |||
} | |||
|
|||
void SetResourceAttribute( |
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.
I'm trying to understand what this method is intended to do and where it is in the spec.
Fro what I gather, this is basically copying all the resource-attributes onto the span. Can we instead just grab a reference to the resource?
Thanks @jsuereth for your comments. I will prefer option 3 unless Resource is made append-only/mutable in spec. Will like to go with option 2 if that happens. Would wait for more suggestions before doing changes accordingly. |
@lalitb Sounds like a plan. I'll get something to you as soon as I can (this week, likely) |
Ok #575 is ready for comment/comparison. |
This is second part of initial Resource SDK implementation ( #502 ) - to propagate resources to Span exporters through Recordable interface.
TODO -> Modify otlp exporter to export resources. This is dependent on #567 , as the spans need to be grouped on basis on Resources and Instrumentation Library before exporting.
@jsuereth - It doesn't use alternate approach from processor to exporters, as that would need re-work if Resources are later made as mutable / append-only attributes ( as there are some discussion happening on this (and you are already part of that disucssions :) ) : open-telemetry/opentelemetry-specification#1298 ).
Moving to draft, as per comments from Josh.