Sitelet https://github.com/microsoft/ApplicationInsights-dotnet/issues/1380
Skip to content

Performance Enhancement: Request Tracking Properties & Post Sampling Execution Deferral  #1380

Description

@Mikhail-Pranovich identified performance issues in RequestTrackingTelemetryModule.
Specifically:

  1. Setting the requestTelemetry.Url from the context
    https://github.com/Microsoft/ApplicationInsights-dotnet-server/blob/3bee86d3f7ec3e81efe6c5ad3ebdbe37f79929bb/Src/Web/Web.Shared.Net/RequestTrackingTelemetryModule.cs#L164-L167

  2. Setting the requestTelemetry.Source to the SourceAppId
    https://github.com/Microsoft/ApplicationInsights-dotnet-server/blob/3bee86d3f7ec3e81efe6c5ad3ebdbe37f79929bb/Src/Web/Web.Shared.Net/RequestTrackingTelemetryModule.cs#L176-L203

Proposal
I'm proposing a feature flag to make this an opt-in feature:

  1. A new property: RequestTrackingTelemetryModule.DisableTrackingProperties (open to naming suggestions)
    https://github.com/Microsoft/ApplicationInsights-dotnet-server/blob/944ee584e39b79b6707479cc3762e5077f97b8e5/Src/Web/Web.Shared.Net/RequestTrackingTelemetryModule.cs#L56-L64

This would disable setting this properties in the RequestTrackingTelemetryModule.

  1. Settings these properties would be deferred to a TelemetryProcessor:
    https://github.com/Microsoft/ApplicationInsights-dotnet-server/blob/f145561f564ce3094115c5588920fc7eef0f8466/Src/Web/Web.Shared.Net/Extensibility/Implementation/PostSamplingTelemetryProcessor.cs#L12-L17

Risks
Cijo Thomas (@cijothomas) had a good comment:

URL is already populated by RequestCollectionModules which is shipped officially.
Modifying existing RequestCollectionModules to NOT populate URL, and instead rely on this new TP is a behavior change- Tel.Initializers will not see the URL. And also any TP added before this TP wont see URL. And there is no guarantee that TP is run in same context as incoming Request, so HttpContext.Current could be null.

We can discuss such change, but i'd do it only when we are changing major version.

Open Question

  • I'm looking for a compromise. What changes would be required to contribute this change to the official SDK?
    • Attach wants these changes already, and cannot wait for 3.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions