You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a custom HttpAttributesVisitor with the Elastic APM Android SDK, it never gets invoked for auto-instrumented HTTP requests. The default spans (HTTP GET, HTTP POST) appear in APM, but the custom visitor code (including any log statements) is never executed.
To Reproduce
Use this configuration (simplified example):
classApmAttributesVisitor : HttpAttributesVisitor {
overridefunvisit(builder:AttributesBuilder, request:HttpRequest) {
Log.d("ApmAgentLogs", "Enter Visitor fun")
val uri =Uri.parse(request.url.toString())
val rawPath = uri.path ?:"/"
builder.put("http.route", rawPath)
}
}
val httpTraceConfig =HttpTraceConfiguration.builder()
.addHttpAttributesVisitor(ApmAttributesVisitor())
.build()
val instrumentationsConfig =InstrumentationConfiguration.builder()
.enableHttpTracing(true)
.build()
val elasticConfig =ElasticApmConfiguration.builder()
.setHttpTraceConfiguration(httpTraceConfig)
.setInstrumentationConfiguration(instrumentationsConfig)
.setServiceName("MyServiceName")
.build()
ElasticApmAgent.initialize(application, elasticConfig)
Make an OkHttp-based network call.
Observe that the APM UI captures spans named HTTP GET or HTTP POST, but your custom visitor’s logic is never called (no logs, no custom attributes).
Expected behavior
The HttpAttributesVisitor should be invoked for each auto-instrumented HTTP request.
Logs in visit(...) should appear in Logcat.
Any custom attributes (e.g., http.route) should appear in the APM UI.
Debug logs
I enabled debug logging for the agent but found no references to the custom visitor being invoked.
The text was updated successfully, but these errors were encountered:
Describe the bug
When using a custom
HttpAttributesVisitor
with the Elastic APM Android SDK, it never gets invoked for auto-instrumented HTTP requests. The default spans (HTTP GET
,HTTP POST
) appear in APM, but the custom visitor code (including any log statements) is never executed.To Reproduce
Use this configuration (simplified example):
Make an OkHttp-based network call.
Observe that the APM UI captures spans named
HTTP GET
orHTTP POST
, but your custom visitor’s logic is never called (no logs, no custom attributes).Expected behavior
HttpAttributesVisitor
should be invoked for each auto-instrumented HTTP request.visit(...)
should appear in Logcat.http.route
) should appear in the APM UI.Debug logs
I enabled debug logging for the agent but found no references to the custom visitor being invoked.
The text was updated successfully, but these errors were encountered: