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

Request attributes map

Hector1
Frequent Guest

Hi all

I'm new to monitoring, please don't judge too harshly 🙂

Please help me with a question

I want to retrieve the key values ​​via request attributes for the java.util.map method

I try via get("key") but dynatrace writes an error

how can I get the value of the keys?

6 REPLIES 6

Esam_Eid
Mentor

Hi @Hector1 ,

 

Can you please share screenshot for the configurations 

BR

Hector1
Frequent Guest

Hi @Esam_Eid 

 import java.util.HashMap;

import java.util.Map;

 

public class Main {

    public static void main(String[] args) {

        // Create

IMG_20240428_133147.jpg

Map

        Map<String, String> map = new HashMap<>();

 

        // — Map

        map.put("Sessionid", "47488338");

 

        // Map —

        System.out.println(map);

    }

}

here is the usual code in java and from it I need to extract the key value

 

The screenshot shows that dynatrace does not allow this to be done as can be done in java code

 

Hola @Hector1 

I see you are using a data type: Dictionary (key, value).
I think Dynatrace can't interpret it.

I also see that the result of your method is System.out.printIn(map), if so.

Maybe you can capture the result of your method ( Change the option Capture) , because it will be a string like " SessionId,47488338 ", and then you can use the "Restrict or further process the captured parameters" option.

PierreGutierrez_0-1714356756217.png
 
I hope it's helpful  💪

 

Pierre Gutierrez - LATAM ACE Consultant - Loving Cats! Loving Technology !

Hector1
Frequent Guest

Hi @PierreGutierrez 

Thanks for the advice, I'll try to do that

And if the dictionary has more meanings than one, for example like this

sessionid=38288228, blockid=4646466446, useruiid=49393838

and there can be up to 50 such values. Can dynatrace see them all?

Try this

PacoPorro_0-1714373730687.png

PacoPorro_1-1714373763241.png

 

Hi @Hector1 
If your method is going to be executed multiple times in the call (and at those times different data will be sent and those different values must be captured).

PierreGutierrez_0-1714401216084.png

NOTE: It is important that you know that with this configuration only 10 different values are captured.

In that case, what PacoPorro recommends is a good alternative 💪.

In addition to this, I present other scenarios that may be useful to you:

1.- Use a different request attribute: Apply rules to capture different values, example:

- RA 1: Session ID
- RA 2: Block ID

This will be useful when you want to analyze data in multidimensional 💪 and create Calculated Service Metrics in the future.

2.- Use Business Event: If you have a different Key, it is a perfect scenario to use it.

https://docs.dynatrace.com/docs/shortlink/ba-business-events-capturing 

One of the good practices for using Request Attribute in Dyantrace is not to apply too many request attributes to the services.

Using them excessively can affect performance.

I hope it's helpful 💪




Pierre Gutierrez - LATAM ACE Consultant - Loving Cats! Loving Technology !

Featured Posts