@interopio/otel 0.0.53 → 0.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/metrics/factory/factory.js +4 -0
- package/dist/metrics/factory/factory.js.map +1 -1
- package/dist/metrics/metrics/base/types.d.ts +1 -1
- package/dist/metrics/metrics/custom/customGauge.d.ts +11 -0
- package/dist/metrics/metrics/custom/customGauge.js +18 -0
- package/dist/metrics/metrics/custom/customGauge.js.map +1 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ const customUpDownCounter_1 = require("../metrics/custom/customUpDownCounter");
|
|
|
9
9
|
const customObservableGauge_1 = require("../metrics/custom/customObservableGauge");
|
|
10
10
|
const customObservableCounter_1 = require("../metrics/custom/customObservableCounter");
|
|
11
11
|
const customObservableUpDownCounter_1 = require("../metrics/custom/customObservableUpDownCounter");
|
|
12
|
+
const customGauge_1 = require("../metrics/custom/customGauge");
|
|
12
13
|
class MetricsFactory {
|
|
13
14
|
constructor(logger, metricsFactories, meter) {
|
|
14
15
|
this.logger = logger;
|
|
@@ -41,6 +42,9 @@ class MetricsFactory {
|
|
|
41
42
|
else if (metricType === "custom_counter") {
|
|
42
43
|
return new customCounter_1.CustomCounterMetric(metricSettings, this.meter, this.logger);
|
|
43
44
|
}
|
|
45
|
+
else if (metricType === "custom_gauge") {
|
|
46
|
+
return new customGauge_1.CustomGaugeMetric(metricSettings, this.meter, this.logger);
|
|
47
|
+
}
|
|
44
48
|
else if (metricType === "custom_up_down_counter") {
|
|
45
49
|
return new customUpDownCounter_1.CustomUpDownCounterMetric(metricSettings, this.meter, this.logger);
|
|
46
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/metrics/factory/factory.ts"],"names":[],"mappings":";;;AACA,8DAA2E;AAE3E,+CAAkD;AAGlD,mEAAsE;AACtE,uEAA0E;AAC1E,+EAAkF;AAClF,mFAAsF;AACtF,u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C,CAAC;QAC9E,MAAM,UAAU,GAAG,IAAI,iBAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AAnDD,wCAmDC"}
|
|
@@ -31,4 +31,4 @@ export interface Metric {
|
|
|
31
31
|
start(): Promise<void>;
|
|
32
32
|
stop(): Promise<void>;
|
|
33
33
|
}
|
|
34
|
-
export type MetricType = "app_count" | "app_cpu" | "app_crash" | "app_duration" | "app_duration_soft" | "app_error" | "app_memory" | "app_started" | "app_startup" | "app_stopped" | "layout_startup" | "workspace_count" | "workspace_selected" | "workspace_started" | "workspace_startup" | "workspace_stopped" | "platform_error" | "platform_startup" | "system_cpu" | "system_memory" | "custom_observable_gauge" | "custom_observable_counter" | "custom_observable_up_down_counter" | "custom_counter" | "custom_histogram" | "custom_up_down_counter" | "null";
|
|
34
|
+
export type MetricType = "app_count" | "app_cpu" | "app_crash" | "app_duration" | "app_duration_soft" | "app_error" | "app_memory" | "app_started" | "app_startup" | "app_stopped" | "layout_startup" | "workspace_count" | "workspace_selected" | "workspace_started" | "workspace_startup" | "workspace_stopped" | "platform_error" | "platform_startup" | "system_cpu" | "system_memory" | "custom_gauge" | "custom_observable_gauge" | "custom_observable_counter" | "custom_observable_up_down_counter" | "custom_counter" | "custom_histogram" | "custom_up_down_counter" | "null";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Gauge, Meter } from "@opentelemetry/api";
|
|
2
|
+
import { InternalMetricSettings, MetricData } from "../base/types";
|
|
3
|
+
import { MetricBase } from "../base/base";
|
|
4
|
+
import { Logger } from "../../../logger/types";
|
|
5
|
+
export declare class CustomGaugeMetric<TData extends MetricData> extends MetricBase {
|
|
6
|
+
meter: Meter;
|
|
7
|
+
private metric;
|
|
8
|
+
constructor(settings: InternalMetricSettings, meter: Meter, logger: Logger);
|
|
9
|
+
protected createMetricCore(name: string, baseSettings: any): Gauge<TData>;
|
|
10
|
+
record(value: number, data: TData): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomGaugeMetric = void 0;
|
|
4
|
+
const base_1 = require("../base/base");
|
|
5
|
+
class CustomGaugeMetric extends base_1.MetricBase {
|
|
6
|
+
constructor(settings, meter, logger) {
|
|
7
|
+
super(settings, meter, logger);
|
|
8
|
+
this.meter = meter;
|
|
9
|
+
}
|
|
10
|
+
createMetricCore(name, baseSettings) {
|
|
11
|
+
return this.metric = this.meter.createGauge(name, baseSettings);
|
|
12
|
+
}
|
|
13
|
+
record(value, data) {
|
|
14
|
+
this.metric.record(value, Object.assign(Object.assign({}, this.getData()), data));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.CustomGaugeMetric = CustomGaugeMetric;
|
|
18
|
+
//# sourceMappingURL=customGauge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customGauge.js","sourceRoot":"","sources":["../../../../src/metrics/metrics/custom/customGauge.ts"],"names":[],"mappings":";;;AAEA,uCAA0C;AAG1C,MAAa,iBAA4C,SAAQ,iBAAU;IAGvE,YACI,QAAgC,EACzB,KAAY,EACnB,MAAc;QACd,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAFxB,UAAK,GAAL,KAAK,CAAO;IAGvB,CAAC;IAEkB,gBAAgB,CAAC,IAAY,EAAE,YAAiB;QAC/D,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACpE,CAAC;IAEM,MAAM,CAAC,KAAa,EAAE,IAAW;QACpC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,kCAAO,IAAI,CAAC,OAAO,EAAE,GAAK,IAAI,EAAG,CAAC;IAC9D,CAAC;CACJ;AAjBD,8CAiBC"}
|