28 Apr 2024 06:32 AM
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?
Solved! Go to Solution.
28 Apr 2024 07:39 AM
Hi @Hector1 ,
Can you please share screenshot for the configurations
BR
28 Apr 2024 09:32 AM
Hi @Esam_Eid
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) {
// Create
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
29 Apr 2024 03:20 AM
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.
I hope it's helpful 💪
29 Apr 2024 06:27 AM
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?
29 Apr 2024 03:40 PM
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).
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 💪