-
Notifications
You must be signed in to change notification settings - Fork 208
Open
Description
Expected behavior
- Filter and skip uploading unnecessary database-related telemetries, which include
- Ping / Commit
- Set variable 'autocommit' / access mode, etc.
Actual behavior
- Used
applicationinsights.jsonto setup sampling overrides (configurations listed below) - Tried various setups but will cannot stop above mentioned telemetries to be uploaded to Azure
↑ Only records in red are wanted, and failed to stop others to be uploaded.
To Reproduce
- It is a Java Spring Boot Web application deployed to Azure App Service.
- JRE-21, Spring Boot version: v3.5.8, Application Insights Java Agent version: v3.7.3
Some configurations in applicationinsights.json I have tried:
Disable JDBC
"instrumentation": {
"jdbc": {
"enabled": false
}
}
Results:
- All "actual SQL queries" records are gone (those
Namestarted withSELECTin above screen shot), while others are still being uploaded - Exactly the opposite what I want
Filter by db.statement
- Gathered several possible SQL queries for the telemetry to be filtered
- Also tried
valuelikePINGorCOMMITfor both cases usingstricttype with the same result
"sampling": {
"overrides": [{
"telemetryType": "dependency",
"attributes": [
{
"key": "db.statement",
"value": "(?i)^(commit|rollback|set autocommit.*|ping|SELECT 1.*)",
"matchType": "regexp"
}
],
"percentage": 0
}
]
}
Results:
- Nothing is filtered
Filter by db.operation
"sampling": {
"overrides": [{
"telemetryType": "dependency",
"attributes": [
{
"key": "db.operation",
"value": "PING",
"matchType": "strict"
}
],
"percentage": 0
}
]
}
Results:
- Nothing is filtered
System information
Please provide the following information:
- SDK Version:
- Application Insights Java Agent v3.7.3
telemetry.sdk.version= 1.50.0
- OS type and version: Docker
eclipse-temurin:21-jre - Application Server type and version (if applicable): N/A
- Using spring-boot? Y (v3.5.8)
- Additional relevant libraries (with version, if applicable): N/A
Logs
Startup log:
Picked up JAVA_TOOL_OPTIONS: -javaagent:/agents/java/applicationinsights-agent-codeless.jar
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2026-01-05 06:24:22.882Z INFO c.m.a.a.i.c.ConfigurationBuilder - Some telemetry may be sampled out because a default sampling configuration was added in version 3.4.0 to reduce the default billing cost. You can set the sampling configuration explicitly: https://learn.microsoft.com/azure/azure-monitor/app/java-standalone-config#sampling
2026-01-05 06:24:25.586Z WARN i.o.s.a.ResourceConfiguration - Found reference to io.opentelemetry.sdk.autoconfigure.internal.EnvironmentResourceProvider in otel.java.enabled.resource.providers. Please update to io.opentelemetry.sdk.autoconfigure.EnvironmentResourceProvider. Support for the old provider name will be removed after 1.49.0.
2026-01-05 06:24:31.359Z INFO c.m.applicationinsights.agent - Application Insights Java Agent 3.7.3 started successfully (PID 1, JVM running for 12.461 s)
2026-01-05 06:24:31.391Z INFO c.m.applicationinsights.agent - Java version: 21.0.9, vendor: Eclipse Adoptium, home: /opt/java/openjdk
Debug logs for some of the unwanted spans:
- PING
2025-12-30 08:39:38.822Z DEBUG c.m.a.a.i.exporter.AgentSpanExporter - exporting span: SpanData{spanContext=ImmutableSpanContext{...},
parentSpanContext=ImmutableSpanContext{...},
resource=Resource{schemaUrl=null, attributes={service.name="dev-xxx", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.50.0"}},
instrumentationScopeInfo=InstrumentationScopeInfo{name=MySQL Connector/J, version=9.5.0, schemaUrl=null, attributes={}}, name=Ping, kind=CLIENT, startEpochNanos=1767083978792441794, endEpochNanos=1767083978800465996,
attributes=AttributesMap{data={thread.id=45, db.system=mysql, db.statement=PING, db.user=xxx, db.name=xxx, thread.name=restartedMain, db.operation=PING}, capacity=128, totalAddedValues=9},
totalAttributeCount=9, events=[], totalRecordedEvents=0,
links=[ImmutableLinkData{...}],
totalRecordedLinks=1, status=ImmutableStatusData{statusCode=UNSET, description=}, hasEnded=true}
- autocommit
2025-12-30 08:40:37.782Z DEBUG c.m.a.a.i.exporter.AgentSpanExporter - exporting span: SpanData{spanContext=ImmutableSpanContext{...},
parentSpanContext=ImmutableSpanContext{...},
resource=Resource{schemaUrl=null, attributes={service.name="dev-xxx", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.50.0"}}, i
nstrumentationScopeInfo=InstrumentationScopeInfo{name=MySQL Connector/J, version=9.5.0, schemaUrl=null, attributes={}},
name=Set variable 'autocommit', kind=CLIENT, startEpochNanos=1767084037772131150, endEpochNanos=1767084037779955066,
attributes=AttributesMap{data={thread.id=66, db.system=mysql, db.statement=SET (...), db.user=xxx, db.name=xxx, thread.name=http-nio-8080-exec-2, applicationinsights.internal.operation_name=GET /*, db.operation=SET}, capacity=128, totalAddedValues=10},
totalAttributeCount=10, events=[], totalRecordedEvents=0,
links=[ImmutableLinkData{...}],
totalRecordedLinks=1, status=ImmutableStatusData{statusCode=UNSET, description=}, hasEnded=true}
Screenshots
If applicable, add screenshots to help explain your problem.
Metadata
Metadata
Assignees
Labels
No labels