Skip to content

Custom RequestTelemetry & RemoteDependencyTelemetry is no longer working with SDK when using Java 3.0 agent #1442

@ajaythakran

Description

@ajaythakran

Expected behavior

Application Insights Java SDK v2.6.2 must work with Agent 3.0 as it used to work with Agent 2.6.2:

  • to produce custom telemetry events: RequestTelemetry & RemoteDependencyTelemetry
  • to propagate W3C correlation headers

Actual behavior

The telemetry events work fine without Agent v3.0.
When Agent v3.0.1 is used, following errors are seen in log:

  • Error when trying to generate dependency traceparent using TraceContextCorrelation.generateChildDependencyTraceparent()
    AI: ERROR 18-01-2021 01:17:01.697+0000, 85(XNIO-2 task-1): Failed to generate child ID. Exception information: java.lang.RuntimeException: ThreadContext.getRequestTelemetryContext().getRequestTelemetry().getContext().getOperation() is not supported by the Application Insights for Java 3.0 agent
  • Error when trying to get parent spanId
    java.lang.RuntimeException: ThreadContext.getRequestTelemetryContext().getRequestTelemetry().getId() is not supported by the Application Insights for Java 3.0 agent at com.microsoft.applicationinsights.telemetry.RequestTelemetry.getId(RequestTelemetry.java:161) ~[applicationinsights-web-2.6.2.jar:na]

Requesting Fix or Updated Guide on SDK usage w.r.t. Agent v3.0

As per new documentation at https://docs.microsoft.com/en-us/azure/azure-monitor/app/java-in-process-agent, I noticed that the support for above mentioned operations is removed while using Agent 3.0.

But SDK is not useful if there is no way to Set current span in thread context or Access current parent span information. This is required specifically to start new span based on propagated correlation on consumption of message from system like Azure Service Bus Message or to propagate correlation headers (completes asynchronously) for dependency like Azure Service Bus Message. This will also include collection of telemetry request (on consuming) or dependency (on producing) respectively.

Could you please enable support for mentioned operations with Agent 3.0 or provide us guidance on how to use given SDK 2.6.2 for sending custom telemetry events RequestTelemetry & RemoteDependencyTelemetry

System information

Please provide the following information:

  • SDK Version: 2.6.2
  • OS type and version: Windows 10
  • Application Server type and version (if applicable): Spring Boot v2.3 with Undertow
  • Using spring-boot? Yes
  • Additional relevant libraries (with version, if applicable): Agent v3.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions