Skip to content

CatchErrorsPlugin

Catches exceptions in plugin hooks to shield the server from crashing.

Usage

# settings.py
from prometheus_virtual_metrics.plugins import CatchErrorsPlugin

PLUGINS = [
    CatchErrorsPlugin(
        FlakyPlugin(),
    ),
]

prometheus_virtual_metrics.plugins.CatchErrorsPlugin

Parameters:

Name Type Description Default
plugin Plugin

prometheus-virtual-metrics plugin object (not class).

required
plugin_hook_names list[str] | None

List of hooks that should be shielded. If not set, all hooks are shielded.

None
send_warnings bool

If set to True warnings are added to prometheus responses.

True
logger logger

logger

logger