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

ddtrace/tracer: initialize runtimeMetricsV2 with statsd "direct" client #3006

Merged
merged 8 commits into from
Dec 12, 2024

Conversation

anatolebeuzon
Copy link
Contributor

@anatolebeuzon anatolebeuzon commented Dec 4, 2024

What does this PR do?

It initializes runtimeMetricsV2 with the "direct" client, which provides the DistributionSamples() method (in addition to all the usual statsd.Client methods).

Motivation

See DataDog/go-runtime-metrics-internal#8.

The Go runtime/metrics package maintains histograms, and we want to submit those to the Datadog API as distributions for best UX. We can roughly do so by submitting the midpoint of each bucket from the Go histogram, with a weight corresponding to the number of items in the bucket.

If we were to use the Distribution() method of the regular client, we would have to call it in a loop for the same bucket midpoint, which would be extremely wasteful for buckets containing large number of items. Instead, the DistributionSamples() method allow us to rig the rate in order to achieve the same result, while sending only one point per bucket.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.
  • For internal contributors, a matching PR should be created to the v2-dev branch and reviewed by @DataDog/apm-go.

Unsure? Have a question? Request a review!

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Dec 4, 2024

Datadog Report

Branch report: anatoleb/runtime-metrics-use-direct-client
Commit report: 24bd25a
Test service: dd-trace-go

✅ 0 Failed, 5110 Passed, 67 Skipped, 2m 27.59s Total Time

@anatolebeuzon anatolebeuzon force-pushed the anatoleb/runtime-metrics-use-direct-client branch from 818069b to f1ef6cb Compare December 4, 2024 16:43
@anatolebeuzon anatolebeuzon force-pushed the anatoleb/runtime-metrics-use-direct-client branch from f1ef6cb to f7fdf31 Compare December 4, 2024 16:45
@github-actions github-actions bot added the apm:ecosystem contrib/* related feature requests or bugs label Dec 4, 2024
@anatolebeuzon anatolebeuzon force-pushed the anatoleb/runtime-metrics-use-direct-client branch from 3bc6106 to 9beb947 Compare December 4, 2024 16:53
@anatolebeuzon anatolebeuzon marked this pull request as ready for review December 4, 2024 16:53
@anatolebeuzon anatolebeuzon requested review from a team as code owners December 4, 2024 16:53
@pr-commenter
Copy link

pr-commenter bot commented Dec 4, 2024

Benchmarks

Benchmark execution time: 2024-12-12 14:48:32

Comparing candidate commit 71757de in PR branch anatoleb/runtime-metrics-use-direct-client with baseline commit 14e38da in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 58 metrics, 1 unstable metrics.

@darccio
Copy link
Member

darccio commented Dec 5, 2024

@DataDog/data-streams-monitoring @DataDog/apm-idm-go Can you review this, please?

@Gandem Gandem force-pushed the anatoleb/runtime-metrics-use-direct-client branch from 92c0d51 to 71757de Compare December 12, 2024 14:05
Copy link
Contributor

@rarguelloF rarguelloF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for the contrib/* changes

@felixge felixge enabled auto-merge (squash) December 12, 2024 18:59
@felixge felixge merged commit 6004a6c into main Dec 12, 2024
181 of 182 checks passed
@felixge felixge deleted the anatoleb/runtime-metrics-use-direct-client branch December 12, 2024 19:05
e-n-0 added a commit that referenced this pull request Dec 23, 2024
ddtrace/tracer: initialize runtimeMetricsV2 with statsd "direct" client (#3006)

Co-authored-by: Felix Geisendörfer <[email protected]>
Co-authored-by: Nayef Ghattas <[email protected]>

fix(.github/workflows): add tags-ignore to avoid running CI on pushing tags for contribs and other nested modules (#3005)

Co-authored-by: Hannah Kim <[email protected]>

contrib/envoyproxy: envoy external processing support (#2895)

This PR adds a new gRPC Interceptor (StreamServerInterceptor) to support the interception of ext_proc v3 calls to gRPC server. When the interceptor is applied, all messages of the external processing protocol are instrumented without returning an handle to the original server code

Co-authored-by: Eliott Bouhana <[email protected]>
Co-authored-by: Flavien Darche <[email protected]>

add go mod to workflows/apps (#3036)

go.mod: module go.opentelemetry.io/collector/pdata@latest found (v1.21.0), but does not contain package go.opentelemetry.io/collector/pdata/internal/data/protogen/profiles/v1experimental (#3042)

Signed-off-by: Eliott Bouhana <[email protected]>

chore: update latest majors (#2993)
e-n-0 added a commit that referenced this pull request Dec 23, 2024
ddtrace/tracer: initialize runtimeMetricsV2 with statsd "direct" client (#3006)

Co-authored-by: Felix Geisendörfer <[email protected]>
Co-authored-by: Nayef Ghattas <[email protected]>

fix(.github/workflows): add tags-ignore to avoid running CI on pushing tags for contribs and other nested modules (#3005)

Co-authored-by: Hannah Kim <[email protected]>

contrib/envoyproxy: envoy external processing support (#2895)

This PR adds a new gRPC Interceptor (StreamServerInterceptor) to support the interception of ext_proc v3 calls to gRPC server. When the interceptor is applied, all messages of the external processing protocol are instrumented without returning an handle to the original server code

Co-authored-by: Eliott Bouhana <[email protected]>
Co-authored-by: Flavien Darche <[email protected]>

add go mod to workflows/apps (#3036)

go.mod: module go.opentelemetry.io/collector/pdata@latest found (v1.21.0), but does not contain package go.opentelemetry.io/collector/pdata/internal/data/protogen/profiles/v1experimental (#3042)

Signed-off-by: Eliott Bouhana <[email protected]>

chore: update latest majors (#2993)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:ecosystem contrib/* related feature requests or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants