cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get OneAgent SDK-added custom request attributes available for request filtering?

waded
Newcomer

I was kicking the tires on using OneAgent SDK in a Java (Jersey/Tomcat) application to enrich existing service request traces with additional computed attributes - for example a boolean indicating whether the service chose to stream a response or not. Using code quite like the SDK's example on a Path-annotated method on a Resource class that corresponds to a Dynatrace-monitored service:

oneAgentSdk.addCustomRequestAttribute("pricing-streamed", Boolean.toString(isStreamed));

I'm now seeing this "pricing-streamed" value (and a couple others I also added in code this way) showing up in traces at code-level under a category "Metadata" on the Jersey AbstractJavaResourceMethodDispatcher dispatch call:

waded_0-1736281602622.png

But I'm not seeing "pricing-streamed" as an option for the same traces when using the "Request attribute" filter for the service these traces show up under:

waded_1-1736281771570.png

So, how would I be able to filter to requests using this "pricing-streamed" request attribute?

I suspect perhaps there's something we need to adjust administratively? It sounds like for OTEL, at least, some kind of promotion to request attribute is required? But I'm using OneAgent SDK alone, and documentation, and method name "addCustomRequestAttribute" make it sound about as simple as what I've done - I've added a custom request attribute, how do I get it visible as a request attribute?

What am I missing?

2 REPLIES 2

Romanenkov_Al3x
DynaMight Champion
DynaMight Champion

Hello! Everything is done correctly, except that on the Dynatrace side, this attribute needs to be added and the type SDK custom attrubute should be specified

Romanenkov_Al3x_0-1736329110846.png

 

More screenshots in blog.

Hope it helps.

 

Regards,

Alex Romanenkov

DT_NGINX_FORCE_UNKNOWN_VERSION_INSTRUMENTATION=1

Ah, excellent, thanks Alex. I knew I was missing something. (I can't access those screens, so I was relying on the documentation starting from the SDK documentation, and didn't find this blog post. It's pretty sparse linkage in that direction, only 4 results for https://www.google.com/search?q=dynatrace+%22SDK+custom+attribute%22+github, I'll submit a documentation PR to help with this.)

Featured Posts