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

Trim W3C ids to parent/span Id #1498

Merged
merged 6 commits into from
Dec 20, 2019
Merged

Trim W3C ids to parent/span Id #1498

merged 6 commits into from
Dec 20, 2019

Conversation

lmolkova
Copy link
Member

In W3C mode we report parentId and Id in the format of |traceId.parentSpanId. and |traceId.spanId. respectively.

This is not needed anymore even for backward compatibility reasons. Compatibility with old versions of Application Insights SDK is handled by ingestion.

Describe the solution you would like

When SDK receives a valid incoming request with

  1. traceparent = 00-traceId-parentId-00, it should track request telemetry
  • request.Context.Operation.Id = traceId // no changes
  • request.Context.Operation.ParentId = parentId // new, was |traceId.parentId.
  • request.Id = new span Id // new, was |traceId.spanId.
  1. no header, it should track request telemetry
  • request.Context.Operation.Id = new traceId // no changes
  • request.Context.Operation.ParentId = null // no changes
  • request.Id = new span Id// new, was |traceId.spanId.
  1. legacy Request-Id header, it should track request telemetry
  • request.Context.Operation.Id = if request-id root part is compatible with trace-id, reuse it, otherwise generate a new one
  • request.Context.Operation.ParentId = headers[Request-Id] // no changes
  • request.Id = new span Id // new, was |traceId.spanId.
  • properties["ai_LegacyRootId"] = if request-id root part is NOT compatible with trace-id, put it here, otherwise keep empty // no changes

Similarly for dependencies

  • dependency.Context.Operation.Id = traceId,
  • dependency.Context.Operation.ParentId = parent span id, // new, was |trace.parent.
  • dependency.Id = new span id, // new, was |trace.span.

When sending Request-Id in outgoing requests it still MUST be formatted in the |TraceId.SpanId. format!

@TimothyMothra TimothyMothra added this to the 2.13 milestone Dec 11, 2019
@TimothyMothra
Copy link
Member

FxCop:

DiagnosticListeners\Implementation\HostingDiagnosticListener.cs(578,94): error CA1801: Parameter operationId of method GetParentId is never used. Remove the parameter or use it in the method body. [E:\A_work\20\s\NETCORE\src\Microsoft.ApplicationInsights.AspNetCore\Microsoft.ApplicationInsights.AspNetCore.csproj]

@lmolkova
Copy link
Member Author

@TimothyMothra needless to say how much I love fxcop

@TimothyMothra
Copy link
Member

Sorry. FxCop is an SDL requirement.
If you can review and confirm that this change was intentional, I would be more than happy to fix it for you. :)

You're also getting errors about a missing XML document. This is a new check that I added yesterday. These shouldn't be running against the Test projects and it's not actually failing your build.
It's safe to ignore this error and I'll get this fixed today.

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.

3 participants