Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynatrace API does not always return milliseconds #111

Open
fishi0x01 opened this issue Jan 21, 2025 · 1 comment
Open

Dynatrace API does not always return milliseconds #111

fishi0x01 opened this issue Jan 21, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@fishi0x01
Copy link

Describe the bug
Dynatrace API does not return milliseconds if they are 000, e.g., 2025-01-18T21:35:03.000Z gets returned as 2025-01-18T21:35:03Z

That leads to the following error in the client API:

ValueError("time data '2025-01-18T21:35:03Z' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'")

This might be an issue in the API itself, but for now we can mitigate it by accepting both ISO pattern (with and without ms).

We currently fix this behavior by monkey patching the iso parsing function app-sre/qontract-reconcile#4815

Proposing a fix here: #110

To Reproduce
This is hard to reproduce and we stumbled across it by chance.
Essentially you have a 1:1000 chance that you will create an API token at exactly 000ms.

Steps to reproduce the behavior:

  1. Create a token at exactly 000ms
  2. try to use tokens.list()
  3. see error

Expected behavior
Properly parse whatever is returned by the API

Screenshots
None

Desktop (please complete the following information):
Not relevant - this is a general bug in how the client parses the response

Smartphone (please complete the following information):
Not relevant - this is a general bug in how the client parses the response

Additional context
None

@fishi0x01 fishi0x01 added the bug Something isn't working label Jan 21, 2025
@Dynatrace-James-Kitson
Copy link
Collaborator

Dynatrace-James-Kitson commented Feb 12, 2025

Thanks - yeah I agree this would ideally be addressed in the API itself as it would affect every potential client not just our Python client. I'll see if I can raise this with them before we decide to include changes to handle this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants