/**
 * Copyright 2024 Mytra Control S.L. All rights reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
 * or at https://opensource.org/licenses/MIT.
 */
import { Layer } from '@mdf.js/core';
import { LoggerInstance } from '@mdf.js/logger';
import { AggregatorRegistry, Metric, MetricObjectWithValues, MetricValue, PrometheusContentType, Registry } from 'prom-client';
import * as Metrics from '../types';
/**
 * MetricsAggregator class manages all the metrics for this artifact,
 * integrating with Prometheus for metrics collection and aggregation.
 */
export declare class Aggregator {
    private readonly logger;
    private readonly port?;
    /** Default prom-client registry for collecting default metrics */
    private readonly defaultRegistry;
    /** Registry for storing custom metrics */
    private _registry;
    /** Map to keep track of registered services */
    private readonly components;
    /**
     * Create a new instance of MetricsAggregator
     * @param logger - Instance for logging
     * @param port - Optional AggregatorRegistry for cluster metrics
     */
    constructor(logger: LoggerInstance, port?: AggregatorRegistry<PrometheusContentType> | undefined);
    /**
     * Update the aggregator registry based on the current environment and node type
     */
    private updateAggregatorRegistry;
    /**
     * Add default metrics to the registry if they are not already present
     * @param register - Registry to add the default metrics
     */
    private collectDefaultMetrics;
    /**
     * Register a service or a list of services in the aggregator
     * @param service - Service to register in the aggregator
     */
    register(service: Layer.App.Service | Layer.App.Service[]): void;
    /** Return the registry used by the aggregator */
    get registry(): Registry;
    /** Return the metrics in text/plain format */
    metricsText(): Promise<Metrics.Response>;
    /** Return the actual metrics in JSON format */
    metricsJSON(): Promise<Metrics.Response>;
    /**
     * Retrieves a single metric by name from the registry.
     * @param name - The name of the metric to retrieve
     */
    getMetric(name: string): Metric | undefined;
    /**
     * Retrieves a single metric value in Prometheus format by name.
     * @param name - The name of the metric to retrieve
     */
    getMetricAsString(name: string): Promise<string>;
    /**
     * Retrieves a single metric value in JSON format by name.
     * @param name - The name of the metric to retrieve
     */
    getMetricAsJSON(name: string): Promise<MetricObjectWithValues<MetricValue<string>> | undefined>;
    /** Clear the registry */
    clear(): void;
}
//# sourceMappingURL=Aggregator.d.ts.map