Skip to content

Conversation

@p-datadog
Copy link
Member

@p-datadog p-datadog commented Dec 18, 2025

What does this PR do?

Removes api_version from transports.

There are actually four different meanings of "api version";

  1. The one that this PR is removing. I think this concept dates back to before we had the current API::Map and Endpoint classes, and this is how different endpoints were selected. In master this api version is never passed in explicitly and is always defaulted to nil. As far as I can tell it doesn't do anything.
  2. Telemetry has a parameter called "api version". This is actually sent in the payloads, and is presently set to v2 in telemetry itself as a default. External to telemetry callers never provide a different api version. Given our transport architecture I don't think it would work to change the endpoint by just providing a different version externally to a component like telemetry.
  3. Tracing has a parameter called "api version". I think it's conceptually the same thing as the first type of "api version" and may be the precursor to "api version" being in core component code. This one is in the public API, therefore I retained the transport_options argument in one place and added notes that it's now ignored. The transport code in master already does not use transport_options or the api version provided therein, as far as I can tell.
  4. There are one or two places that refer to our existing endpoints as "api versions". I think this conceptually goes with the first usage again but now "api version" is an Endpoint/Instance(?) object instead of a string, I am very confused what the actual type of value is supposed to be passed in. Luckily as far as I can tell thus parameter is never actually used so it doesn't matter.

Motivation:
Continuing cleanup of transport code

Change log entry
None

Additional Notes:

How to test the change?

Existing CI

@p-datadog p-datadog requested review from a team as code owners December 18, 2025 14:21
@p-datadog p-datadog requested a review from vpellan December 18, 2025 14:21
@github-actions github-actions bot added core Involves Datadog core libraries tracing labels Dec 18, 2025
@p-datadog p-datadog force-pushed the transport-api-version branch from dc4f1d5 to 2353667 Compare December 18, 2025 22:33
@github-actions
Copy link

github-actions bot commented Dec 18, 2025

Typing analysis

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR introduces 5 untyped methods and 4 partially typed methods, and clears 4 untyped methods and 5 partially typed methods.

Untyped methods (+5-4)Introduced:
sig/datadog/core/telemetry/transport/http/telemetry.rbs:23
└── def headers: (request_type: untyped, api_key: untyped) -> untyped
sig/datadog/core/telemetry/transport/http.rbs:6
└── def self?.agentless_telemetry: (agent_settings: untyped, logger: untyped, ?api_key: untyped?, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
sig/datadog/core/telemetry/transport/http.rbs:7
└── def self?.agent_telemetry: (agent_settings: untyped, logger: untyped, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
sig/datadog/di/transport/http.rbs:5
└── def self.diagnostics: (agent_settings: untyped, logger: untyped, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
sig/datadog/di/transport/http.rbs:6
└── def self.input: (agent_settings: untyped, logger: untyped, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
Cleared:
sig/datadog/core/telemetry/transport/http.rbs:6
└── def self?.agentless_telemetry: (agent_settings: untyped, logger: untyped, ?api_key: untyped?, ?api_version: untyped?, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
sig/datadog/core/telemetry/transport/http.rbs:7
└── def self?.agent_telemetry: (agent_settings: untyped, logger: untyped, ?api_version: untyped?, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
sig/datadog/di/transport/http.rbs:5
└── def self.diagnostics: (agent_settings: untyped, logger: untyped, ?api_version: untyped?, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
sig/datadog/di/transport/http.rbs:6
└── def self.input: (agent_settings: untyped, logger: untyped, ?api_version: untyped?, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
Partially typed methods (+4-5)Introduced:
sig/datadog/core/remote/transport/http.rbs:6
└── def self?.root: (agent_settings: untyped, logger: Core::Logger, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
sig/datadog/core/remote/transport/http.rbs:7
└── def self?.v7: (agent_settings: untyped, logger: Core::Logger, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
sig/datadog/core/telemetry/request.rbs:5
└── def self.build_payload: (Event::Base event, int seq_id, ?debug: bool) -> ::Hash[Symbol, untyped]
sig/datadog/core/transport/http.rbs:5
└── def self?.build: (agent_settings: untyped, ?logger: untyped, ?headers: untyped?) { (untyped) -> untyped } -> HTTP::Builder
Cleared:
sig/datadog/core/remote/transport/http.rbs:6
└── def self?.root: (agent_settings: untyped, logger: Core::Logger, ?api_version: untyped?, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
sig/datadog/core/remote/transport/http.rbs:7
└── def self?.v7: (agent_settings: untyped, logger: Core::Logger, ?api_version: untyped?, ?headers: untyped?) ?{ (untyped) -> untyped } -> untyped
sig/datadog/core/telemetry/request.rbs:5
└── def self.build_payload: (Event::Base event, int seq_id, ?api_version: String, ?debug: bool) -> ::Hash[Symbol, untyped]
sig/datadog/core/telemetry/transport/http/telemetry.rbs:23
└── def headers: (request_type: untyped, api_key: untyped, ?api_version: ::String) -> untyped
sig/datadog/core/transport/http.rbs:5
└── def self?.build: (agent_settings: untyped, ?logger: untyped, ?api_version: untyped?, ?headers: untyped?) { (untyped) -> untyped } -> HTTP::Builder

If you believe a method or an attribute is rightfully untyped or partially typed, you can add # untyped:accept to the end of the line to remove it from the stats.

@datadog-datadog-prod-us1
Copy link
Contributor

datadog-datadog-prod-us1 bot commented Dec 18, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 94.23%
Overall Coverage: 95.22% (+0.01%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d9cb568 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@pr-commenter
Copy link

pr-commenter bot commented Dec 18, 2025

Benchmarks

Benchmark execution time: 2025-12-31 18:05:45

Comparing candidate commit 78855c2 in PR branch transport-api-version with baseline commit 1efce15 in branch master.

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

scenario:profiling - hold / resume

  • 🟥 throughput [-134859.389op/s; -131641.926op/s] or [-7.808%; -7.621%]

Copy link
Contributor

@vpellan vpellan left a comment

Choose a reason for hiding this comment

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

LGTM

@p-datadog
Copy link
Member Author

Following up on discussion with @marco I have done a manual test passing headers via transport_options and this seems to work in master, despite having no test coverage in our library:

as=Datadog::Core::Configuration::AgentSettingsResolver.call(Datadog.configuration)
writer=Datadog::Tracing::Writer.new(agent_settings:as,transport_options:{headers:{foo: 'bar'}})
writer.transport
#<Datadog::Tracing::Transport::Traces::Transport:0x00007afc1b36b1d0
 @apis=
  {"v0.4"=>
    #<Datadog::Core::Transport::HTTP::API::Instance:0x00007afc1bd2a7e8
     @adapter=
      #<Datadog::Core::Transport::HTTP::Adapters::Net:0x00007afc1b36b310
       @hostname="127.0.0.1",
       @port=8126,
       @ssl=false,
       @timeout=30>,
     @endpoint=
      #<Datadog::Tracing::Transport::HTTP::Traces::API::Endpoint:0x00007afc1b36b2c0
       @encoder=Datadog::Core::Encoding::MsgpackEncoder,
       @path="/v0.4/traces",
       @service_rates=true,
       @verb=:post>,
     @headers=
      {"Datadog-Client-Computed-Top-Level"=>"1",
       "Datadog-Meta-Lang"=>"ruby",
       "Datadog-Meta-Lang-Version"=>"3.3.4",
       "Datadog-Meta-Lang-Interpreter"=>"ruby-x86_64-linux",
       "Datadog-Meta-Lang-Interpreter-Vendor"=>"ruby",
       "Datadog-Meta-Tracer-Version"=>"2.24.0",
       :foo=>"bar"}>,
   "v0.3"=>
    #<Datadog::Core::Transport::HTTP::API::Instance:0x00007afc1bd2a798
     @adapter=
      #<Datadog::Core::Transport::HTTP::Adapters::Net:0x00007afc1b36b310
       @hostname="127.0.0.1",
       @port=8126,
       @ssl=false,
       @timeout=30>,
     @endpoint=
      #<Datadog::Tracing::Transport::HTTP::Traces::API::Endpoint:0x00007afc1b36b220
       @encoder=Datadog::Core::Encoding::MsgpackEncoder,
:

I will reinstate transport_options and add a test passing headers through it.

@p-datadog
Copy link
Member Author

We identified https://github.com/DataDog/datadog-lambda-rb/blob/main/lib/datadog/lambda.rb as a consumer of our tracing Writer classes. This consumer does not pass transport_options at all and should thus not be affected by the changes in this PR.

@p-datadog p-datadog merged commit e5573b6 into master Jan 5, 2026
637 checks passed
@p-datadog p-datadog deleted the transport-api-version branch January 5, 2026 19:23
@github-actions github-actions bot added this to the 2.24.0 milestone Jan 5, 2026
p-datadog pushed a commit that referenced this pull request Jan 5, 2026
* master: (129 commits)
  Transports: remove api_version (#5164)
  DEBUG-4548 Telemetry: send events in forked children + telemetry metrics reset after fork (#5159)
  Ignore "leaked" pipe file descriptors in JRuby, improve diagnostics  (#5188)
  debug-4548 Increase number of iterations for flakiness (#5184)
  [🤖] Update System Tests: https://github.com/DataDog/dd-trace-rb/actions/runs/20684824141
  [🤖] Update System Tests: https://github.com/DataDog/dd-trace-rb/actions/runs/20616292456 (#5190)
  downgrade ffi for ruby 4.0 & 2.5 (#5189)
  Fix ruby warnings when accessing undefined instance variables (#5178)
  DEBUG-3499 DI: fix accounting when intrumenting upon class definition, add instr… (#5168)
  DEBUG-3499 RC: add diagnostics for invalid values (#5167)
  DEBUG-4548 Core: fix worker shutdown race  (#5176)
  Retry system-test build (#5181)
  Fix Baggage type check (#5182)
  [🤖] Update System Tests: https://github.com/DataDog/dd-trace-rb/actions/runs/20487829791 (#5183)
  [🤖] Update Latest Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/20401889084 (#5180)
  DEBUG-3499 DI: do not instrument when there is already an installed probe with the same id (#5169)
  DEBUG-3499 DI: rework RC interface (#5165)
  set DI test duration upper bound to 1000 seconds (#5161)
  add missing supported config default value
  [🤖] Update System Tests: https://github.com/DataDog/dd-trace-rb/actions/runs/20401907816 (#5179)
  ...
p-datadog pushed a commit that referenced this pull request Jan 5, 2026
* master:
  Transports: remove api_version (#5164)
  DEBUG-4548 Telemetry: send events in forked children + telemetry metrics reset after fork (#5159)
  Ignore "leaked" pipe file descriptors in JRuby, improve diagnostics  (#5188)
  debug-4548 Increase number of iterations for flakiness (#5184)
  [🤖] Update System Tests: https://github.com/DataDog/dd-trace-rb/actions/runs/20684824141
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Involves Datadog core libraries tracing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants