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

[OTel] Only set resource info on root spans #2558

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

PROFeNoM
Copy link
Contributor

@PROFeNoM PROFeNoM commented Mar 6, 2024

Description

This PR removes redundant resource info from being set on all OTel (native or remapped) spans. It fundamentally is a breaking change (since we are removing data from some spans), so if we want to do it, now is the time.

What is Resource Info?
From OTel Doc:

  • environment
  • host information
  • host operating system
  • current process
  • runtime

Why should we remove it?

  • First, a customer would ingest "many" irrelevant bytes.

Here is a sample payload without resources (9 tags)

{
                "trace_id": "65ddafdb0000000007b244ca5366620e",
                "span_id": "805384663926885947",
                "parent_id": "9429929380169505464",
                "start": 1709027293.039369,
                "end": 1709027293.039381,
                "duration": 1.2125e-05,
                "type": "web",
                "service": "customer_app_web_service",
                "name": "laravel.event.handle",
                "resource": "Illuminate\\Foundation\\Http\\Events\\RequestHandled",
                "resource_hash": "5da477cef10a0ff3",
                "host_id": 439449322,
                "hostname": "docker-desktop",
                "env": "prod",
                "host_groups": [
                    "env:prod"
                ],
                "meta": {
                    "ddtags": "ingestion_reason:auto",
                    "component": "laravel",
                    "env": "prod",
                    "language": "php",
                    "_dd.p.ftid": "65ddafdb0000000007b244ca5366620e",
                    "_dd.agent_version": "7.50.3",
                    "_dd.agent_hostname": "docker-desktop",
                    "_dd.tracer_version": "0.98.0"
                },
                "metrics": {
                    "_sampling_priority_v1": 1.0
                },
                "ingestion_reason": "auto",
                "metadata": {
                    "sds_info": []
                },
                "children_ids": []
            }

Same operation with resource info (25 tags)

{
                "trace_id": "65ddafdb0000000007b244ca5366620e",
                "span_id": "12568249948290625744",
                "parent_id": "15313292926888664709",
                "start": 1709027292.995515,
                "end": 1709027292.996892,
                "duration": 0.001376375,
                "type": "web",
                "service": "customer_app_web_service",
                "name": "laravel.event.handle",
                "resource": "Illuminate\\Database\\Events\\QueryExecuted",
                "resource_hash": "c49a35ffdaafe898",
                "host_id": 439449322,
                "hostname": "docker-desktop",
                "env": "prod",
                "host_groups": [
                    "env:prod"
                ],
                "meta": {
                    "process.executable.path": "/usr/local/sbin/php-fpm",
                    "component": "laravel",
                    "_dd.tracer_version": "0.98.0",
                    "host.arch": "aarch64",
                    "_dd.agent_version": "7.50.3",
                    "process.runtime.name": "fpm-fcgi",
                    "os.name": "Linux",
                    "telemetry.distro.version": "1.0.0",
                    "process.owner": "www-data",
                    "os.type": "linux",
                    "telemetry.sdk.language": "php",
                    "os.description": "6.5.11-linuxkit",
                    "telemetry.sdk.name": "opentelemetry",
                    "telemetry.sdk.version": "1.0.8",
                    "language": "php",
                    "ddtags": "ingestion_reason:auto",
                    "process.runtime.version": "8.2.12",
                    "_dd.p.ftid": "65ddafdb0000000007b244ca5366620e",
                    "env": "prod",
                    "os.version": "#1 SMP PREEMPT Wed Dec  6 17:08:31 UTC 2023",
                    "telemetry.distro.name": "opentelemetry-php-instrumentation",
                    "service.version": "1.0.0+no-version-set",
                    "host.name": "61cd348cc3c2",
                    "_dd.agent_hostname": "docker-desktop"
                },
                "metrics": {
                    "_sampling_priority_v1": 1.0,
                    "process.pid": 9859.0
                },
                "ingestion_reason": "auto",
                "metadata": {
                    "sds_info": []
                },
                "children_ids": [
                    "12622166295660867307",
                    "12074790514185832795",
                    "4622667366984769435",
                    "10340755233058322318"
                ]
            }

That's a 178% increase! 🚀

  • Second, this information was already there in the root span. We have no value from having it in the children

  • Some of this same information is already available from other tabs (e.g., Infrastructure or Processes).

  • Finally, it has a performance impact (as shown by the benchmarks) because of the instances and added serialization work needed.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@pr-commenter
Copy link

pr-commenter bot commented Mar 6, 2024

Benchmarks

Benchmark execution time: 2024-03-06 12:10:12

Comparing candidate commit bccb004 in PR branch alex/otel/resource-on-root-span with baseline commit 61382d5 in branch ddtrace-1.0.0.

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

scenario:PDOBench/benchPDOBaseline

  • 🟩 execution_time [-16.151µs; -15.085µs] or [-8.472%; -7.913%]

scenario:PDOBench/benchPDOOverhead

  • 🟩 execution_time [-16.685µs; -14.975µs] or [-5.793%; -5.199%]

scenario:PDOBench/benchPDOOverheadWithDBM

  • 🟩 execution_time [-16.944µs; -14.880µs] or [-5.456%; -4.792%]

scenario:PDOBench/benchPDOOverheadWithDBM-opcache

  • 🟥 execution_time [+15.684µs; +17.495µs] or [+5.014%; +5.593%]

scenario:SpanBench/benchOpenTelemetryAPI

  • 🟩 execution_time [-27.757µs; -23.294µs] or [-8.474%; -7.112%]
  • 🟩 mem_peak [-4.806MB; -4.806MB] or [-12.497%; -12.497%]

scenario:SpanBench/benchOpenTelemetryAPI-opcache

  • 🟩 execution_time [-16.504µs; -10.899µs] or [-6.036%; -3.986%]
  • 🟩 mem_peak [-4.807MB; -4.807MB] or [-13.869%; -13.869%]

scenario:SpanBench/benchOpenTelemetryInteroperability

  • 🟩 execution_time [-673.058µs; -664.682µs] or [-77.777%; -76.809%]
  • 🟩 mem_peak [-18.386MB; -18.386MB] or [-37.697%; -37.697%]

scenario:SpanBench/benchOpenTelemetryInteroperability-opcache

  • 🟩 execution_time [-541.240µs; -533.740µs] or [-74.084%; -73.058%]
  • 🟩 mem_peak [-16.313MB; -16.313MB] or [-37.981%; -37.981%]

@PROFeNoM PROFeNoM marked this pull request as ready for review March 6, 2024 13:22
@PROFeNoM PROFeNoM requested a review from a team as a code owner March 6, 2024 13:22
@PROFeNoM PROFeNoM changed the title [OTel] Only set resource info for root spans [OTel] Only set resource info on root spans Mar 6, 2024
Copy link
Collaborator

@bwoebi bwoebi left a comment

Choose a reason for hiding this comment

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

Let's do that :-)

@PROFeNoM PROFeNoM merged commit 5f65349 into ddtrace-1.0.0 Mar 6, 2024
635 of 637 checks passed
@PROFeNoM PROFeNoM deleted the alex/otel/resource-on-root-span branch March 6, 2024 15:22
@bwoebi bwoebi added this to the 0.100.0 milestone Apr 15, 2024
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.

2 participants