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

API call runs fine in Dynatrace Harness, but not in Python - It's the &to and &from qualifiers

crabbylou
Helper

I execute these parameters in both the Dynatrace API harness and in Python.

metricSelector=builtin%3Akubernetes.container.restarts%3Afilter%28and%28or%28in%28%22dt.entity.cloud_application_namespace%22%2CentitySelector%28%22type%28cloud_application_namespace%29%2CentityName.equals%28~%22XXX-XXXXX-1~%22%29%22%29%29%29%2Cor%28in%28%22dt.entity.cloud_application_instance%22%2CentitySelector%28%22type%28cloud_application_instance%29%2CentityName.contains%28~%22FOO~%22%29%22%29%29%29%29%29%3Alimit%2820%29&from=2023-10-25T00%3A00%3A00.000%2B04%3A00&to=2023-10-25T00%3A01%3A00.000%2B04%3A00

My issue is that it runs fine in the Dynatrace API harness, but NOT in Python, the &to and &from exclude all the data.

I have constructed hundreds of queries, and this is just weird!!!
Any advice would be appreciated.

Thanks,
Lou

 

2 REPLIES 2

JamesKitson
Dynatrace Guru
Dynatrace Guru

I'm not familiar with Harness or any processing it may do on inputs.

You can try constructing it through the API Explorer first and make sure the structure is right independent of Python or other tools. You may want to share your Python snippet as well.

Lastly, if you're interested I recommend looking at our open-source Python API client which includes methods for querying data from the metrics API so you just need to provide the inputs instead of creating the queries yourself.

crabbylou
Helper

I figured it out. It was a dumb programming error on my part. I was reading my date fields in Python as integers, and the lead zeroes on day, month, hour, minute and second were reading as integers and truncating lead zeroes.

Thanks! 🙂

Featured Posts