-
Notifications
You must be signed in to change notification settings - Fork 2.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
[datadogexporter] Use resource attributes for metadata and generated metrics #2023
[datadogexporter] Use resource attributes for metadata and generated metrics #2023
Conversation
Running metrics can be duplicate in this setup but this is fine since they are gauges.
If enabled (it is by default) the resource attributes from the first payload from either metrics or traces will be used to populate host metadata. If there are fields missing these will be filled in by the exporter (this preserves behavior when not using k8s_tagger/resourcedetection).
Codecov Report
@@ Coverage Diff @@
## main #2023 +/- ##
==========================================
+ Coverage 90.52% 90.68% +0.15%
==========================================
Files 397 398 +1
Lines 19689 19757 +68
==========================================
+ Hits 17824 17917 +93
+ Misses 1405 1380 -25
Partials 460 460
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
var defaultPrefixes = [3]string{"ip-", "domu", "ec2amaz-"} | ||
var ( | ||
defaultPrefixes = [3]string{"ip-", "domu", "ec2amaz-"} | ||
ec2TagPrefix = "ec2.tag." |
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.
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 code change looks good to me overall, I left some questions & notes about tests
metrics := ilm.Metrics() | ||
for k := 0; k < metrics.Len(); k++ { | ||
md := metrics.At(k) | ||
metricsArray := ilm.Metrics() |
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.
Note: these codecov warnings are due to the lack of unit tests for mapMetrics
, they'll be fixed in another PR
This avoids clashes with the Datadog Agent
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.
Approving on behalf of Datadog.
Marking as ready for review; it was approved by someone from Datadog. Note that CodeCov warnings due to lack of tests for |
…metrics (#2023) * Set hostname to running metrics from resource attributes if available Running metrics can be duplicate in this setup but this is fine since they are gauges. * Use resource metadata to complet host metadata If enabled (it is by default) the resource attributes from the first payload from either metrics or traces will be used to populate host metadata. If there are fields missing these will be filled in by the exporter (this preserves behavior when not using k8s_tagger/resourcedetection). * Add tests for new metadata behavior * Fix go lint * Remove unnecessary log messages * Improve GCP info from attributes Most logic is taken from here: https://github.com/DataDog/datadog-agent/blob/491c309e374ed5c7f1b385b347d5f9b5ac72c2b6/pkg/util/gce/gce_tags.go#L71-L101 * Use "system" host tags for EC2 tags This is what the Datadog Agent does https://github.com/DataDog/datadog-agent/blob/491c309e374ed5c7f1b385b347d5f9b5ac72c2b6/pkg/metadata/host/host_tags.go#L97-L139 * Add additional test for GCP hostname from attributes * Add test for metadata.Pusher function * Improve test coverage * Set EC2 tags in OTel field instead of System field This avoids clashes with the Datadog Agent
…rnal/tools (#2023) * Bump github.com/golangci/golangci-lint in /internal/tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.40.1 to 1.41.1. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](golangci/golangci-lint@v1.40.1...v1.41.1) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aneurysm9 <Aneurysm9@users.noreply.github.com>
Description:
Link to tracking Issue: Relates to #1379
Testing: Added unit tests. Tested in e2e environment.
datadog.host.name
to something likemy-custom-hostname
my-custom-hostname
Testing in AWS and GCP should bring a subset of the information that the Datadog Agent provides on its latest version (7.25)
Documentation: Documented new flag