Skip to content

ValueError: 'xxx' is not a valid Category from dt.audit_logs.list() #89

@JosephHobbs

Description

@JosephHobbs

Describe the bug

When calling dt.audit_logs.list() I'm seeing sporadic errors in my logs. The errors I see are ValueError exceptions complaining that specific values are not a valid Category. I am seeing this exception for ACTIVEGATE_TOKEN, ACTIVE_GATE, AGENT, COMPONENT and MANUAL_TAGGING_SERVICE (so far).

  • [ERROR] ValueError: 'ACTIVEGATE_TOKEN' is not a valid Category
  • [ERROR] ValueError: 'ACTIVE_GATE' is not a valid Category
  • [ERROR] ValueError: 'AGENT' is not a valid Category
  • [ERROR] ValueError: 'COMPONENT' is not a valid Category
  • [ERROR] ValueError: 'MANUAL_TAGGING_SERVICE' is not a valid Category

Here is an example of the raw exception for your reference:

[ERROR] ValueError: 'MANUAL_TAGGING_SERVICE' is not a valid Category
Traceback (most recent call last):
  File "/var/task/collect_audit_events.py", line 39, in lambda_handler
    events = dt.audit_logs.list(
  File "/opt/python/dynatrace/environment_v2/audit_logs.py", line 41, in list
    return PaginatedList(
  File "/opt/python/dynatrace/pagination.py", line 37, in __init__
    self.__elements = self._get_next_page()
  File "/opt/python/dynatrace/pagination.py", line 68, in _get_next_page
    data = [self.__target_class(self.__http_client, response.headers, element) for element in elements]
  File "/opt/python/dynatrace/pagination.py", line 68, in <listcomp>
    data = [self.__target_class(self.__http_client, response.headers, element) for element in elements]
  File "/opt/python/dynatrace/dynatrace_object.py", line 35, in __init__
    self._create_from_raw_data(raw_element)
  File "/opt/python/dynatrace/environment_v2/audit_logs.py", line 83, in _create_from_raw_data
    self.category: Category = Category(raw_element.get("category"))
  File "/var/lang/lib/python3.10/enum.py", line 385, in __call__
    return cls.__new__(cls, value)
  File "/var/lang/lib/python3.10/enum.py", line 710, in __new__
    raise ve_exc

My assumption here is that additional categories have been added to Dynatrace (SaaS), but the API has not been updated (yet) to include them...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions