Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Trim W3C ids to parent/span Id#1498

Merged
lmolkova merged 6 commits into
developfrom
lmolkova/trimW3CIds
Dec 20, 2019
Merged

Trim W3C ids to parent/span Id#1498
lmolkova merged 6 commits into
developfrom
lmolkova/trimW3CIds

Conversation

@lmolkova

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
Author

@TimothyMothra needless to say how much I love fxcop

@TimothyMothra

Copy link
Copy Markdown

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