DataDog / dd-sdk-android

Datadog SDK for Android (Compatible with Kotlin and Java)
Apache License 2.0
146 stars 59 forks source link

RUM-4116 Add the SpanLink support for Otel API implementation #1993

Closed mariusc83 closed 4 months ago

mariusc83 commented 4 months ago

What does this PR do?

The Otel SpanBuilder#addLink API delegates to the DDSpan under the hood and adds an AgentSpanLink to it. In this PR we are adding the links support into our OtelDdSpanToSpanEventMapper by serializing the AgentSpanLink list and adding it as a String/String entry into the SpanEvent.meta map. Example of a serialized span link into the meta section:

_dd.span_links -> "[
    {
        "attributes": {
            "key": "value"
        },
        "flags": 1,
        "span_id": "4ab9b106d00b9366",
        "trace_id": "000000000000000015b5cedc8e96fd32"
    }
]"

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

codecov-commenter commented 4 months ago

Codecov Report

Merging #1993 (f28a8cf) into feature/otel-support (37e2e35) will increase coverage by 0.04%. The diff coverage is 86.11%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## feature/otel-support #1993 +/- ## ======================================================== + Coverage 60.26% 60.29% +0.04% ======================================================== Files 808 808 Lines 30184 30196 +12 Branches 4945 4950 +5 ======================================================== + Hits 18188 18206 +18 - Misses 10772 10775 +3 + Partials 1224 1215 -9 ``` | [Files](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/1993?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [...dog/android/trace/internal/data/OtelTraceWriter.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/1993?src=pr&el=tree&filepath=features%2Fdd-sdk-android-trace%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fandroid%2Ftrace%2Finternal%2Fdata%2FOtelTraceWriter.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZmVhdHVyZXMvZGQtc2RrLWFuZHJvaWQtdHJhY2Uvc3JjL21haW4va290bGluL2NvbS9kYXRhZG9nL2FuZHJvaWQvdHJhY2UvaW50ZXJuYWwvZGF0YS9PdGVsVHJhY2VXcml0ZXIua3Q=) | `88.89% <ø> (+3.70%)` | :arrow_up: | | [...e/src/main/java/com/datadog/trace/core/DDSpan.java](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/1993?src=pr&el=tree&filepath=features%2Fdd-sdk-android-trace%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdatadog%2Ftrace%2Fcore%2FDDSpan.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZmVhdHVyZXMvZGQtc2RrLWFuZHJvaWQtdHJhY2Uvc3JjL21haW4vamF2YS9jb20vZGF0YWRvZy90cmFjZS9jb3JlL0REU3Bhbi5qYXZh) | `55.98% <0.00%> (-0.24%)` | :arrow_down: | | [...ternal/domain/event/OtelDdSpanToSpanEventMapper.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/1993?src=pr&el=tree&filepath=features%2Fdd-sdk-android-trace%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fandroid%2Ftrace%2Finternal%2Fdomain%2Fevent%2FOtelDdSpanToSpanEventMapper.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZmVhdHVyZXMvZGQtc2RrLWFuZHJvaWQtdHJhY2Uvc3JjL21haW4va290bGluL2NvbS9kYXRhZG9nL2FuZHJvaWQvdHJhY2UvaW50ZXJuYWwvZG9tYWluL2V2ZW50L090ZWxEZFNwYW5Ub1NwYW5FdmVudE1hcHBlci5rdA==) | `88.42% <88.57%> (+2.06%)` | :arrow_up: | ... and [29 files with indirect coverage changes](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/1993/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog)