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

Draft
wants to merge 9 commits into
base: eliott.bouhana/newtelemetry
Choose a base branch
from

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.

Unsure? Have a question? Request a review!

@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: 51acfaa
Test service: dd-trace-go

❌ 8 Failed (0 Known Flaky), 3814 Passed, 72 Skipped, 2m 34.96s Total Time

❌ Failed Tests (8)

This report shows up to 5 failed tests.

  • TestIntegrationInfo - gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/telemetrytest - Details

    Expand for error
     Failed
     
     === RUN   TestIntegrationInfo
     panic: 
     assert: mock: I don't know what to return because the method call was unexpected.
     	Either do Mock.On("Flush").Return(...) first, or remove the Flush() call.
     	This method was unexpected:
     		Flush()
     		
     	at: [/home/runner/work/dd-trace-go/dd-trace-go/internal/telemetry/telemetrytest/mock.go:82 /home/runner/work/dd-trace-go/dd-trace-go/internal/telemetry/globalclient.go:50 /opt/hostedtoolcache/go/1.22.11/x64/src/runtime/asm_amd64.s:1695]
     ...
    
  • TestAssessSource - gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer - Details

    Expand for error
     Failed
     
     === RUN   TestAssessSource
     --- FAIL: TestAssessSource (0.00s)
    
  • TestAssessSource/invalid-ot - gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer - Details

    Expand for error
     Failed
     
     === RUN   TestAssessSource/invalid-ot
         otel_dd_mappings_test.go:52: 
             	Error Trace:	/home/runner/work/dd-trace-go/dd-trace-go/ddtrace/tracer/otel_dd_mappings_test.go:52
             	Error:      	Should not be zero, but was 0
             	Test:       	TestAssessSource/invalid-ot
         --- FAIL: TestAssessSource/invalid-ot (0.00s)
    
  • TestOnRemoteConfigUpdate - gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer - Details

    Expand for error
     Failed
     
     === RUN   TestOnRemoteConfigUpdate
     --- FAIL: TestOnRemoteConfigUpdate (0.00s)
    
  • TestOnRemoteConfigUpdate/RC_sampling_rate_=_0.5_is_applied_and_can_be_reverted - gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer - Details

    Expand for error
     Failed
     
     === RUN   TestOnRemoteConfigUpdate/RC_sampling_rate_=_0.5_is_applied_and_can_be_reverted
         --- FAIL: TestOnRemoteConfigUpdate/RC_sampling_rate_=_0.5_is_applied_and_can_be_reverted (0.00s)
     panic: 
     assert: mock: I don't know what to return because the method call was unexpected.
     	Either do Mock.On("Count").Return(...) first, or remove the Count() call.
     	This method was unexpected:
     		Count(transport.Namespace,string,[]string)
     		0: "civisibility"
     ...
    

@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-01-31 16:52:48

Comparing candidate commit 9992be0 in PR branch eliott.bouhana/remove-oldtelemetry with baseline commit 681eae1 in branch eliott.bouhana/newtelemetry.

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

scenario:BenchmarkOTelApiWithCustomTags/otel_api-24

  • 🟥 allocated_mem [+379 bytes; +390 bytes] or [+7.827%; +8.051%]
  • 🟥 allocations [+6; +6] or [+13.953%; +13.953%]
  • 🟥 execution_time [+249.607ns; +293.593ns] or [+3.438%; +4.044%]

scenario:BenchmarkSetTagString-24

  • 🟥 execution_time [+3.531ns; +5.169ns] or [+3.143%; +4.601%]

scenario:BenchmarkTracerAddSpans-24

  • 🟥 execution_time [+130.422ns; +159.578ns] or [+3.390%; +4.148%]

@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 2 times, most recently from 52c4ea2 to aa3b6e0 Compare January 31, 2025 16:17
@eliottness eliottness force-pushed the eliott.bouhana/remove-oldtelemetry branch from aa3b6e0 to 9992be0 Compare January 31, 2025 16:26
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.

1 participant