# Capture OneAgent SDK Custom Request Attributes in Dynatrace

**URL:** <https://community.dynatrace.com/t/capture-oneagent-sdk-custom-request-attributes-in-dynatrace/49604>\
**Category:** Open Q&A\
**Tags:** distributed-traces-classic, oneagent-sdk, request-attributes\
**Created:** [January 7, 2025, 8:31pm UTC](https://community.dynatrace.com/t/capture-oneagent-sdk-custom-request-attributes-in-dynatrace/49604 "2025-01-07T20:31:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![waded](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@waded](https://community.dynatrace.com/u/waded)\
**Post date:** [January 7, 2025, 8:31pm UTC](https://community.dynatrace.com/t/capture-oneagent-sdk-custom-request-attributes-in-dynatrace/49604/1 "2025-01-07T20:31:10Z")

</div>

_Summary: This post explains how to configure Dynatrace so that request attributes added through the OneAgent SDK are captured and displayed. It clarifies required instrumentation, attribute settings, and verification steps._

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 - fo,r 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:

```auto
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](https://global.discourse-cdn.com/dynatrace/original/2X/8/8fe2695c0728b1030d894f340a3a9b1b175f6682.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](https://global.discourse-cdn.com/dynatrace/original/3X/9/7/972de79ea69956b8fe9417766085ac29683ab96b.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?

---

<div class="post-metadata">

**Author:** ![Romanenkov\_Al3x](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/romanenkov_al3x/32/36257_2.png) [@Romanenkov\_Al3x](https://community.dynatrace.com/u/Romanenkov_Al3x)\
**Post date:** [January 8, 2025, 9:39am UTC](https://community.dynatrace.com/t/capture-oneagent-sdk-custom-request-attributes-in-dynatrace/49604/2 "2025-01-08T09:39:22Z")

</div>

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](https://global.discourse-cdn.com/dynatrace/original/2X/b/b898696e39d9098fe7f478c33ff21a02840b35a5.png)

[More](https://www.dynatrace.com/news/blog/capture-any-request-attributes-using-oneagent-sdk/#:~:text=SDK%20custom%20attribute) screenshots in blog.

Hope it helps.

Regards,

Alex Romanenkov

---

<div class="post-metadata">

**Author:** ![waded](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@waded](https://community.dynatrace.com/u/waded)\
**Post date:** [January 8, 2025, 3:53pm UTC](https://community.dynatrace.com/t/capture-oneagent-sdk-custom-request-attributes-in-dynatrace/49604/3 "2025-01-08T15:53:40Z")

</div>

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&nbsp;[Google Search](https://www.google.com/search?q=dynatrace+%22SDK+custom+attribute%22+github),&nbsp;I’ll submit a documentation PR to help with this.)
