(check, metric_name, modifiers)
return service_check
This submits metrics as service checks.

    The required modifier `status_map` is a mapping of values to statuses. Valid statuses include:

    - `OK`
    - `WARNING`
    - `CRITICAL`
    - `UNKNOWN`

    Any encountered values that are not defined will be sent as `UNKNOWN`.
This submits metrics as service checks.
This submits metrics as service checks .
def get_service_check(check, metric_name, modifiers):
    """
    This submits metrics as service checks.

    The required modifier `status_map` is a mapping of values to statuses. Valid statuses include:

    - `OK`
    - `WARNING`
    - `CRITICAL`
    - `UNKNOWN`

    Any encountered values that are not defined will be sent as `UNKNOWN`.
    """
    # Do work in a separate function to avoid having to `del` a bunch of variables
    status_map = compile_service_check_statuses(modifiers)

    service_check_method = check.service_check

    def service_check(value, *, tags=None):
        service_check_method(
            metric_name,
            status_map.get(int(value), ServiceCheck.UNKNOWN),
            tags=tags,
        )

    del check
    del modifiers
    return service_check
def get_service_check ( check , metric_name , modifiers ) : # Do work in a separate function to avoid having to `del` a bunch of variables status_map = compile_service_check_statuses ( modifiers ) service_check_method = check . service_check def service_check ( value , * , tags = None ) : service_check_method ( metric_name , status_map . get ( int ( value ) , ServiceCheck . UNKNOWN ) , tags = tags , ) del check del modifiers return service_check