Back to Prefect

run_telemetry

docs/v3/api-ref/python/prefect-telemetry-run_telemetry.mdx

3.6.30.dev33.4 KB
Original Source

prefect.telemetry.run_telemetry

Classes

OTELSetter <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L35" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

A setter for OpenTelemetry that supports Prefect's custom labels.

Methods:

set <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L40" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
set(self, carrier: KeyValueLabels, key: str, value: str) -> None

RunTelemetry <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L45" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

A class for managing the telemetry of runs.

Methods:

async_start_span <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L60" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
async_start_span(self, run: FlowOrTaskRun, client: PrefectClient, parameters: dict[str, Any] | None = None) -> Span | None

end_span_on_failure <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L178" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
end_span_on_failure(self, terminal_message: str | None = None) -> None

End a span for a run on failure.

end_span_on_success <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L169" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
end_span_on_success(self) -> None

End a span for a run on success.

record_exception <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L189" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
record_exception(self, exc: BaseException) -> None

Record an exception on a span.

start_span <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L78" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
start_span(self, run: FlowOrTaskRun, client: SyncPrefectClient, parameters: dict[str, Any] | None = None) -> Span | None

traceparent_from_span <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L164" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
traceparent_from_span(span: Span) -> str | None

update_run_name <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L211" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
update_run_name(self, name: str) -> None

Update the name of the run.

update_state <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/telemetry/run_telemetry.py#L196" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
update_state(self, new_state: State) -> None

Update a span with the state of a run.