Skip to content

Allow closing the connection/session #278

@FRosner

Description

@FRosner

Is your feature request related to a problem? Please describe.

We can open a client, but we cannot close the session. We have to work around it providing our own context manager which accesses a private variable in PrometheusConnect:

    def __enter__(self):
        return self._prometheus

    def __exit__(self, exc_type, exc_val, exc_tb):
        if self._prometheus._session:
            self._prometheus._session.close()
        return False

Describe the solution you'd like

Would be nice to have a close method, or even also implement context manager.

Describe alternatives you've considered

Not sure if there are any. We need to be able to not leak connections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions