pandora-metrics
Version:
## Overview
80 lines (79 loc) • 2.58 kB
TypeScript
/**
* A metric name with the ability to include semantic tags.
*
* This replaces the previous style where metric names where strictly
* dot-separated strings.
*
*/
import { MetricLevel } from './MetricLevel';
export declare class MetricName {
key: string;
tags: Object;
level: MetricLevel;
static EMPTY: MetricName;
static EMPTY_TAGS: {};
static TAGS_SPLIT: string;
static NAME_JOIN: string;
static TAGS_JOIN: string;
static TAGS_CONCAT: string;
constructor(key?: string, tags?: Object, level?: MetricLevel);
getKey(): string;
getTags(): Object;
/**
* Return the level of this metric
* The level indicates the importance of the metric
*
* @return when level tag do not exist or illegal tag, will return null.
*/
getMetricLevel(): MetricLevel;
/**
* Metric level can be changed during runtime
* @param level the level to set
*/
setLevel(level: MetricLevel): this;
/**
* Build a new metric name using the specific path components.
*
* @param parts Path of the new metric name.
* @return A newly created metric name with the specified path.
*
*/
static build(...parts: string[]): MetricName;
/**
* Join the specified set of metric names.
*
* @param parts Multiple metric names to join using the separator.
* @return A newly created metric name which has the name of the specified
* parts and includes all tags of all child metric names.
*/
static join(...parts: MetricName[]): MetricName;
private static buildName(names);
/**
* Build the MetricName that is this with another path appended to it.
*
* The new MetricName inherits the tags of this one.
*
* @param p The extra path element to add to the new metric.
* @param inheritTags if true, tags will be inherited
* @return A new metric name relative to the original by the path specified
* in p.
*/
resolve(p: string, inheritTags?: boolean): MetricName;
/**
* Same as {@link #tagged(Map)}, but takes a variadic list
* of arguments.
*
* @see #tagged(Map)
* @param pairs An even list of strings acting as key-value pairs.
* @return A newly created metric name with the specified tags associated
* with it.
*/
tagged(...pairs: any[]): MetricName;
getNameKey(): string;
toString(): string;
/**
* 从字符串解析为对象
* @param key
*/
static parseKey(key: string): MetricName;
}