Reported by @peak portal
Original Directive (Verbatim)
“Ok, starting from fresh
Create a python script that will query the Dynatrace Environment V2 API /metrics, utilizing the nextPageKey functionality but not really needing any other variables and place that output into a JSON file and then extract from that JSON, the metricId text after the :, one per line into a CSV.”
✅ Key Requirements from Stryker:
1. Start from scratch, ignoring past scripts unless explicitly reused.
2. Use /metrics endpoint.
3. Use nextPageKey pagination logic.
4. Write the full API response to a .json file.
5. Extract metricId values from that JSON file.
6. Write only clean metricId strings (e.g., builtin:host.cpu.usage) to a .csv, one per line.
7. Do not use input() prompts. Edit values manually in the script.
8. Do not alter script logic or structure unless instructed.
Issue Description
Outcome
1
Introduced input() prompts for URL and token after repeatedly being instructed not to.
Broke automation and reusability.
2
Changed the endpoint path to something other than /metrics (e.g., /metrics/usage or with unsupported filters).
Caused 400 errors.
3
Did not save JSON response to file, even though that was a direct part of the ask.
Made verification and troubleshooting impossible.
4
Modified script structure, including log formatting, import rearrangement, and co
MAC, GPT APP 4o. Maybe you can tell me where someone can send full report as this is not working