Open vduseev opened 2 months ago
Describe the bug If there is not unit field in the raw reply from the https://{your-environment-id}.live.dynatrace.com/api/v2/metrics API, the client doesn't handle it properly.
https://{your-environment-id}.live.dynatrace.com/api/v2/metrics
https://github.com/dynatrace-oss/api-client-python/blob/620213cf7bfff5e214bb4c20e1bbd0a31cac41d4/dynatrace/environment_v2/metrics.py#L230
The Unit enum doesn't have any value for None, obviously.
Unit
None
To Reproduce Steps to reproduce the behavior:
fields
client.metrics.list.query(page_size=500, fields="entityType")
Solution:
Most likely, this needs to be rewritten to
self.unit: Optional[Unit] = Unit(raw_element.get("unit")) if raw_element.get("unit") else None
Currently, you can go around that by specifying unit as a field:
unit
client.metrics.list.query(page_size=500, fields="+entityType,+unit")
Describe the bug If there is not unit field in the raw reply from the
https://{your-environment-id}.live.dynatrace.com/api/v2/metrics
API, the client doesn't handle it properly.https://github.com/dynatrace-oss/api-client-python/blob/620213cf7bfff5e214bb4c20e1bbd0a31cac41d4/dynatrace/environment_v2/metrics.py#L230
The
Unit
enum doesn't have any value forNone
, obviously.To Reproduce Steps to reproduce the behavior:
fields
specified:client.metrics.list.query(page_size=500, fields="entityType")
Solution:
Most likely, this needs to be rewritten to
Currently, you can go around that by specifying
unit
as a field: