api-client-python
api-client-python copied to clipboard
Add support for startTimestamp/endTimestamp on smartscape_hosts.list()
Is your feature request related to a problem? Please describe.
I am looking to collect metrics around host unit consumption over time via the API. The smartscape_hosts.list() returns the information I need, but it only accepts a relative timeframe for framing the request. As I am collecting/trending this data over time, I need to be able to specify the exact window of time (like 1PM to 2PM on X).
Describe the solution you'd like
I would like to see optional parameters added for startTimestamp and endTimestamp on smartscape_hosts.list(). Another option would be to add an alternate list method (like list_absolute()) that accepts these parameters versus a relative timeframe.
Describe alternatives you've considered
At this point my alternatives would be to roll my own solution for this specific data collection or attempt to apply changes to the existing client.
Additional context
I would be willing to implement/PR the changes. My only question would be, which method would be the preferred implementation (i.e. add parameters to list() or add an alternate list_absolute() or other method)?
Thank you!
Hello, thanks for the detailed write up.
Adding the parameters to list() would best as that lines up with how the API works as well as some of the other implementations we have for things like v2 metrics and the more current monitored entities v2: https://github.com/dynatrace-oss/api-client-python/blob/main/dynatrace/environment_v2/monitored_entities.py#L38
Generally that monitored entities API is better for querying hosts but I know it doesn't provide this data you need directly which is why we added this one even though it otherwise has a better/more current replacement.
Feel free to try to implement this, otherwise we'll plan on adding that when we have time.