Skip to content

Failing prometheuse handler prints to logs #482

@jakub-mikians-airspace-intelligence

Description

Hi!

When prometheus metrics handler fails for any reason (e.g. BrokenPipeError), it prints the error to the logs. Such errors are "unstructured", meaning that consumer of the logs (like AWS CloudWatch or Google Cloud Logs) treats each line independently, is inconvenient.

It would be an improvement if the stack traces would be logged using a proper python logging.Logger instead of print. The print is a part of the socketserver here, so it's hard to change right away. But, there could be a wrapper around MetricsHandler (here), invoked here, that would catch the exceptions and log them appropriately (and would swallow the exception instead of raiseing it).

How does that sound?

Thanks!

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions