@google-cloud/opentelemetry-cloud-monitoring-exporter
Version:
OpenTelemetry Google Cloud Monitoring Exporter allows the user to send collected metrics to Google Cloud Monitoring.
47 lines (46 loc) • 1.85 kB
TypeScript
import { MetricExporter as IMetricExporter, MetricRecord } from '@opentelemetry/metrics';
import { ExportResult } from '@opentelemetry/core';
import { ExporterOptions } from './external-types';
/**
* Format and sends metrics information to Google Cloud Monitoring.
*/
export declare class MetricExporter implements IMetricExporter {
private _projectId;
private readonly _metricPrefix;
private readonly _displayNamePrefix;
private readonly _logger;
private readonly _auth;
private readonly _startTime;
static readonly DEFAULT_DISPLAY_NAME_PREFIX: string;
static readonly CUSTOM_OPENTELEMETRY_DOMAIN: string;
private registeredMetricDescriptors;
private static readonly _monitoring;
constructor(options?: ExporterOptions);
/**
* Saves the current values of all exported {@link MetricRecord}s so that
* they can be pulled by the Google Cloud Monitoring backend.
*
* @param metrics Metrics to be sent to the Google Cloud Monitoring backend
* @param cb result callback to be called on finish
*/
export(metrics: MetricRecord[], cb: (result: ExportResult) => void): Promise<void>;
shutdown(): Promise<void>;
/**
* Returns true if the given metricDescriptor is successfully registered to
* Google Cloud Monitoring, or the exact same metric has already been
* registered. Returns false otherwise.
* @param metricDescriptor The OpenTelemetry MetricDescriptor.
*/
private _registerMetricDescriptor;
/**
* Creates a new metric descriptor.
* @param metricDescriptor The OpenTelemetry MetricDescriptor.
*/
private _createMetricDescriptor;
private _sendTimeSeries;
/**
* Gets the Google Application Credentials from the environment variables
* and authenticates the client.
*/
private _authorize;
}