GChat Notifier SDK - v0.8.0
    Preparing search index...

    Class GChatNotifier

    Core SDK class for GChat Notifier. Provide initialization and methods to capture exceptions and latency metrics.

    Index

    Constructors

    Methods

    • Capture and report an exception to Google Chat.

      Parameters

      • error: unknown

        The error to capture (can be an Error instance or any unknown value)

      • Optionalrequest: {
            body?: any;
            headers?: Record<string, string>;
            ip?: string;
            method?: string;
            params?: Record<string, any>;
            query?: Record<string, any>;
            url?: string;
        }

        Optional request context to include in the report

      Returns void

    • Capture and report latency metrics to Google Chat.

      Parameters

      • data: { durationMs: number; endpoint: string; thresholdMs?: number }

        Metrics data including endpoint, duration, and optional threshold

      Returns void

      GChatNotifier.captureLatency({ endpoint: '/api/v1', durationMs: 450, thresholdMs: 300 });
      
    • Initialize the SDK with configuration options. This must be called before any other methods.

      Parameters

      • options: SDKOptions

        Configuration options for the SDK

      Returns void

      GChatNotifier.init({ webhookUrl: '...' });
      
    • Check if the SDK has been initialized

      Returns boolean

    • Run a function with an isolated scope for adding context. Any tags or extra data set within the callback will only apply to events captured inside that callback.

      Parameters

      • fn: (scope: Scope) => void

        Callback function that receives a Scope instance

      Returns void