-
Notifications
You must be signed in to change notification settings - Fork 0
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
Enhance resourceprocessor #3
Conversation
ecsConfig := ecs.CreateDefaultConfig() | ||
return ecsConfig |
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.
Just for brevity :)
ecsConfig := ecs.CreateDefaultConfig() | |
return ecsConfig | |
return ecs.CreateDefaultConfig() |
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.
Done
@@ -97,7 +97,6 @@ func createDefaultConfig() component.Config { | |||
Detectors: []string{env.TypeStr}, | |||
HTTPClientSettings: defaultHTTPClientSettings(), | |||
Override: true, | |||
Attributes: nil, |
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.
We should not drop this config right away. It should be supported for some time as a deprecated option. See https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/splunkhecexporter/config.go#LL88C2-L88C16 as an example
"net/http" | ||
"reflect" | ||
"regexp" |
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.
These must be in the first group. Linter will complain :)
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.
Done
if _, err = d.metadataProvider.InstanceID(ctx); err != nil { | ||
d.logger.Debug("EC2 metadata unavailable", zap.Error(err)) | ||
return res, "", nil | ||
} |
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 is this removed?
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.
By mistake I think, brought it back
attr.PutStr(conventions.AttributeHostType, meta.InstanceType) | ||
attr.PutStr(conventions.AttributeHostName, hostname) | ||
|
||
setResourceAttributes(dictionary, resourceAttributes, attr) |
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 assume you added this function for easier future maintenance, but setResourceAttributes
is hard to read, and we might generate helpers wrapping the if enabled check in the future as it's done for metrics scraping receivers. So I'd suggest keeping it simple for now and writing a bit of boilerplate instead:
if resourceAttributes.CloudAccountID.Enabled {
attr.PutStr(conventions.AttributeCloudAccountID, meta.AccountID)
}
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! I put this method everywhere, it is really much simpler, as sometimes setting these attributes required some further checks and everything was getting so complicated...
802d65f
to
1a149b3
Compare
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.
The approach makes sense to me. I think if you run golangci-lint run --fix
it will fix all the import groups
ca806a2
to
3c9f454
Compare
…nfig structure, add and update unit tests, update CHANGELOG, fix copy-paste issues, add DEPRECATION note to attributes option
8f7453c
to
655ac75
Compare
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
N/A