-
Notifications
You must be signed in to change notification settings - Fork 8
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 configuration to disable attribute enrichment #58
Conversation
What's the reason behind this change? Could it also be achieved with a subsequent |
It was mostly driven by introducing
Hmm, that makes sense. I am overall a bit confused on what configuration should be a separate processor and what should be done within a processor. For example, in the case of elastic-traces processor (which would use this library for enrichment) there could be 2 types of configuration:
In my opinion, |
My understanding of how this enrichment works is broadly as follows, let me know if I'm off.
Then we have the following requirements:
What I'm a bit confused about is how making So the alternative I'm thinking of would be:
|
This looks correct to me. IIANM, in addition to this path, the
Making the fields configurable would allow us to accommodate the pipelines to produce the required attributes for each path.
I was thinking why not only set the
+1 on this, we will require this bit. |
Isn't the I'm probably missing something here - would you be able to share a collector config YAML to illustrate how you see the final pipeline being configured? |
@lahsivjar and I chatted and he clarified that we would have multiple instances of the elastictrace processor, with each one setting a subset of attributes according to requirements. So only the one destined for producing |
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
enrichments/trace/config/config.go
Outdated
|
||
// AttributeConfig is the configuration options for each attribute. | ||
type AttributeConfig struct { | ||
Disabled bool `mapstructure:"disabled"` |
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.
When it comes to the collector config, I think it may be a bit easier to understand if we use enabled: true|false
, with the default being enabled for all attributes.
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 debated a bit on this (enabled vs disabled). If we choose enabled then we would have to provide something like AllEnabledConfig
that can be used in the processor and be careful when we add new attributes. That is also okay. Do you think it makes sense to use enabled
all the way (here in the lib as well as in the processor)?
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 have updated the code to use enabled
as the config and also provided a method to get a configuration with all enrichments enabled.
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. YMMV, but I think it may be simpler to use option args here, like:
Enrich(traces, trace.WithTransactionRoot(false))
Then keep the mapstructure config in the collector-components connector code.
@axw The issue with functional options is that any changes to the lib will require a followup in the collector components repo. My current plan is to directly embed the config here as a collector config and use the |
I would personally rather keep the config for the connector with the connector code, and keep this code just for the business logic shared across apm-data and the components. But I don't have such a strong opinion that I'd block it. As an aside, I think the user-facing configuration could be a little less verbose. Something like: enabled_attributes:
- event.outcome
- transaction.* And that would be translated to the more efficient structure you have. But maybe let's get this merged and follow up on what the ideal config looks like, I don't want to delay this further than I already have :) |
Allows enabling/disabling enrichment of specific attributes.
Related to: https://github.com/elastic/opentelemetry-dev/issues/304