Ask AI

You are viewing an unreleased or outdated version of the documentation

PagerDuty (dagster-pagerduty)

This library provides an integration with PagerDuty, to support creating alerts from your Dagster code.

Presently, it provides a thin wrapper on the Events API V2.

Getting Started

You can install this library with:

pip install dagster_pagerduty

To use this integration, you’ll first need to create an Events API V2 PagerDuty integration on a PagerDuty service. There are instructions here for creating a new PagerDuty service & integration.

Once your Events API V2 integration is set up, you’ll find an Integration Key (also referred to as a “Routing Key”) on the Integrations tab for your service. This key is used to authorize events created from the PagerDuty events API.

Once your service/integration is created, you can provision a PagerDuty resource and issue PagerDuty alerts from within your ops.

dagster_pagerduty.PagerDutyService ResourceDefinition[source]

Config Schema:
routing_key (dagster.StringSource):

The routing key provisions access to your PagerDuty service. Youwill need to include the integration key for your new integration, as arouting_key in the event payload.

This resource is for posting events to PagerDuty.

Legacy

dagster_pagerduty.pagerduty_resource ResourceDefinition[source]

Config Schema:
routing_key (dagster.StringSource):

The routing key provisions access to your PagerDuty service. Youwill need to include the integration key for your new integration, as arouting_key in the event payload.

A resource for posting events (alerts) to PagerDuty.

Example

@op
def pagerduty_op(pagerduty: PagerDutyService):
    pagerduty.EventV2_create(
        summary='alert from dagster'
        source='localhost',
        severity='error',
        event_action='trigger',
    )

@job(resource_defs={ 'pagerduty': pagerduty_resource })
def pagerduty_test():
    pagerduty_op()

pagerduty_test.execute_in_process(
    run_config={
        "resources": {
            'pagerduty': {'config': {'routing_key': '0123456789abcdef0123456789abcdef'}}
        }
    }
)