What we have:
Right now we are using AI SDK v 2.6.3 for tracking HTTP operations and remote dependencies. We use it in multi-tenant system, and it is important for us to incorporate additional information about tenant (which is passed via request headers) in our telemetry data.
- For incoming requests, we use a filter:
protected void doFilterInternal(...) {
...
RequestTelemetry requestTelemetry = ThreadContext.getRequestTelemetryContext().getHttpRequestTelemetry();
requestTelemetry.getProperties().putIfAbsent("TENANT", tenantHolder.getTenant());
requestTelemetry.setName(tenantHolder.getTenant() + " " + requestTelemetry.getName());
filterChain.doFilter(httpServletRequest, httpServletResponse);
}
What we achive is visible distinction between requests for tenants, and ability to filter telemetry for them.
- We also achieved something similiar for remote dependencies by manually sending telemetry data via
RemoteDependencyTelemetry and TelemetryClient. We are able to produce names with tenant information, full URL, time measurments and it basically works perfectly fine
What we want to achieve:
We want to keep all of above functionalities, but also have automatic telemetry collected for JMS, Redis, Postgresql etc. so we tried to use SKD with Java Agent v 3.1.0
Problems:
- Despite https://docs.microsoft.com/en-us/azure/azure-monitor/app/java-in-process-agent#override-the-request-telemetry-name-using-the-2x-sdk , this solution doesn't work for us. For above code
getRequestTelemetryContext() always returns another instance, HttpRequestTelemetry is not populated and code is not having any effect on collected telemetry data. When debugging, invoking requestTelemetry.getName() after filterChain returns desired name.
- Our custom telemetry is not correlated with auto-collected, so requests are duplicated, and we couldn't find a way to disable auto collection of only remote dependencies, or to somehow explicitly correlate auto and manual telemetry.
In short:
Basically what we want is to preserve HTTP telemetry names in form:
<tenant_name> <http_method> <endpoint/url>
e.g.: Tenant_123 GET /api/v1/get-tenant-info/{tenant_id}
and what we have is:
GET /api/v1/get-tenant-info/{tenant_id} - for incoming requests
HTTP GET - for outgoing request (+ duplicated manual telemetry)
We use:
Spring 4.3.30, applicationinsights-web 2.6.3, Application Insights Java Agent 3.1.0
Thanks in advance for any suggestions.
What we have:
Right now we are using AI SDK v 2.6.3 for tracking HTTP operations and remote dependencies. We use it in multi-tenant system, and it is important for us to incorporate additional information about tenant (which is passed via request headers) in our telemetry data.
What we achive is visible distinction between requests for tenants, and ability to filter telemetry for them.
RemoteDependencyTelemetryandTelemetryClient. We are able to produce names with tenant information, full URL, time measurments and it basically works perfectly fineWhat we want to achieve:
We want to keep all of above functionalities, but also have automatic telemetry collected for JMS, Redis, Postgresql etc. so we tried to use SKD with Java Agent v 3.1.0
Problems:
getRequestTelemetryContext()always returns another instance,HttpRequestTelemetryis not populated and code is not having any effect on collected telemetry data. When debugging, invokingrequestTelemetry.getName()after filterChain returns desired name.In short:
Basically what we want is to preserve HTTP telemetry names in form:
<tenant_name> <http_method> <endpoint/url>
e.g.: Tenant_123 GET /api/v1/get-tenant-info/{tenant_id}
and what we have is:
GET /api/v1/get-tenant-info/{tenant_id} - for incoming requests
HTTP GET - for outgoing request (+ duplicated manual telemetry)
We use:
Spring 4.3.30, applicationinsights-web 2.6.3, Application Insights Java Agent 3.1.0
Thanks in advance for any suggestions.