Skip to content

Conversation

@p-datadog
Copy link
Member

@p-datadog p-datadog commented Nov 19, 2025

What does this PR do?
Injects component tree into telemetry AppStarted event constructor, instead of various methods of the event referencing various global variables.

Motivation:
Make telemetry code easier to read/reason about for the upcoming change to enable telemetry in child processes

Change log entry
None

Additional Notes:
The event does not hold a reference to the component tree - the tree is used only while constructor is running to build the various payloads that will be sent out later.

The unit tests now perform many references to Datadog.send(:components) which looks odd (unit tests reference global state) but this was existing behavior - telemetry was reading global state including in unit tests.

How to test the change?
Existing CI

@github-actions github-actions bot added core Involves Datadog core libraries profiling Involves Datadog profiling labels Nov 19, 2025
@github-actions
Copy link

github-actions bot commented Nov 19, 2025

Thank you for updating Change log entry section 👏

Visited at: 2025-11-19 17:20:24 UTC

@pr-commenter
Copy link

pr-commenter bot commented Nov 19, 2025

Benchmarks

Benchmark execution time: 2025-11-19 20:03:27

Comparing candidate commit adb655a in PR branch telemetry-inject-deps with baseline commit 276464a in branch master.

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

scenario:profiling - Allocations ()

  • 🟩 throughput [+490864.193op/s; +502640.319op/s] or [+17.312%; +17.727%]

@github-actions
Copy link

github-actions bot commented Nov 19, 2025

Typing analysis

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR introduces 5 partially typed methods, and clears 4 partially typed methods. It decreases the percentage of typed methods from 54.67% to 54.64% (-0.03%).

Partially typed methods (+5-4)Introduced:
sig/datadog/core/telemetry/event/app_started.rbs:10
└── def payload: () -> { products: untyped, configuration: untyped, install_signature: untyped }
sig/datadog/core/telemetry/event/app_started.rbs:17
└── def configuration: (untyped settings, Core::Configuration::AgentSettings agent_settings) -> Array[Hash[Symbol, untyped]]
sig/datadog/core/telemetry/event/app_started.rbs:21
└── def conf_value: (String name, untyped value, Integer seq_id, String origin) -> Hash[Symbol, untyped]
sig/datadog/core/telemetry/event/app_started.rbs:25
└── def install_signature: (untyped settings) -> Hash[Symbol, Object]
sig/datadog/core/telemetry/event/app_started.rbs:27
└── def get_telemetry_origin: (untyped settings, String config_path) -> String
Cleared:
sig/datadog/core/telemetry/event/app_started.rbs:12
└── def payload: () -> { products: untyped, configuration: untyped, install_signature: untyped }
sig/datadog/core/telemetry/event/app_started.rbs:19
└── def configuration: -> Array[Hash[Symbol, untyped]]
sig/datadog/core/telemetry/event/app_started.rbs:23
└── def conf_value: (String name, untyped value, Integer seq_id, String origin) -> Hash[Symbol, untyped]
sig/datadog/core/telemetry/event/app_started.rbs:29
└── def get_telemetry_origin: (untyped config, String config_path) -> String

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.

@p-datadog p-datadog marked this pull request as ready for review November 19, 2025 17:36
@p-datadog p-datadog requested review from a team as code owners November 19, 2025 17:36
@datadog-official
Copy link

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 103.77%
Total Coverage: 98.50%

View detailed report

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

Copy link
Member

@Strech Strech left a comment

Choose a reason for hiding this comment

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

Not sure, maybe it's hard to do a components part in the tests, but I'm not sure that I like the use of Datadog.send(:components) because there is no trace of what's inside.

But this is not a blocker.

@p-datadog
Copy link
Member Author

Agree, all of the references to the component tree are not great. I haven't looked deeply into what it would take to eliminate them -my thinking is it might be tricky because telemetry is pretty much collecting the state of everything else in dd-trace-rb, thus either the test becomes extremely mocky or we have to construct a lot of variables in the tests.

@p-datadog p-datadog merged commit 651c3ba into master Nov 20, 2025
553 of 554 checks passed
@p-datadog p-datadog deleted the telemetry-inject-deps branch November 20, 2025 17:55
@github-actions github-actions bot added this to the 2.23.0 milestone Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Involves Datadog core libraries profiling Involves Datadog profiling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants