Skip to content

ebonding-stream-to-pagerduty

Pipeline: ebonding-stream-to-pagerduty

## Read incidents from stream
@rn:read-stream
            name = "snow-incidents" &
            group = "group-pagerduty"
    ## update stats
    --> @rn:write-stats-to-stream
            name = "ebonding-analytics" &
            type = "PagerDuty"
    ## select and rename source fields to match PagerDuty payload
    --> @dm:selectcolumns
            include = "number|description|short_description|priority|urgency"
    --> @dm:map
            to ="incident_key" &
            func="evaluate" &
            expr = number
    --> @dm:map
            to ="body_details" &
            func="evaluate" &
            expr = description
    --> @dm:map
            to ="incident_title" &
            func="evaluate" &
            expr = short_description
    --> @dm:eval
            incident_title = "incident_title.replace(chr(34), chr(39))"
    --> @dm:eval
            body_details = "body_details.replace(chr(34), chr(39))"
    ## enrich data with service, priority and urgency field mappings
    --> @dm:enrich-using-rule-dict
            dict = "pagerduty-svc-enrichment-dict" &
            rule_column = "rule" &
            enrich_columns = "service_id"
    --> @dm:enrich-using-rule-dict
            dict = "pagerduty-priority-enrichment-dict" &
            rule_column = "rule" &
            enrich_columns = "priority_id"
    --> @dm:map
            to ="priority_type" &
            func="fixed" &
            value = "priority_reference"
    --> @dm:enrich-using-rule-dict
            dict = "pagerduty-urgency-enrichment-dict" &
            rule_column = "rule" &
            enrich_columns = "urgency_id"
    ## create PagerDuty incident payload
    --> @dm:apply-template-by-row
            template_name = "PagerDuty Create Incident Template"
            and output_col = "incident_payload"
    --> @dm:selectcolumns
            include = "incident_payload"
    ## use REST API to create incident in PagerDuty
    --> @restclient:write
            url="https://api.pagerduty.com/incidents"
            and accept="application/vnd.pagerduty+json;version=2"
            and secret_name = "pagerduty_token2"
            and batch_size =  1
            and method="POST"
            and envelope = '{{incident_payload}}'


Extensions used in this Pipeline

Source Name Extension Type
rn rn
restclient restclient


Artifacts used in this Pipeline

Artifact Type Artifact Name Access
rda-network-stream snow-incidents read
rda-network-stream ebonding-analytics write
dataset pagerduty-svc-enrichment-dict read
dataset pagerduty-priority-enrichment-dict read
dataset pagerduty-urgency-enrichment-dict read
formatting-template PagerDuty Create Incident Template read


Bots used in this Pipeline

@rn:read-stream @rn:write-stats-to-stream @dm:selectcolumns @dm:map @dm:eval @dm:enrich-using-rule-dict @dm:apply-template-by-row @restclient:write