question

Bruce G. avatar image
Bruce G. asked ·

Conditionally capture arguments

Hi,

I want to conditionally capture arguments during a dynatrace method sensor rule. The reason for this is that there is some sensitive information in some calls so I only want to capture the arguments when one of the arguments is a specific value.

From what I can see this isn't possible? Anyone know for sure?

appmonjava7.1sensors
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Joe H. avatar image
Joe H. answered ·

Another approach is to modify your code. Below the setValue(), put an IF statement.

If key in (a,b) {call passToDynatrace(key, value)}.
Then create a passToDyntrace(key, value) method that doesn't do anything, just returns, and instrument the passToDynatrace(key, value) where you capture the key and/or value.

This approach allows your business logic to make the decision as to what Dynatrace collects, as it's not possible for Dynatrace to know what keys to collect and which ones not to collect until it's collected.

2 comments Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Great Suggestion!

0 Likes 0 · ·

Hi Joseph
Thanks - we've done that in other code we have. Unfortunately this is third party code - and part of their generic product so we can't get it modified.
I might have to consider using AOP.

0 Likes 0 · ·
Joe H. avatar image
Joe H. answered ·

Bruce, Given your 3rd party situation, AOP is certainly an option. Another approach I would consider is trying to find the two nuggets of interest someplace else in the code, and thus avoid the conflicts of capturing generic setters. Good luck.

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Kyle K. avatar image
Kyle K. answered ·

I don't know that you can specify only pull out the arg value if it equals xyz. You can create a BT and measure to use that specific value but as far as I know its either capture that value or not. I would look at seeing if you can pull an object out and use an accessor for access to a specific element of it.

3 comments Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Just to explain a little more :

I have a setValue(String key,String value) call I want to monitor and capture the argument. Problem is that apart for the two keys I'm interested in and want to capture (starting depart or arrive) the container also has personal details and payment information which I absolutely cannot capture.

0 Likes 0 · ·

Does this set value method also set the Credit Card information? If not you should be able to safely instrument that method. If you have a test environment I would look at testing those sensor placements there to be 100% sure you are not getting CC information

1 Like 1 · ·

yup - that what I tested before asking and it does have card info - hence I can't instrument it sadly

0 Likes 0 · ·