DisabledMetricsConfiguration

pydantic settings safir.metrics.DisabledMetricsConfiguration

Metrics configuration when metrics reporting is disabled.

Parameters:

Show JSON schema
{
   "title": "DisabledMetricsConfiguration",
   "description": "Metrics configuration when metrics reporting is disabled.",
   "type": "object",
   "properties": {
      "appName": {
         "description": "The name of the application that is emitting these metrics",
         "title": "Application name",
         "type": "string"
      },
      "events": {
         "$ref": "#/$defs/EventsConfiguration",
         "title": "Events configuration"
      },
      "enabled": {
         "description": "If set to false, no events will be sent and all calls to publish events will be no-ops.",
         "title": "Whether to send events",
         "type": "boolean"
      }
   },
   "$defs": {
      "EventsConfiguration": {
         "additionalProperties": false,
         "description": "Configuration for emitting events.",
         "properties": {
            "topicPrefix": {
               "default": "lsst.square.metrics.events",
               "description": "You probably should use the default here. It could be useful in development scenarios to change this.",
               "title": "Metrics topic prefix",
               "type": "string"
            }
         },
         "title": "EventsConfiguration",
         "type": "object"
      }
   },
   "required": [
      "appName",
      "enabled"
   ]
}

Config:
  • extra: str = ignore

  • populate_by_name: bool = True

Fields:
field enabled: Annotated[bool, AfterValidator(lambda x: _require_bool(x, False))] [Required]

If set to false, no events will be sent and all calls to publish events will be no-ops.

Constraints:
  • func = <function <lambda> at 0x7ff5616899e0>

make_manager(logger=None)

Construct an EventManager.

Parameters:

logger (BoundLogger | None, default: None) – Logger to use for internal logging. If not given, the safir.metrics logger will be used.

Returns:

An event manager appropriate to the configuration.

Return type:

EventManager