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

Datadog exporter resource behavior and mapping #5386

Merged
merged 30 commits into from
Jul 3, 2024
Merged

Conversation

bnjjj
Copy link
Contributor

@bnjjj bnjjj commented Jun 10, 2024

Datadog exporter resource behavior and mapping (Issue #5282)

Users of the Datadog trace exporter may have noticed that span and resource naming is not as expected.
Unlike other APMs, Datadog expects static span names, and then uses resource mapping to provide additional context.

The default behavior of the Datadog exporter has now been changed to support this and give a better user experience.

telemetry:
  exporters:
    tracing:
      datadog:
        enabled: true
        # Enables resource mapping, previously disabled by default, but now enabled.
        enable_span_mapping: true
        # Enables fixed span names, defaults to true.
        fixed_span_names: true

  instrumentation:
    spans:
      mode: spec_compliant

The following default resource mappings are applied:

OpenTelemetry Span Name Datadog Span Operation Name
request http.route
router http.route
supergraph graphql.operation.name
query_planning graphql.operation.name
subgraph subgraph.name
subgraph_request graphql.operation.name
http_request http.route

You can override the default resource mappings by specifying the resource_mapping configuration:

  exporters:
    tracing:
      datadog:
        enabled: true
        resource_mapping:
          # Use `my.span.attribute` as the resource name for the `router` span
          router: "my.span.attribute"

Fixes #5282


#ROUTER-359
Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Tests added and passing3
    • Unit Tests
    • Integration Tests
    • Manual Tests

Exceptions

Note any exceptions here

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>

This comment has been minimized.

@router-perf
Copy link

router-perf bot commented Jun 10, 2024

CI performance tests

  • step - Basic stress test that steps up the number of users over time
  • reload - Reload test over a long period of time at a constant rate of users
  • step-with-prometheus - A copy of the step test with the Prometheus metrics exporter enabled
  • events_without_dedup_callback - Stress test for events with a lot of users and deduplication DISABLED using callback mode
  • events - Stress test for events with a lot of users and deduplication ENABLED
  • events_without_dedup - Stress test for events with a lot of users and deduplication DISABLED
  • events_big_cap_high_rate_callback - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity using callback mode
  • xlarge-request - Stress test with 10 MB request payload
  • const - Basic stress test that runs with a constant number of users
  • events_big_cap_high_rate - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity
  • step-jemalloc-tuning - Clone of the basic stress test for jemalloc tuning
  • xxlarge-request - Stress test with 100 MB request payload
  • demand-control-uninstrumented - A copy of the step test, but with demand control monitoring enabled
  • no-graphos - Basic stress test, no GraphOS.
  • events_callback - Stress test for events with a lot of users and deduplication ENABLED in callback mode
  • large-request - Stress test with a 1 MB request payload
  • demand-control-instrumented - A copy of the step test, but with demand control monitoring and metrics enabled

@@ -27,6 +27,7 @@ lazy_static! {
static ref SPAN_RESOURCE_NAME_ATTRIBUTE_MAPPING: HashMap<&'static str, &'static str> = {
let mut map = HashMap::new();
map.insert("request", "http.route");
map.insert("router", "http.route");
Copy link

@Samjin Samjin Jun 22, 2024

Choose a reason for hiding this comment

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

I think based on this latest comment, we have to use router as the HTTP and Service entry span for now until if Datadog could auto instrument http span someday. I think this change could go in.

bnjjj added 2 commits June 25, 2024 17:00
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
@bnjjj bnjjj marked this pull request as ready for review June 25, 2024 15:07
@bnjjj bnjjj requested review from a team as code owners June 25, 2024 15:07
@bnjjj
Copy link
Contributor Author

bnjjj commented Jun 25, 2024

@BrynCooke Could you see any issues by doing this ? Like breaking existing tracing for our customers on DD ?

@BrynCooke
Copy link
Contributor

I pushed some WIP code to add configuration and integration tests to show that span mapping is working.

@bnjjj
Copy link
Contributor Author

bnjjj commented Jul 2, 2024

I can't approve it because I opened that PR but LGTM. Thanks for the refactor around consts it's really nice ! We should do this more often!

@BrynCooke BrynCooke changed the title add mapping for the router span Datadog exporter resource behavior and mapping Jul 2, 2024
@BrynCooke BrynCooke merged commit bc0f8a9 into dev Jul 3, 2024
13 of 14 checks passed
@BrynCooke BrynCooke deleted the bnjjj/fix_5282 branch July 3, 2024 07:51
abernix added a commit that referenced this pull request Jul 11, 2024
@abernix abernix mentioned this pull request Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include request span in spec_compliant mode
3 participants