Represents a comprehensive observability service that aggregates various registries including health checks, metrics, and error logging. This class is responsible for managing and initializing these registries, attaching services to them, and integrating them into a unified observability application.

The service leverages an ObservabilityAppManager to orchestrate the express application that serves observability endpoints. It allows for dynamic registration of services to enable monitoring, health checks, and error tracking.

Constructors

  • Initializes the observability service with specified options, setting up health, metrics, and error registries based on those options.

    Parameters

    • options: ObservabilityOptions

      Configuration options for observability, including settings for health checks, metrics collection, and error logging.

    Returns Observability

Properties

Configuration options for observability, including settings for health checks, metrics collection, and error logging.

Accessors

  • Returns Links

    The observability rest api access end points

  • get metrics(): Promise<Response>
  • Returns Promise<Response>

    The metrics of the monitored application

  • get status(): "pass" | "fail" | "warn"
  • Returns "pass" | "fail" | "warn"

    The status of the monitored application

Methods

  • Update or add a check measure. This should be used to inform about the state of resources behind the Component/Microservice, for example states of connections with field devices.

    The new check will be taking into account in the overall health status. The new check will be included in the checks object with the key "component:measure". If this key already exists, the componentId of the check parameter will be checked, if there is a check with the same componentId in the array, the check will be updated, in other case the new check will be added to the existing array.

    The maximum number external checks is 100

    Parameters

    • component: string

      component identification

    • measure: string

      measure identification

    • check: Check<any>

      check to be updated or included

    Returns boolean

    true, if the check has been updated

  • Adds a timestamped note to the health status.

    Parameters

    • note: string

      Note to be added.

    Returns void

  • Attaches a new service to be monitored under the observability framework. Services are components of your application that you wish to monitor for health, track errors for, and collect metrics on.

    Parameters

    • observable: Observable

      The service to attach to observability.

    Returns void

  • Close the observability service

    Returns Promise<void>

  • Adds an error to the registry, converting it to a structured format.

    Parameters

    • error: Crash | Multi | Error

      The error to register.

    Returns void

  • Start the observability service

    Returns Promise<void>

  • Stop the observability service

    Returns Promise<void>