App Insights TelemetryClient - Migrating from V2 to V3

Dave Westerman 0 Reputation points

We have been using the App Insights V2 TelemetryClient to create custom events in our Spring Boot Java app. We are trying to migrate to V3. Although the following web site says "There are typically no code changes when upgrading to 3.x.", in our case, the existing code gets a compile error, because the TelemetryConfiguration class no longer exists in V3.

    TelemetryConfiguration.getActive().instrumentationKey = metricPublisherRequestDTO.ikey
    val telemetryClient = TelemetryClient()


We need to be able to programmatically set the instrumentation key / connection string, because this is a generic service that we use to talk to any App Insights instance. We can find no way to do that. I tried the following, but it doesn't work:

    val telemetryClient = TelemetryClient()
    val telemetryContext = telemetryClient.context
    telemetryContext.connectionString = metricPublisherRequestDTO.ikey

Does anyone have any idea what we need to do this?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,786 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Karakoc, Gürcan 0 Reputation points

    Hi Dave,

    could you find a solution for this issue?

    Best regards,


    0 comments No comments