-
Notifications
You must be signed in to change notification settings - Fork 208
Open
Description
Hello,
I inherited a Spring boot application, which uses Application Insights.
Originally, the following maven packages were used:
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-spring-boot-starter</artifactId>
<version>2.6.4</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-logging-logback</artifactId>
<version>2.6.4</version>
</dependency>
The user_id was set as follows:
RequestTelemetry requestTelemetry = ThreadContext.getRequestTelemetryContext().getHttpRequestTelemetry();
requestTelemetry.getContext().getUser().setId(email);
Using the setup above, I was able to check traces in the logs, and filter on user (user_id column):
I've since upgraded to the 3.X SDK, using the following:
- Maven packages:
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-web</artifactId>
<version>3.7.2</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-runtime-attach</artifactId>
<version>3.7.2</version>
</dependency>
- Initialize telemetry:
public static void main(String[] args) {
ApplicationInsights.attach();
SpringApplication.run(MsPlanningApplication.class, args);
}
- Set user id:
RequestTelemetryContext requestTelemetryContext = ThreadContext.getRequestTelemetryContext();
if (requestTelemetryContext != null) {
RequestTelemetry requestTelemetry = requestTelemetryContext.getHttpRequestTelemetry();
requestTelemetry.getContext().getUser().setId(email);
}
However, since the upgrade to SDK 3.X, the user_id column is empty (the messages/errors are logged just fine). When I check the end-to-end transaction, I do see my user_id.
So, why am I not seeing the user_id in my traces (when checking the logs)?
Metadata
Metadata
Assignees
Labels
No labels