Skip to content

Obfuscate ids with commas and obfuscate WCF requests#3026

Merged
bouwkast merged 18 commits into
masterfrom
steven/obfuscate-wcf-resources
Sep 1, 2022
Merged

Obfuscate ids with commas and obfuscate WCF requests#3026
bouwkast merged 18 commits into
masterfrom
steven/obfuscate-wcf-resources

Conversation

@bouwkast

@bouwkast bouwkast commented Jul 29, 2022

Copy link
Copy Markdown
Collaborator

Summary of changes

Obfuscate ids that contain , (123,123) in the same way that normal integer ids are obfuscated. Additionally, adds obfuscation to the WcfCommon.cs for its LocalPath into the resourceName. The Action for WCF is now also checked in cases where it is an empty string and if so the LocalPath is used instead.

Reason for change

IDs that contained commas weren't being obfuscated and we weren't doing any obfuscation at all for the WCF integration.

Implementation details

  • Added a , case within UriHelpers.IsIdentifierSegment to treat integer ids with commas as a valid identifier
  • Clean WCF LocalPath with UriHelpers.GetCleanUriPath within WcfCommon.cs - swapping to the cleaned URI seemed to change the resourceName a decent bit (e.g. would have host/port in it where before it wouldn't)

Test coverage

  • Added unit tests to check for and validate that 123,123 is properly obfuscated now.
  • Added an integration test for empty strings in Action
  • Modified WCF namespace in sample to test obfuscation (when Action is empty string as well)

Other details

AIT-1995

Questions:

  • Now that we have ASM, do we need to tie that into this WCF obfuscation somehow?
  • Would replacing 123,123 with ? be a breaking change for customers?

@bouwkast

Copy link
Copy Markdown
Collaborator Author

Note: Still working on updating the integration/end-to-end tests for WcfTests.cs - there doesn't appear to be any tests for obfuscating resources

@bouwkast bouwkast changed the title Steven/obfuscate wcf resources Obfuscate ids with commas and obfuscate WCF requests Jul 29, 2022
@bouwkast bouwkast added area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) labels Jul 29, 2022
Comment thread tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/Wcf/WcfCommon.cs Outdated
@zacharycmontoya

zacharycmontoya commented Jul 29, 2022

Copy link
Copy Markdown
Contributor

Questions:

  • Now that we have ASM, do we need to tie that into this WCF obfuscation somehow?

Thinking on this more, I think this PR and the ASM obfuscation can be handled separately. The obfuscation we want to achieve in this PR affects the resourceName whereas the ASM changes would affect the http.url tag.

  • Would replacing 123,123 with ? be a breaking change for customers?

That's a good question and yeah it definitely is 😬 In this case, we have only seen one complaint about the , causing issues for a customer so I get the feeling this won't affect many users. This is a really good question so thanks for raising, because we have to be extremely careful when we either 1) Change public API or 2) Change existing data. Users can configure all sorts of monitors, dashboards, alerts, etc. based on tag data so that can be extremely disruptive if we don't handle the migration well.

Sometimes we will add an opt-in feature flag and then over time make it opt-out during a new major version release. However, this seems like a bug fix so I'd advocate for making this the default behavior and, if needed, we could create an opt-out flag

Comment thread tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/Wcf/WcfCommon.cs Outdated
Comment thread tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/Wcf/WcfCommon.cs Outdated
@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@bouwkast
bouwkast force-pushed the steven/obfuscate-wcf-resources branch from 30f4423 to eb39869 Compare August 4, 2022 13:30
@bouwkast

bouwkast commented Aug 4, 2022

Copy link
Copy Markdown
Collaborator Author

Note: Still working on updating the integration/end-to-end tests for WcfTests.cs - there doesn't appear to be any tests for obfuscating resources

I've updated the namespace that was being used in the sample to include 123,123 to test out the obfuscation (when Action is empty). Feels a bit hacky maybe?

@bouwkast
bouwkast marked this pull request as ready for review August 4, 2022 13:38
@bouwkast
bouwkast requested a review from a team as a code owner August 4, 2022 13:38
}

continue;
case ',':

@pierotibou pierotibou Aug 4, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we can't have hexa with commas right? in which case we should return false if we have a letter and a segment > 16?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if I follow
Are you asking if hex segments: > 16 characters, that contains at least one letter and one comma that we shouldn't obfuscate it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm saying that I've never seen a 123af,12a for an hexa value. So if I'm right, then in the case where we find a letter and a comma, then it's not an id. So we should not obfuscate it.
Also, what about points? Should we add them here?
(Maybe that's a good time to go and look at what others tracers have done to see if we are close as well.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe that's a good time to go and look at what others tracers have done to see if we are close as well

I need to do that as part of the RFC on obfuscating outgoing Http requests too, so would be good to document them all!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm saying that I've never seen a 123af,12a for an hexa value. So if I'm right, then in the case where we find a letter and a comma, then it's not an id. So we should not obfuscate it.

Okay that makes sense.

So "123af,12a" currently doesn't get obfuscated because the segmentLength is less than 16, but you'd also expect that to still return false if the segmentLength is greater than 16 because it is no longer an "id".
Something like "123afafafafaf,12a" does get obfuscated with ? currently, but ideally it wouldn't. Should be able to add a check for that

I will go through the other tracers and see if I can see what they do and will document along the way :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I need to do that as part of the RFC on obfuscating outgoing Http requests too, so would be good to document them all!

:itsatrap: :p

Something like "123afafafafaf,12a" does get obfuscated with ? currently, but ideally it wouldn't. Should be able to add a check for that

I assume yes.

I will go through the other tracers and see if I can see what they do and will document along the way :)

Thanks a lot. Don't hesitate to ask for pointers in #apm-integrations. Also, you can use codesearch, but that doesn't prevent you to ask to others if the search isn't obvious


span.DecorateWebServerSpan(
resourceName: action ?? requestHeadersTo?.LocalPath,
resourceName: string.IsNullOrEmpty(action) ? UriHelpers.GetCleanUriPath(requestHeadersTo?.LocalPath) : action,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe add a feature flag (enabled by default) and do the obfuscation only when it is set. That will give the users a way to rollback if needed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That sounds like a good idea, I was wondering whether or not if this would be too much of a behavioral breaking change.

Follow up question for this, how exactly are feature flags implemented? Is that in ConfigurationKeys and the FeatureFlags class or elsewhere?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follow up question for this, how exactly are feature flags implemented? Is that in ConfigurationKeys and the FeatureFlags class or elsewhere?

Yes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is that in ConfigurationKeys and the FeatureFlags class or elsewhere

That's the one, and then you need to add a setting to TracerSettings and ImmutableTracerSettings to flow it through. I would be inclined to call it something like DD_TRACE_WCF_RESOURCE_OBFUSCATION_ENABLED, default it true, so they can disable it if it causes issues.

Please also record the value of that flag in the tracer start up log + telemetry too, so we can track when/if people need to disable it 🙂

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Okay I think I got the feature flag added, start up log, and telemetry as well:

Feature Flag: c6594cc
Start up log: bec2bfd
Telemetry: 0ffe3e8

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, nice work 👍

Comment on lines +7 to +12
/// <summary>
/// Note: after updating this interface you'll need to re-generate the proxy class <see cref="CalculatorClient"/>.
/// That can be done in a developer VS prompt (when the WCF server is running):
/// <code>svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8585/WcfSample/</code>
/// This makes a new file <c>generatedProxy.cs</c> and the contents of this can be swapped out with <see cref="CalculatorClient"/>.
/// </summary>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, thanks for adding this 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for adding this, if we ever need to update this again this will be extremely helpful 🙏🏼

SpanId: Id_2,
Name: wcf.request,
Resource: WcfSample/ICalculator/ServerSyncAdd,
Resource: /WcfSample/?/CalculatorService,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just so I understand, this one has the URL rather than a useful name because it's the one with Action="" right? I wonder if we should strip the leading / from the URL, just so it looks similar to the ones with an action? Or maybe it's better that it's different, so it can't be confused for the others? 🤔 Open to discussion!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Correct. For the Action="" it falls back to using the LocalPath for the resource name (also I couldn't figure out how to get Action to be null without the server throwing).

Making them look similar would make sense to me - since we do lose the "useful" name maybe it's better to not though? If anyone asks why they aren't getting the Action in the resource name and they have that leading / we know that the Action was actually empty or null and they were falling back to the URL form? :)

I didn't think anything of that leading / so I'd be fine either stripping it out or leaving it in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would prefer keeping the leading / to help differentiate between an action and a path. For aspnet.request spans we do something similar for the resource names, where we give it a pattern <HTTP_METHOD> <PATH> where path has a leading /, so this would be consistent

@zacharycmontoya zacharycmontoya Aug 5, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: One thing you could do to make the diff in the snapshots a little clearer is add the new test case to the end so the bulk of the changes are in the last span in the file, but definitely not a requirement Scratch that, that would just move the problem down a few lines. Nevermind!


span.DecorateWebServerSpan(
resourceName: action ?? requestHeadersTo?.LocalPath,
resourceName: string.IsNullOrEmpty(action) ? UriHelpers.GetCleanUriPath(requestHeadersTo?.LocalPath) : action,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is that in ConfigurationKeys and the FeatureFlags class or elsewhere

That's the one, and then you need to add a setting to TracerSettings and ImmutableTracerSettings to flow it through. I would be inclined to call it something like DD_TRACE_WCF_RESOURCE_OBFUSCATION_ENABLED, default it true, so they can disable it if it causes issues.

Please also record the value of that flag in the tracer start up log + telemetry too, so we can track when/if people need to disable it 🙂

@zacharycmontoya zacharycmontoya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, this should be ready to go once the feature flag is added

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@zacharycmontoya zacharycmontoya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, nice work!

@bouwkast
bouwkast force-pushed the steven/obfuscate-wcf-resources branch from ac3102c to 3dfd78d Compare August 23, 2022 15:25
@github-actions

This comment has been minimized.

@andrewlock

This comment has been minimized.

This would replace "123,123" with "?".
Previously, nothing would be replaced.
If an OperationContract attribute is defined with an empty string ("")
Action we'll use that empty string as the `resourceName`. So check for
that and swap to use the LocalPath instead.
Previously we were using the non-obfuscated LocalPath of the URI,
instead we can use the cleaned and obfuscated AbsolutePath of the URI.
Using and cleaning the whole URI instead of just the LocalPath was
causing the actual content in the `resourceName` to be different than
what it was previously.
Now when the Action is an empty string it'll fall back to the LocalPath
and should properly obfuscate away the "123,123" with a "?" in the
resourceName.
@bouwkast
bouwkast force-pushed the steven/obfuscate-wcf-resources branch from 0721ebc to fce893b Compare September 1, 2022 15:19
@github-actions

github-actions Bot commented Sep 1, 2022

Copy link
Copy Markdown
Contributor

Snapshots difference summary

The following differences have been observed in snapshots. So diff is simplistic, so please check some files anyway while we improve it.

4 occurrences of :

+  {
+    TraceId: Id_1,
+    SpanId: Id_2,
+    Name: wcf.request,
+    Resource: /WcfSample/123,123/CalculatorService,
+    Service: Samples.Wcf,
+    Type: web,
+    ParentId: Id_3,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.method: POST,
+      http.request.headers.host: localhost:00000,
+      http.url: http://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_4,
+    SpanId: Id_5,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerSyncAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    ParentId: Id_6,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.method: POST,
+      http.request.headers.host: localhost:00000,
+      http.url: http://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_7,
+    SpanId: Id_8,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerSyncAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    ParentId: Id_9,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.method: POST,
+      http.request.headers.host: localhost:00000,
+      http.url: http://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_10,
+    SpanId: Id_11,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerSyncAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    ParentId: Id_12,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.method: POST,
+      http.request.headers.host: localhost:00000,
+      http.url: http://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_13,
+    SpanId: Id_14,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerTaskAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    ParentId: Id_15,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.method: POST,
+      http.request.headers.host: localhost:00000,
+      http.url: http://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_16,
+    SpanId: Id_17,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerTaskAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    ParentId: Id_18,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.method: POST,
+      http.request.headers.host: localhost:00000,
+      http.url: http://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_19,
+    SpanId: Id_20,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerTaskAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    ParentId: Id_21,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.method: POST,
+      http.request.headers.host: localhost:00000,
+      http.url: http://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  }

4 occurrences of :

-    Resource: WcfSample/ICalculator/ServerSyncAdd,
+    Resource: /WcfSample/?/CalculatorService,

20 occurrences of :

-      http.url: http://localhost:00000/WcfSample/CalculatorService,
+      http.url: http://localhost:00000/WcfSample/123,123/CalculatorService,

4 occurrences of :

-    Resource: WcfSample/ICalculator/ServerTaskAdd,
+    Resource: WcfSample/ICalculator/ServerSyncAdd,

4 occurrences of :

-      http.url: http://localhost:00000/WcfSample/CalculatorService,
+      http.url: http://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_19,
+    SpanId: Id_20,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerTaskAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    ParentId: Id_21,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.method: POST,
+      http.request.headers.host: localhost:00000,
+      http.url: http://localhost:00000/WcfSample/123,123/CalculatorService,

2 occurrences of :

+  {
+    TraceId: Id_1,
+    SpanId: Id_2,
+    Name: wcf.request,
+    Resource: /WcfSample/123,123/CalculatorService,
+    Service: Samples.Wcf,
+    Type: web,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.agent_psr: 1.0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_3,
+    SpanId: Id_4,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerSyncAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.agent_psr: 1.0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_5,
+    SpanId: Id_6,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerSyncAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.agent_psr: 1.0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_7,
+    SpanId: Id_8,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerSyncAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.agent_psr: 1.0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_9,
+    SpanId: Id_10,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerTaskAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.agent_psr: 1.0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_11,
+    SpanId: Id_12,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerTaskAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.agent_psr: 1.0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_13,
+    SpanId: Id_14,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerTaskAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.agent_psr: 1.0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  }

2 occurrences of :

-    Resource: WcfSample/ICalculator/ServerSyncAdd,
+    Resource: /WcfSample/?/CalculatorService,
[...]
-      http.url: net.tcp://localhost:00000/WcfSample/CalculatorService,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,

6 occurrences of :

-      http.url: net.tcp://localhost:00000/WcfSample/CalculatorService,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,

2 occurrences of :

-    Resource: WcfSample/ICalculator/ServerTaskAdd,
+    Resource: WcfSample/ICalculator/ServerSyncAdd,
[...]
-      http.url: net.tcp://localhost:00000/WcfSample/CalculatorService,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,

2 occurrences of :

-      http.url: net.tcp://localhost:00000/WcfSample/CalculatorService,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,
+      language: dotnet,
+      runtime-id: Guid_1,
+      span.kind: server,
+      version: 1.0.0,
+      _dd.p.dm: -0
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.agent_psr: 1.0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_13,
+    SpanId: Id_14,
+    Name: wcf.request,
+    Resource: WcfSample/ICalculator/ServerTaskAdd,
+    Service: Samples.Wcf,
+    Type: web,
+    Tags: {
+      component: Wcf,
+      env: integration_tests,
+      http.url: net.tcp://localhost:00000/WcfSample/123,123/CalculatorService,

@andrewlock

Copy link
Copy Markdown
Member

Benchmarks Report 🐌

Benchmarks for #3026 compared to master:

  • All benchmarks have the same speed
  • All benchmarks have the same allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net472 706μs 284ns 1.1μs 0.355 0 0 3.18 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 461μs 245ns 950ns 0 0 0 2.58 KB
#3026 WriteAndFlushEnrichedTraces net472 719μs 454ns 1.76μs 0.355 0 0 3.18 KB
#3026 WriteAndFlushEnrichedTraces netcoreapp3.1 480μs 297ns 1.15μs 0 0 0 2.58 KB
Benchmarks.Trace.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net472 186ns 0.247ns 0.856ns 0.0675 0 0 425 B
master AllCycleSimpleBody netcoreapp3.1 238ns 0.307ns 1.19ns 0.00585 0 0 424 B
master AllCycleMoreComplexBody net472 189ns 0.158ns 0.59ns 0.0637 0 0 401 B
master AllCycleMoreComplexBody netcoreapp3.1 234ns 0.178ns 0.666ns 0.00545 0 0 400 B
master BodyExtractorSimpleBody net472 274ns 0.253ns 0.981ns 0.0574 0 0 361 B
master BodyExtractorSimpleBody netcoreapp3.1 221ns 0.312ns 1.21ns 0.00372 0 0 272 B
master BodyExtractorMoreComplexBody net472 14.2μs 10.8ns 41.6ns 1.2 0.0211 0 7.62 KB
master BodyExtractorMoreComplexBody netcoreapp3.1 12.1μs 18.7ns 70ns 0.0911 0 0 6.75 KB
#3026 AllCycleSimpleBody net472 193ns 0.985ns 4.29ns 0.0675 0 0 425 B
#3026 AllCycleSimpleBody netcoreapp3.1 237ns 0.253ns 0.98ns 0.00583 0 0 424 B
#3026 AllCycleMoreComplexBody net472 183ns 0.128ns 0.479ns 0.0638 0 0 401 B
#3026 AllCycleMoreComplexBody netcoreapp3.1 233ns 0.31ns 1.2ns 0.0054 0 0 400 B
#3026 BodyExtractorSimpleBody net472 252ns 0.331ns 1.24ns 0.0574 0 0 361 B
#3026 BodyExtractorSimpleBody netcoreapp3.1 220ns 0.398ns 1.49ns 0.00373 0 0 272 B
#3026 BodyExtractorMoreComplexBody net472 14μs 6.02ns 22.5ns 1.21 0.021 0 7.62 KB
#3026 BodyExtractorMoreComplexBody netcoreapp3.1 12.4μs 17.3ns 67ns 0.0929 0 0 6.75 KB
Benchmarks.Trace.AspNetCoreBenchmark - Unknown 🤷 Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
master SendRequest netcoreapp3.1 186μs 236ns 885ns 0.185 0 0 20.57 KB
#3026 SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
#3026 SendRequest netcoreapp3.1 181μs 167ns 646ns 0.272 0 0 20.57 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net472 1.83μs 0.466ns 1.75ns 0.15 0.00091 0 947 B
master ExecuteNonQuery netcoreapp3.1 1.46μs 3.32ns 12.9ns 0.0124 0 0 936 B
#3026 ExecuteNonQuery net472 1.84μs 0.546ns 2.04ns 0.15 0.000919 0 947 B
#3026 ExecuteNonQuery netcoreapp3.1 1.38μs 0.432ns 1.62ns 0.0124 0 0 936 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net472 2.52μs 0.779ns 2.91ns 0.183 0 0 1.16 KB
master CallElasticsearch netcoreapp3.1 1.63μs 4.34ns 16.8ns 0.0144 0 0 1.1 KB
master CallElasticsearchAsync net472 2.78μs 0.73ns 2.63ns 0.204 0 0 1.29 KB
master CallElasticsearchAsync netcoreapp3.1 1.66μs 0.616ns 2.22ns 0.0166 0 0 1.22 KB
#3026 CallElasticsearch net472 2.49μs 0.485ns 1.75ns 0.184 0 0 1.16 KB
#3026 CallElasticsearch netcoreapp3.1 1.51μs 0.473ns 1.71ns 0.0144 0 0 1.1 KB
#3026 CallElasticsearchAsync net472 2.64μs 1.2ns 4.48ns 0.204 0 0 1.29 KB
#3026 CallElasticsearchAsync netcoreapp3.1 1.55μs 0.544ns 1.96ns 0.0164 0 0 1.22 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net472 2.7μs 6.42ns 24.9ns 0.224 0 0 1.41 KB
master ExecuteAsync netcoreapp3.1 1.72μs 4.35ns 16.8ns 0.0178 0 0 1.34 KB
#3026 ExecuteAsync net472 2.63μs 7.26ns 28.1ns 0.224 0 0 1.41 KB
#3026 ExecuteAsync netcoreapp3.1 1.7μs 3.47ns 13.5ns 0.018 0 0 1.34 KB
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net472 5.6μs 12.8ns 49.6ns 0.438 0 0 2.77 KB
master SendAsync netcoreapp3.1 3.51μs 8.23ns 30.8ns 0.0354 0 0 2.6 KB
#3026 SendAsync net472 5.72μs 21.3ns 82.3ns 0.44 0 0 2.77 KB
#3026 SendAsync netcoreapp3.1 3.56μs 7.93ns 29.7ns 0.0357 0 0 2.6 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net472 3.25μs 2.64ns 10.2ns 0.288 0 0 1.81 KB
master EnrichedLog netcoreapp3.1 2.59μs 7.73ns 29.9ns 0.0253 0 0 1.85 KB
#3026 EnrichedLog net472 3.25μs 2.84ns 11ns 0.288 0 0 1.81 KB
#3026 EnrichedLog netcoreapp3.1 2.55μs 1.16ns 4.34ns 0.0243 0 0 1.85 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net472 150μs 150ns 580ns 0.686 0.229 0 4.65 KB
master EnrichedLog netcoreapp3.1 116μs 263ns 1.02μs 0 0 0 4.49 KB
#3026 EnrichedLog net472 153μs 72.8ns 272ns 0.692 0.231 0 4.65 KB
#3026 EnrichedLog netcoreapp3.1 118μs 149ns 575ns 0.0585 0 0 4.49 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net472 5.6μs 12.9ns 48.3ns 0.568 0.00277 0 3.59 KB
master EnrichedLog netcoreapp3.1 4.48μs 11.2ns 41.8ns 0.0537 0 0 3.91 KB
#3026 EnrichedLog net472 5.6μs 12.5ns 46.6ns 0.569 0.00281 0 3.59 KB
#3026 EnrichedLog netcoreapp3.1 4.34μs 11.1ns 43ns 0.054 0 0 3.91 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net472 2.34μs 2.78ns 10.8ns 0.217 0 0 1.37 KB
master SendReceive netcoreapp3.1 1.81μs 0.835ns 3.01ns 0.0181 0 0 1.32 KB
#3026 SendReceive net472 2.41μs 1.26ns 4.71ns 0.217 0 0 1.37 KB
#3026 SendReceive netcoreapp3.1 1.82μs 0.869ns 3.36ns 0.0183 0 0 1.32 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net472 5.08μs 1.81ns 7.03ns 0.354 0 0 2.23 KB
master EnrichedLog netcoreapp3.1 4.43μs 1.3ns 5.04ns 0.0245 0 0 1.8 KB
#3026 EnrichedLog net472 5.03μs 1.08ns 4.17ns 0.354 0 0 2.23 KB
#3026 EnrichedLog netcoreapp3.1 4.32μs 1.69ns 6.56ns 0.0238 0 0 1.8 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net472 1.13μs 0.246ns 0.921ns 0.128 0 0 810 B
master StartFinishSpan netcoreapp3.1 923ns 0.166ns 0.623ns 0.0102 0 0 760 B
master StartFinishScope net472 1.39μs 0.484ns 1.74ns 0.141 0 0 891 B
master StartFinishScope netcoreapp3.1 1.13μs 0.385ns 1.44ns 0.0118 0 0 880 B
#3026 StartFinishSpan net472 1.13μs 0.473ns 1.83ns 0.129 0 0 810 B
#3026 StartFinishSpan netcoreapp3.1 937ns 0.402ns 1.45ns 0.0103 0 0 760 B
#3026 StartFinishScope net472 1.37μs 0.569ns 2.2ns 0.141 0 0 891 B
#3026 StartFinishScope netcoreapp3.1 1.07μs 0.421ns 1.57ns 0.0118 0 0 880 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net472 1.5μs 0.712ns 2.76ns 0.141 0 0 891 B
master RunOnMethodBegin netcoreapp3.1 1.22μs 1.06ns 4.09ns 0.0121 0 0 880 B
#3026 RunOnMethodBegin net472 1.54μs 0.906ns 3.39ns 0.141 0 0 891 B
#3026 RunOnMethodBegin netcoreapp3.1 1.15μs 0.52ns 1.94ns 0.012 0 0 880 B

@andrewlock

Copy link
Copy Markdown
Member

Code Coverage Report 📊

✔️ Merging #3026 into master will not change line coverage
✔️ Merging #3026 into master will not change branch coverage
⛔ Merging #3026 into master will will increase complexity by 12

master #3026 Change
Lines 17420 / 23769 17502 / 23788
Lines % 73% 74% 0% ✔️
Branches 10309 / 14621 10359 / 14633
Branches % 71% 71% 0% ✔️
Complexity 15784 15796 12

View the full report for further details:

Datadog.Trace Breakdown ✔️

master #3026 Change
Lines % 73% 74% 0% ✔️
Branches % 71% 71% 0% ✔️
Complexity 15784 15796 12

The following classes have significant coverage changes.

File Line coverage change Branch coverage change Complexity change
Datadog.Trace.Telemetry.Transports.JsonTelemetryTransport -9% -17% 0 ✔️
Datadog.Trace.ClrProfiler.AutoInstrumentation.Wcf.WcfCommon 1% ✔️ 11% ✔️ 4
Datadog.Trace.Ci.CIVisibility 5% ✔️ 6% ✔️ 0 ✔️

View the full reports for further details:

@bouwkast
bouwkast merged commit 5114615 into master Sep 1, 2022
@bouwkast
bouwkast deleted the steven/obfuscate-wcf-resources branch September 1, 2022 17:14
@github-actions github-actions Bot added this to the vNext milestone Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants