Skip to content

API reference for pushgateway, textfile, and multiprocess #1161

@k1chik

Description

@k1chik

Title: docs: add API reference for pushgateway, textfile, and multiprocess

Following the API reference work in #1021 (metric types) and the existing HTTP exporting docs, the pushgateway, textfile, and multiprocess docs have the same gap — examples without formal parameter documentation.

What's missing

Pushgateway (docs/content/exporting/pushgateway.md)

Currently 88 lines with good examples but no formal parameter tables for:

  • push_to_gateway(gateway, job, registry, grouping_key, timeout, handler, compression) — full signature with types and defaults undocumented
  • pushadd_to_gateway() — same params, registry is Optional[Collector] here (unlike push_to_gateway)
  • delete_from_gateway(gateway, job, grouping_key, timeout, handler) — no registry or compression params (differs from the other two)
  • Handler functions (default_handler) — the handler protocol (accepts url, method, timeout, headers, content) is only in the source docstring, not in the docs site
  • compression parameter ('gzip' or 'snappy') — not mentioned in the docs at all

Textfile (docs/content/exporting/textfile.md)

Only 23 lines. write_to_textfile() has undocumented parameters:

write_to_textfile(path: str, registry: Collector, escaping: str = ALLOWUTF8, tmpdir: Optional[str] = None) -> None
  • escaping — OpenMetrics escaping mode (not mentioned at all)
  • tmpdir — temp directory for atomic writes (not mentioned at all)

Multiprocess (docs/content/multiprocess/_index.md)

Best-documented section (99 lines), but still missing formal API reference for:

  • MultiProcessCollector(registry, path) — the path parameter (alternative to the PROMETHEUS_MULTIPROC_DIR env var) is undocumented
  • mark_process_dead(pid, path)path parameter undocumented, function only shown in a Gunicorn config snippet

Proposed approach

Add "## API Reference" sections to each existing page with:

  • Function parameter tables (name, type, default, description)
  • Return values
  • Error conditions
  • A validation script confirming every claim against the source

Source files to reference

  • prometheus_client/exposition.py — pushgateway and textfile functions
  • prometheus_client/multiprocess.py — MultiProcessCollector, mark_process_dead

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions