-
Notifications
You must be signed in to change notification settings - Fork 206
OpenTelemetry API support (3.0)
Trask Stalnaker edited this page Mar 11, 2021
·
7 revisions
To enable this preview feature, add the following to your applicationinsights.json
file:
{
"preview": {
"opentelemetryApiSupport": true
}
}
<dependencies>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
Span.current().setAttribute("mydimension", "myvalue");
Note: if your code is inside of a Spring controller, Span.current()
will reference the InProc
dependency that represents the controller call. In this case, you will need to add your code to a web filter that runs before the Spring controller, at which time Span.current()
will refer to the request.
Note: if you set an attribute named enduser.id
, the value will be stored in the user_Id
column in the Application Insights Logs table instead of as a custom dimension.