Skip to content

Histogram is not typed, and due to partial typing, this makes mypy --strict fail #760

@tommyjcarpenter

Description

@tommyjcarpenter

Since prometheus_client provides some types, adding it to ignore_missing_imports doesnt work. The existence of this file: https://github.com/prometheus/client_python/blob/master/prometheus_client/py.typed
means that ignore_missing_imports is ignored with prometheus_client.

Counter inc is typed:
https://github.com/prometheus/client_python/blob/master/prometheus_client/metrics.py#L272-L280

However, Histogram isnt typed, including observe:
https://github.com/prometheus/client_python/blob/master/prometheus_client/metrics.py#L464-L476

This causes mypy --strict to fail when using Histogram. Typing all metrics will allow strict mypy users to stop adding # type: ignore anywhere this function is used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions