pagerduty

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

PagerDuty

Extract service and incident metadata from PagerDuty using the PagerDuty REST API v2.

Usage

source:
  name: pagerduty
  scope: my-pagerduty
  config:
    api_key: your-pagerduty-api-key
    exclude:
      - PABC123
    incident_days: 30

Configuration

Key Type Required Description
api_key string Yes PagerDuty API key for authentication.
exclude []string No Service IDs to exclude from extraction.
incident_days int No Number of days to look back for incidents. Defaults to 30.

Entities

The extractor emits two entity types and their relationships as edges.

Entity: service
Field Sample Value
urn urn:pagerduty:my-pagerduty:service:PSERVICE1
name Payment Gateway
description Handles payment processing
properties.status active
properties.description Handles payment processing
properties.created_at 2024-01-15T10:30:00Z
properties.updated_at 2024-03-20T14:15:00Z
properties.html_url https://mycompany.pagerduty.com/services/PSERVICE1
properties.escalation_policy_id PPOLICY1
properties.team_ids PTEAM1,PTEAM2
properties.alert_creation create_alerts_and_incidents
properties.incident_urgency_rule constant
Entity: incident
Field Sample Value
urn urn:pagerduty:my-pagerduty:incident:PINC001
name High CPU on payment-gateway-01
properties.status resolved
properties.urgency high
properties.priority P1
properties.created_at 2024-03-18T02:15:00Z
properties.resolved_at 2024-03-18T03:45:00Z
properties.html_url https://mycompany.pagerduty.com/incidents/PINC001
properties.incident_number 42
properties.title High CPU on payment-gateway-01
Edges
Type Source Target Description
owned_by service team Service is owned by a team
belongs_to incident service Incident belongs to a service

Contributing

Refer to the contribution guidelines for information on contributing to this module.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps the PagerDuty REST API v2.

func NewClient

func NewClient(apiKey string) *Client

NewClient creates a new PagerDuty API client.

func (*Client) ListIncidents

func (c *Client) ListIncidents(ctx context.Context, since, until time.Time) ([]Incident, error)

ListIncidents returns PagerDuty incidents within the given time range using offset-based pagination.

func (*Client) ListServices

func (c *Client) ListServices(ctx context.Context) ([]Service, error)

ListServices returns all PagerDuty services using offset-based pagination.

type Config

type Config struct {
	APIKey       string   `json:"api_key" yaml:"api_key" mapstructure:"api_key" validate:"required"`
	Exclude      []string `json:"exclude" yaml:"exclude" mapstructure:"exclude"`
	IncidentDays int      `json:"incident_days" yaml:"incident_days" mapstructure:"incident_days"`
}

Config holds the extractor configuration.

type Extractor

type Extractor struct {
	plugins.BaseExtractor
	// contains filtered or unexported fields
}

Extractor extracts metadata from PagerDuty.

func New

func New(logger log.Logger) *Extractor

New creates a new PagerDuty extractor.

func (*Extractor) Extract

func (e *Extractor) Extract(ctx context.Context, emit plugins.Emit) error

Extract extracts services and incidents from PagerDuty.

func (*Extractor) Init

func (e *Extractor) Init(ctx context.Context, config plugins.Config) error

Init initialises the extractor with the given config.

type Incident

type Incident struct {
	ID             string `json:"id"`
	IncidentNumber int    `json:"incident_number"`
	Title          string `json:"title"`
	Status         string `json:"status"`
	Urgency        string `json:"urgency"`
	CreatedAt      string `json:"created_at"`
	ResolvedAt     string `json:"resolved_at"`
	HTMLURL        string `json:"html_url"`
	Service        struct {
		ID string `json:"id"`
	} `json:"service"`
	Priority *struct {
		Summary string `json:"summary"`
	} `json:"priority"`
}

Incident represents a PagerDuty incident.

type Service

type Service struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	Description      string `json:"description"`
	Status           string `json:"status"`
	CreatedAt        string `json:"created_at"`
	UpdatedAt        string `json:"updated_at"`
	HTMLURL          string `json:"html_url"`
	AlertCreation    string `json:"alert_creation"`
	EscalationPolicy struct {
		ID string `json:"id"`
	} `json:"escalation_policy"`
	Teams []struct {
		ID      string `json:"id"`
		Summary string `json:"summary"`
	} `json:"teams"`
	IncidentUrgencyRule struct {
		Type string `json:"type"`
	} `json:"incident_urgency_rule"`
}

Service represents a PagerDuty service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL