-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
System for managing own telemetry attributes within pipeline components #12217
Comments
I like the general idea. A couple of questions:
|
We can leave it out. There may be some uses out there already, but they would be able to access it on the embedded zap logger.
We have 5 different attributes defined in the RFC, which differ based on component kind. Additionally, I would hope that in practice we see the need for removing attributes only a few specific cases. So my opinion is that such methods would be either inapplicable (e.g. receiver doesn't have a |
I think we need a new module which eventually contains:
Constraints:
The best I can come up with is |
Draft solution: #12259 |
Sounds reasonable to me |
Implements the logger described in #12217 Alternative to #12057 Resolves #11814 `component/componentattribute`: - Initializes new module - Defines constants for component telemetry attribute keys - Defines a `zapcore.Core` which can remove attributes from the root logger `service`: - Rebases component instantiation on attribute sets - Internal constructors for attribute sets for each component type - Constructs loggers from `componentattribute` `otlpreceiver`: - Uses `componentattribute` to remove `otelcol.signal` attribute from logger `memorylimiter`: - Uses `componentattribute` to remove `otelcol.signal`, `otelcol.pipeline.id` and `otelcol.component.id` attributes from logger
We have the solution for the logger now. However, we will likely need to apply a similar approach to the meter and tracer in the future. If we keep adding Also, I think it could be one mutation call to |
|
The meter/tracer provider don't contain attributes themselves, so to propagate the component attributes we would probably want to add separate I do however think the |
Since Am I understanding correctly, that you'd like us to have a single
I don't think it's necessary vs just listing constants, e.g., in memory limiter:
Minor notes:
Personally I like (1) best as I believe component authors should be thinking about the attributes on their telemetry, rather than thinking about an abstraction which they may not recognize as impacting their telemetry. |
If the intent is to use metric-level attributes for this, I suspect it will be a bit complex to do this for Since the discussion includes the possibility of modifying the recently added method |
I tried doing the MeterProvider wrapper: you need at least 21 wrapper structs (MeterProvider + Meter + each instrument + the observables for async instruments) to make it work. We could do it if we want to, it just makes me feel like this is not the right solution, given how complicated this is. |
Concretely: I wonder if metric attributes are not the right level for this, and these should be instrumentation attributes or resource attributes. The RFC is not very clear about what type of attributes these should be. |
Assuming we can find a clean way to move towards this approach and avoid overcomplication, I would prefer the option (3)
It'll help us control the migration of some attribute keys (e.g.,
We need to think about what the resource is in our case (which entity). We've been considering the collector as the resource. If we want to move some attributes to the resource level, we need to reconsider this. I think we can move all the attributes to the resource level if we consider the resource to be component instance. However, this can complicate re-aggregation. Currently, the collector doesn't provide any processor to do aggregation by resource attributes as far as I know, only by the datapoint attributes . So I'm not sure it that's the right move, but we still can consider it if that's required to proceed with the RFC. |
Since the library we are wrapping is stable, this seems reasonable to me. However, I think it's worth clarifying first whether we want to model component instances as resources or entities. IMO instrumentation is not technically correct because we intend to have external code (e.g. in the service graph) produce signals describing the component instances, but not originating from within them. |
My impression is that resource attributes describe where the telemetry is coming "from" as well, so I don't think it would be correct either. I'm not sure there is a convention for instrumentation libraries (here, the pipeline) to indicate which user (a component) of the instrumented library (the Consumer API?) caused the observed event. My opinion is that perhaps the least bad solution would be to set the instrumentation library name to |
@djaglowski could we add the clarification of what kind of attributes these are to the RFC? I don't have a strong opinion, but I think we can close the discussion that way. Also, @djaglowski @dmitryax I filed #12334 so that we can keep on experimenting on this while being able to mark component as 1.0 |
I agree we should update the RFC but I'd like to have some idea of what to propose. I'm unclear myself on what type of attributes are reasonable.
Resource attributes don't necessarily have to be applied from within the same code that the signals describe. For example, most pull-based receivers attribute signals to a resource, despite the receiver not being part of that resource. If we were to say that the RFC describes resource attributes, how is this applied for loggers? |
Some types of components are fully or partially shared across multiple instances. (e.g. otlp receiver / memory limiter)
I have previously pursued some optimistic models in which the collector would define certain ways in which sharing is "supported", but the reality is that sharing is an unbounded problem. e.g. Someone could write a processor that shares a data structure between logs and traces pipelines only if it's instantiated on a Wednesday and the component name is "foo". I am convinced that there are too many novel cases to model ahead of time, so here is a proposal to normalize attributes as much as possible, while still allowing component authors to both add or subtract attributes from their telemetry when appropriate.
I will use Loggers as the example here, but I believe the same general ideas can be applied to TracerProviders and MeterProviders.
General Idea:
Create a "Logger" struct specifically for use within components. This logger satisfies the same interface and behaves essentially the same as what we have today. However, it has the following important differences:
Without(key ...string)
method is provided, which allows component authors to remove attributes as appropriate for portions of the code that are shared. This is opposite the typical pattern used by loggers, but necessary if we want our default set of attributes to be correct.For example:
Without("otelcol.signal")
during construction to create a logger appropriate for the shared instance.Without("otelcol.signal", "otelcol.component.id", "otelcol.pipeline.id")
.Without("otelcol.signal", "otelcol.component.id")
to adjust the scope.This implementation looks something like this:
TracerProvider and MeterProvider can expose a similar
With
/Without
interface, but the implementation will be different.The text was updated successfully, but these errors were encountered: