Metadata-Version: 2.1
Name: datadog-prefect
Version: 1.0.0
Summary: The Prefect check
Project-URL: Source, https://github.com/DataDog/integrations-core
Author-email: Datadog <packages@datadoghq.com>
Keywords: datadog,datadog agent,datadog check,prefect
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: BSD License
Classifier: Private :: Do Not Upload
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.13
Requires-Dist: datadog-checks-base>=37.33.0
Provides-Extra: deps
Description-Content-Type: text/markdown

# Agent Check: Prefect

## Overview

This check monitors [Prefect Server][1] through the Datadog Agent.

Prefect is a Python-first workflow orchestration platform used to schedule and execute flows and tasks across work pools, work queues, and workers. This integration collects orchestration health and performance metrics and events directly from the [Prefect Server API][2] and supports [log collection][3] for comprehensive monitoring.

### What this integration monitors

The integration collects metrics across multiple layers of the Prefect orchestration hierarchy:

-   **Server health**: API readiness and health status to confirm the control plane is operational.
-   **Work pool layer**: Pool readiness, paused or not-ready state, and aggregated worker availability to detect capacity or configuration issues.
-   **Worker layer**: Online or offline status and heartbeat age to identify lost or unhealthy workers.
-   **Work queue layer**: Backlog size, backlog age, last polled age, concurrency utilization, and queue state (ready, paused or not-ready) to detect congestion, starvation, and stalled consumers.
-   **Deployment and flow layer**: Flow run counts by state (running, completed, failed, crashed, etc.), throughput, late starts, execution duration, queue wait time, and retry gaps to track reliability and latency percentiles.
-   **Task layer**: Task run counts by state, throughput, execution duration, and dependency wait time to enable drilldowns from slow flows to individual task bottlenecks.
-   **Events**: Prefect events for state transitions and lifecycle changes.

## Setup

Follow the instructions below to install and configure this check for an Agent running on a host. For containerized environments, see the [Autodiscovery Integration Templates][4] for guidance on applying these instructions.

### Installation

The Prefect check is included in the [Datadog Agent][5] package.
No additional installation is needed on your server.

### Configuration

1. Edit the `prefect.d/conf.yaml` file, in the `conf.d/` folder at the root of your Agent's configuration directory to start collecting your Prefect performance data. See the [sample prefect.d/conf.yaml][6] for all available configuration options.

2. [Restart the Agent][7].

### Validation

[Run the Agent's status subcommand][8] and look for `prefect` under the Checks section.

## Data Collected

### Metrics

See [metadata.csv][9] for a list of metrics provided by this integration.

### Logs 
1. Enable log collection in your `datadog.yaml` file:

    ```
    logs_enabled: true
    ```
2. Uncomment and edit the logs configuration block in your `prefect.d/conf.yaml` file. For example:

    ```
    logs:
      - type: docker
        source: prefect
        service: <SERVICE>
    ```

### Events

The Prefect integration includes event support. Events are disabled by default; to enable them, set `collect_events` to `true` in the configuration.

After you enable it, the integration submits flow-run, task-run, and ready or not-ready events. The set of submitted events can be customized by adding or removing entries in the configuration.

### Service Checks

The Prefect integration does not include any service checks.


## Troubleshooting

Need help? Contact [Datadog support][10].


[1]: https://www.prefect.io/
[2]: https://docs.prefect.io/v3/api-ref/rest-api/server/index
[3]: https://docs.datadoghq.com/logs/log_collection/
[4]: https://docs.datadoghq.com/containers/kubernetes/integrations/
[5]: https://app.datadoghq.com/account/settings/agent/latest
[6]: https://github.com/DataDog/integrations-core/blob/master/prefect/datadog_checks/prefect/data/conf.yaml.example
[7]: https://docs.datadoghq.com/agent/configuration/agent-commands/#start-stop-and-restart-the-agent
[8]: https://docs.datadoghq.com/agent/configuration/agent-commands/#agent-status-and-information
[9]: https://github.com/DataDog/integrations-core/blob/master/prefect/metadata.csv
[10]: https://docs.datadoghq.com/help/
