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

all: replace internal/telemetry by internal/newtelemetry #3136

Merged
merged 13 commits into from
Feb 20, 2025

Conversation

eliottness
Copy link
Contributor

@eliottness eliottness commented Jan 31, 2025

What does this PR do?

This PR replace the old telemetry client with the new one. It does, in order:

  • git rm -r internal/telemetry
  • git mv internal/newtelemetry internal/telemetry
  • Apply changes on the parts of the API that changed signicantly:
    • The way to start a new telemetry client is different, no more telemetry.ApplyOps
    • The API for metrics has been changed for better performances
  • Rework the internal/telemetry/telemetrytest package because it was not using github.com/stretchr/testify/mock correctly (like, not at all)
  • Update a literral TON of tests that were using the horrible telemetrytest API

Motivation

Better telemetry and support for telemetry metrics in the customer request hot path.
RFC: https://docs.google.com/document/d/1C3xoTZHQZNQ-Jr1w5mMThIkpHNW_4qKRf-J5CNi7G-k/edit?pli=1&tab=t.0#heading=h.88xvn2cvs9dt

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.

APPSEC-56655

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jan 31, 2025

Datadog Report

Branch report: eliott.bouhana/remove-oldtelemetry
Commit report: f666b02
Test service: dd-trace-go

✅ 0 Failed, 5347 Passed, 72 Skipped, 3m 1.51s Total Time
⌛ 1 Performance Regression

⌛ Performance Regressions vs Default Branch (1)

  • TestTracerCleanStop - gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer 1m 48.03s (+1m 34.96s, +727%) - Details

@eliottness eliottness force-pushed the eliott.bouhana/remove-oldtelemetry branch from bae4771 to 00e7b91 Compare January 31, 2025 14:58
@pr-commenter
Copy link

pr-commenter bot commented Jan 31, 2025

Benchmarks

Benchmark execution time: 2025-02-20 12:45:47

Comparing candidate commit 955e279 in PR branch eliott.bouhana/remove-oldtelemetry with baseline commit 3e85356 in branch main.

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

scenario:BenchmarkOTelApiWithCustomTags/otel_api-24

  • 🟥 allocated_mem [+115 bytes; +124 bytes] or [+2.385%; +2.567%]
  • 🟥 allocations [+2; +2] or [+4.651%; +4.651%]
  • 🟥 execution_time [+343.263ns; +393.537ns] or [+4.742%; +5.437%]

scenario:BenchmarkSetTagMetric-24

  • 🟥 execution_time [+4.460ns; +7.100ns] or [+3.739%; +5.951%]

@eliottness eliottness force-pushed the eliott.bouhana/remove-oldtelemetry branch from 00e7b91 to 3069417 Compare January 31, 2025 15:33
@eliottness eliottness force-pushed the eliott.bouhana/newtelemetry branch from 51286ca to 8bc28bc Compare January 31, 2025 15:56
@eliottness eliottness force-pushed the eliott.bouhana/remove-oldtelemetry branch 6 times, most recently from 91f3955 to b9952a7 Compare February 7, 2025 10:50
@eliottness eliottness force-pushed the eliott.bouhana/remove-oldtelemetry branch from d5012b4 to c5dc1db Compare February 7, 2025 16:27
@eliottness eliottness force-pushed the eliott.bouhana/newtelemetry branch from 96edeb3 to 3dd727b Compare February 7, 2025 16:33
@eliottness eliottness force-pushed the eliott.bouhana/remove-oldtelemetry branch 5 times, most recently from f0a115b to 51d4ce0 Compare February 10, 2025 14:37
@eliottness eliottness marked this pull request as ready for review February 10, 2025 14:39
@eliottness eliottness requested review from a team as code owners February 10, 2025 14:39
@eliottness eliottness force-pushed the eliott.bouhana/remove-oldtelemetry branch 3 times, most recently from 779bc66 to 96bf15a Compare February 10, 2025 17:39
Copy link
Contributor

@nsrip-dd nsrip-dd left a comment

Choose a reason for hiding this comment

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

I'll confess I didn't read most of this too closely, but the profiling bits look reasonable. Thanks for tackling this!

})
log.Debug("internal/httptrace: telemetry.ConfigChange called with cfg: %v:", cfg)
telemetry.RegisterAppConfig("inferred_proxy_services_enabled", cfg.inferredProxyServicesEnabled, telemetry.OriginEnvVar)
log.Debug("internal/httptrace: telemetry.RegisterAppConfig called with cfg: %v", cfg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this log? Debug mode is typically used by customers when troubleshooting some issue, but customers don't even have access to telemetry, so not sure we need it?

Copy link
Contributor Author

@eliottness eliottness Feb 12, 2025

Choose a reason for hiding this comment

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

This would not even be in the diff if not for the sed command I ran that changed it :)
Hopefully I do another PR after this one that fixes mistakes and gaps in our telemetry usage. I can include the removal of this line in this future PR 👍

Copy link
Contributor

@RomainMuller RomainMuller left a comment

Choose a reason for hiding this comment

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

LGTM for stuff under internal/appsec.

Base automatically changed from eliott.bouhana/newtelemetry to main February 19, 2025 11:32
@eliottness eliottness force-pushed the eliott.bouhana/remove-oldtelemetry branch from fc5388a to a293e49 Compare February 19, 2025 13:17
… would not reduce the value of the flushing interval

Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
@eliottness eliottness force-pushed the eliott.bouhana/remove-oldtelemetry branch from a293e49 to f7606d9 Compare February 19, 2025 13:25
@eliottness eliottness enabled auto-merge (squash) February 20, 2025 12:33
@eliottness eliottness merged commit 1dcefe0 into main Feb 20, 2025
193 of 194 checks passed
@eliottness eliottness deleted the eliott.bouhana/remove-oldtelemetry branch February 20, 2025 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants