Skip to content

Commit 0135935

Browse files
4444J99claudetconley1428
authored
docs: document OpenTelemetryConfig and PrometheusConfig fields (#1385)
* docs: document OpenTelemetryConfig and PrometheusConfig fields Add comprehensive docstrings with Attributes sections to both telemetry config dataclasses. Documents each field's purpose, default behavior, and includes example values. Addresses #1121 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: metric_periodicity defaults to 1s per sdk-core Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: tconley1428 <tconley1428@gmail.com>
1 parent 1bd9641 commit 0135935

1 file changed

Lines changed: 42 additions & 2 deletions

File tree

temporalio/runtime.py

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,26 @@ class OpenTelemetryMetricTemporality(Enum):
316316

317317
@dataclass(frozen=True)
318318
class OpenTelemetryConfig:
319-
"""Configuration for OpenTelemetry collector."""
319+
"""Configuration for OpenTelemetry collector.
320+
321+
Attributes:
322+
url: URL of the OpenTelemetry collector endpoint (e.g.
323+
``"http://localhost:4317"`` for gRPC or
324+
``"http://localhost:4318/v1/metrics"`` for HTTP).
325+
headers: Optional headers to include with each export request.
326+
Useful for authentication tokens or routing metadata.
327+
metric_periodicity: How often metrics are exported to the collector.
328+
Defaults to 1s (set by sdk-core) when ``None``.
329+
metric_temporality: Whether metrics are exported as cumulative
330+
or delta values. Defaults to ``CUMULATIVE``.
331+
durations_as_seconds: If ``True``, export duration metrics as
332+
floating-point seconds instead of integer milliseconds.
333+
Defaults to ``False``.
334+
http: If ``True``, use HTTP/protobuf transport instead of gRPC.
335+
When enabled, the ``url`` should point to the HTTP endpoint
336+
(e.g. ``"http://localhost:4318/v1/metrics"``).
337+
Defaults to ``False`` (gRPC).
338+
"""
320339

321340
url: str
322341
headers: Mapping[str, str] | None = None
@@ -346,7 +365,28 @@ def _to_bridge_config(self) -> temporalio.bridge.runtime.OpenTelemetryConfig:
346365

347366
@dataclass(frozen=True)
348367
class PrometheusConfig:
349-
"""Configuration for Prometheus metrics endpoint."""
368+
"""Configuration for Prometheus metrics endpoint.
369+
370+
Starts an HTTP server on the given address that exposes a ``/metrics``
371+
endpoint for Prometheus scraping.
372+
373+
Attributes:
374+
bind_address: Address to bind the metrics HTTP server to (e.g.
375+
``"0.0.0.0:9000"`` or ``"127.0.0.1:9090"``). Prometheus
376+
will scrape ``http://<bind_address>/metrics``.
377+
counters_total_suffix: If ``True``, append ``_total`` suffix to
378+
counter metric names, following the OpenMetrics convention.
379+
Defaults to ``False``.
380+
unit_suffix: If ``True``, append unit suffixes (e.g. ``_seconds``,
381+
``_bytes``) to metric names. Defaults to ``False``.
382+
durations_as_seconds: If ``True``, report duration metrics as
383+
floating-point seconds instead of integer milliseconds.
384+
Defaults to ``False``.
385+
histogram_bucket_overrides: Override the default histogram bucket
386+
boundaries for specific metrics. Keys are metric names and
387+
values are sequences of bucket boundaries (e.g.
388+
``{"workflow_task_schedule_to_start_latency": [0.01, 0.05, 0.1, 0.5, 1.0, 5.0]}``).
389+
"""
350390

351391
bind_address: str
352392
counters_total_suffix: bool = False

0 commit comments

Comments
 (0)