Skip to content
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] Implement translation of metrics to Datadog format #1178

Merged
merged 5 commits into from
Oct 5, 2020

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented Oct 2, 2020

Description: Add utilities to translate pdata.Metrics into Datadog metrics and obtain a valid hostname.

For the metrics translation we are not relying on OpenCensus helpers as other exporters do based on this Gitter thread. This implies some testing limitations (see Testing section).

The hostname resolution is currently very simple but will be expanded in future PRs.

Link to tracking Issue: n/a

Testing:

I added unit tests to test mapping every metric type; the MapMetrics function can't be tested easily since constructing a pdata.Metrics struct relies on internal opentelemetry-collector packages that can't be imported from the opentelemetry-collector-contrib modules.

I also added a unit test for the hostname resolution.

Documentation: Configuration options and the intended exporter behavior were documented on #1142; this PR adds documentation on each function.

This will be expanded in the future to more closely replicate the
Datadog Agent behavior
@codecov
Copy link

codecov bot commented Oct 2, 2020

Codecov Report

Merging #1178 into master will increase coverage by 13.78%.
The diff coverage is 67.32%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1178       +/-   ##
===========================================
+ Coverage   76.01%   89.79%   +13.78%     
===========================================
  Files          24      285      +261     
  Lines        1163    13873    +12710     
===========================================
+ Hits          884    12457    +11573     
- Misses        226     1047      +821     
- Partials       53      369      +316     
Flag Coverage Δ
#integration 76.09% <ø> (+0.08%) ⬆️
#unit 88.95% <67.32%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
exporter/datadogexporter/host.go 66.66% <66.66%> (ø)
exporter/datadogexporter/metrics_translator.go 67.36% <67.36%> (ø)
receiver/kubeletstatsreceiver/kubelet/pb.go 87.09% <0.00%> (ø)
receiver/collectdreceiver/factory.go 78.26% <0.00%> (ø)
receiver/receivercreator/observerhandler.go 60.37% <0.00%> (ø)
exporter/awsemfexporter/emf_exporter.go 97.53% <0.00%> (ø)
...ermetricsreceiver/awsecscontainermetrics/client.go 94.44% <0.00%> (ø)
...rcedetectionprocessor/internal/gcp/gce/metadata.go 100.00% <0.00%> (ø)
receiver/k8sclusterreceiver/utils/maps.go 100.00% <0.00%> (ø)
processor/k8sprocessor/ip_extractor.go 100.00% <0.00%> (ø)
... and 267 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 450f782...bd2f662. Read the comment docs.

We can add it back if necessary in the future
@mx-psi mx-psi marked this pull request as ready for review October 2, 2020 11:49
@mx-psi mx-psi requested a review from a team October 2, 2020 11:49
Copy link
Contributor

@KSerrania KSerrania left a 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.

@bogdandrutu
Copy link
Member

Please rebase

@mx-psi
Copy link
Member Author

mx-psi commented Oct 3, 2020

@bogdandrutu Done!

@tigrannajaryan tigrannajaryan merged commit 727b1b6 into open-telemetry:master Oct 5, 2020
codeboten pushed a commit that referenced this pull request Nov 23, 2022
#1178)

OTEL_PYTHON_TONADO_TRACED_REQUEST_ATTRS env var can be set to a command
separated list of attributes names that will be extracted from Tornado's
request object and set as attributes on spans.

Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>
codeboten pushed a commit that referenced this pull request Nov 23, 2022
#1178)

OTEL_PYTHON_TONADO_TRACED_REQUEST_ATTRS env var can be set to a command
separated list of attributes names that will be extracted from Tornado's
request object and set as attributes on spans.

Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>
codeboten pushed a commit that referenced this pull request Nov 23, 2022
#1178)

OTEL_PYTHON_TONADO_TRACED_REQUEST_ATTRS env var can be set to a command
separated list of attributes names that will be extracted from Tornado's
request object and set as attributes on spans.

Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>
codeboten pushed a commit that referenced this pull request Nov 23, 2022
#1178)

OTEL_PYTHON_TONADO_TRACED_REQUEST_ATTRS env var can be set to a command
separated list of attributes names that will be extracted from Tornado's
request object and set as attributes on spans.

Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>
codeboten pushed a commit that referenced this pull request Nov 23, 2022
#1178)

OTEL_PYTHON_TONADO_TRACED_REQUEST_ATTRS env var can be set to a command
separated list of attributes names that will be extracted from Tornado's
request object and set as attributes on spans.

Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants