1.0.0 • Published 10 months ago

bend-shared-utilities v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

bend-shared-utilities

This is a shared utilities package for handling various service integrations.

Description

A shared utilities package that provides various service integrations. Here is a list of our current integrations:

  • PagerDuty

PagerDuty Integration

We use the PagerDuty API to manage incidents. The package uses the @pagerduty/pdjs library for this integration.

Exposed Methods

PagerDutyService Class

This class provides the following methods for interacting with the PagerDuty API:

  • constructor(apiToken, fromEmail): This method initializes the PagerDutyService with the provided API token and email. If no values are provided, it defaults to the values in the environment variables PAGERDUTY_API_TOKEN and PAGERDUTY_FROM_EMAIL.

  • createIncident(title, serviceId, urgency, incident_details): This method creates a new incident in PagerDuty. It takes the following parameters:

    • title: The title of the incident.
    • serviceId: The ID of the service the incident is associated with.
    • urgency: The urgency of the incident. Defaults to "high".
    • incident_details: Additional details about the incident.
  • createIncidentFromErrorLog(errorLog, serviceId, urgency): This method creates a new incident in PagerDuty based on an error log. It takes the following parameters:

    • errorLog: The error log from Mongo DB.
    • serviceId: The ID of the service the incident is associated with.
    • urgency: The urgency of the incident. Defaults to "high".
    • environment: Node Environment.
  • acknowledgeIncident(incidentId): This method acknowledges a given incident in PagerDuty. It takes the incidentId as a parameter.

  • resolveIncident(incidentId): This method resolves a given incident in PagerDuty. It takes the incidentId as a parameter.

Dependencies

  • Node.js version 20.10.0
  • @pagerduty/pdjs version 2.2.4
  • axios version 1.7.7
  • dotenv version 16.4.5

License

MIT

1.0.0

10 months ago