Skip to content

Add a generic-hostname flag for worker-executed task metrics #387

Description

@bafulton

Problem

--generic-hostname-task-sent-metric replaces the client hostname on celery_task_sent to keep label cardinality bounded when tasks are produced by a dynamic set of clients. The worker side has the same problem (celery_task_runtime and the celery_task_* counters are all labeled with the executing worker's hostname), but no equivalent flag. In autoscaled deployments (for example Kubernetes with KEDA), worker hostnames are ephemeral pod names, so the name × hostname × queue set churns and grows with the size of the worker fleet.

Proposed change

Add a flag mirroring --generic-hostname-task-sent-metric for the worker-executed metrics: label the celery_task_* and celery_task_runtime metrics with a constant hostname instead of the worker's.

I'll open a PR with this proposed change shortly. I'd appreciate feedback!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions