@opentelemetry/exporter-metrics-otlp-http
Advanced tools
Comparing version 0.28.0 to 0.29.0
export * from './platform'; | ||
export * from './OTLPMetricExporterOptions'; | ||
export * from './OTLPMetricExporterBase'; | ||
export { toOTLPExportMetricServiceRequest } from './transformMetrics'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -19,3 +19,2 @@ /* | ||
export * from './OTLPMetricExporterBase'; | ||
export { toOTLPExportMetricServiceRequest } from './transformMetrics'; | ||
//# sourceMappingURL=index.js.map |
import { ExportResult } from '@opentelemetry/core'; | ||
import { AggregationTemporality, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; | ||
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions'; | ||
import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base'; | ||
export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest>> implements PushMetricExporter { | ||
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
export declare const CumulativeTemporalitySelector: AggregationTemporalitySelector; | ||
export declare const DeltaTemporalitySelector: AggregationTemporalitySelector; | ||
export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, IExportMetricsServiceRequest>> implements PushMetricExporter { | ||
_otlpExporter: T; | ||
protected _preferredAggregationTemporality: AggregationTemporality; | ||
protected _aggregationTemporalitySelector: AggregationTemporalitySelector; | ||
constructor(exporter: T, config?: OTLPMetricExporterOptions); | ||
@@ -13,4 +15,4 @@ export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void; | ||
forceFlush(): Promise<void>; | ||
getPreferredAggregationTemporality(): AggregationTemporality; | ||
selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality; | ||
} | ||
//# sourceMappingURL=OTLPMetricExporterBase.d.ts.map |
@@ -52,10 +52,28 @@ /* | ||
}; | ||
import { AggregationTemporality } from '@opentelemetry/sdk-metrics-base'; | ||
import { AggregationTemporality, InstrumentType } from '@opentelemetry/sdk-metrics-base'; | ||
import { defaultOptions } from './OTLPMetricExporterOptions'; | ||
export var CumulativeTemporalitySelector = function () { return AggregationTemporality.CUMULATIVE; }; | ||
export var DeltaTemporalitySelector = function (instrumentType) { | ||
switch (instrumentType) { | ||
case InstrumentType.COUNTER: | ||
case InstrumentType.OBSERVABLE_COUNTER: | ||
case InstrumentType.HISTOGRAM: | ||
case InstrumentType.OBSERVABLE_GAUGE: | ||
return AggregationTemporality.DELTA; | ||
case InstrumentType.UP_DOWN_COUNTER: | ||
case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: | ||
return AggregationTemporality.CUMULATIVE; | ||
} | ||
}; | ||
function chooseTemporalitySelector(temporalityPreference) { | ||
if (temporalityPreference === AggregationTemporality.DELTA) { | ||
return DeltaTemporalitySelector; | ||
} | ||
return CumulativeTemporalitySelector; | ||
} | ||
var OTLPMetricExporterBase = /** @class */ (function () { | ||
function OTLPMetricExporterBase(exporter, config) { | ||
if (config === void 0) { config = defaultOptions; } | ||
var _a; | ||
this._otlpExporter = exporter; | ||
this._preferredAggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : AggregationTemporality.CUMULATIVE; | ||
this._aggregationTemporalitySelector = chooseTemporalitySelector(config.temporalityPreference); | ||
} | ||
@@ -80,4 +98,4 @@ OTLPMetricExporterBase.prototype.export = function (metrics, resultCallback) { | ||
}; | ||
OTLPMetricExporterBase.prototype.getPreferredAggregationTemporality = function () { | ||
return this._preferredAggregationTemporality; | ||
OTLPMetricExporterBase.prototype.selectAggregationTemporality = function (instrumentType) { | ||
return this._aggregationTemporalitySelector(instrumentType); | ||
}; | ||
@@ -84,0 +102,0 @@ return OTLPMetricExporterBase; |
import { AggregationTemporality } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; | ||
export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase { | ||
aggregationTemporality?: AggregationTemporality; | ||
temporalityPreference?: AggregationTemporality; | ||
} | ||
export declare const defaultExporterTemporality = AggregationTemporality.CUMULATIVE; | ||
export declare const defaultOptions: { | ||
aggregationTemporality: AggregationTemporality; | ||
temporalityPreference: AggregationTemporality; | ||
}; | ||
//# sourceMappingURL=OTLPMetricExporterOptions.d.ts.map |
@@ -18,3 +18,3 @@ /* | ||
export var defaultExporterTemporality = AggregationTemporality.CUMULATIVE; | ||
export var defaultOptions = { aggregationTemporality: defaultExporterTemporality }; | ||
export var defaultOptions = { temporalityPreference: defaultExporterTemporality }; | ||
//# sourceMappingURL=OTLPMetricExporterOptions.js.map |
@@ -1,11 +0,10 @@ | ||
import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; | ||
import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions'; | ||
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; | ||
import { OTLPExporterBrowserBase, OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; | ||
declare class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> { | ||
protected readonly _aggregationTemporality: AggregationTemporality; | ||
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
declare class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, IExportMetricsServiceRequest> { | ||
constructor(config?: OTLPMetricExporterOptions & OTLPExporterConfigBase); | ||
getDefaultUrl(config: OTLPExporterConfigBase): string; | ||
convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; | ||
convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest; | ||
} | ||
@@ -12,0 +11,0 @@ /** |
@@ -31,9 +31,9 @@ /* | ||
})(); | ||
import { toOTLPExportMetricServiceRequest } from '../../transformMetrics'; | ||
import { baggageUtils, getEnv } from '@opentelemetry/core'; | ||
import { defaultExporterTemporality, defaultOptions } from '../../OTLPMetricExporterOptions'; | ||
import { defaultOptions } from '../../OTLPMetricExporterOptions'; | ||
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; | ||
import { appendResourcePathToUrlIfNotPresent, OTLPExporterBrowserBase } from '@opentelemetry/otlp-exporter-base'; | ||
var DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; | ||
var DEFAULT_COLLECTOR_URL = "http://localhost:4318" + DEFAULT_COLLECTOR_RESOURCE_PATH; | ||
import { OTLPExporterBrowserBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from '@opentelemetry/otlp-exporter-base'; | ||
import { createExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
var DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics'; | ||
var DEFAULT_COLLECTOR_URL = "http://localhost:4318/" + DEFAULT_COLLECTOR_RESOURCE_PATH; | ||
var OTLPExporterBrowserProxy = /** @class */ (function (_super) { | ||
@@ -43,6 +43,4 @@ __extends(OTLPExporterBrowserProxy, _super); | ||
if (config === void 0) { config = defaultOptions; } | ||
var _a; | ||
var _this = _super.call(this, config) || this; | ||
_this._headers = Object.assign(_this._headers, baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS)); | ||
_this._aggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : defaultExporterTemporality; | ||
return _this; | ||
@@ -54,9 +52,9 @@ } | ||
: getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 | ||
? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | ||
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
}; | ||
OTLPExporterBrowserProxy.prototype.convert = function (metrics) { | ||
return toOTLPExportMetricServiceRequest(metrics[0], this._aggregationTemporality, this); | ||
return createExportMetricsServiceRequest(metrics); | ||
}; | ||
@@ -63,0 +61,0 @@ return OTLPExporterBrowserProxy; |
@@ -1,10 +0,9 @@ | ||
import { ResourceMetrics, AggregationTemporality } from '@opentelemetry/sdk-metrics-base'; | ||
import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; | ||
import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions'; | ||
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; | ||
import { OTLPExporterNodeBase, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; | ||
declare class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> { | ||
protected readonly _aggregationTemporality: AggregationTemporality; | ||
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
declare class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> { | ||
constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions); | ||
convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; | ||
convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest; | ||
getDefaultUrl(config: OTLPExporterNodeConfigBase): string; | ||
@@ -11,0 +10,0 @@ } |
@@ -31,9 +31,9 @@ /* | ||
})(); | ||
import { toOTLPExportMetricServiceRequest } from '../../transformMetrics'; | ||
import { getEnv, baggageUtils } from '@opentelemetry/core'; | ||
import { defaultExporterTemporality, defaultOptions } from '../../OTLPMetricExporterOptions'; | ||
import { defaultOptions } from '../../OTLPMetricExporterOptions'; | ||
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; | ||
import { appendResourcePathToUrlIfNotPresent, OTLPExporterNodeBase } from '@opentelemetry/otlp-exporter-base'; | ||
var DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; | ||
var DEFAULT_COLLECTOR_URL = "http://localhost:4318" + DEFAULT_COLLECTOR_RESOURCE_PATH; | ||
import { OTLPExporterNodeBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from '@opentelemetry/otlp-exporter-base'; | ||
import { createExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
var DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics'; | ||
var DEFAULT_COLLECTOR_URL = "http://localhost:4318/" + DEFAULT_COLLECTOR_RESOURCE_PATH; | ||
var OTLPExporterNodeProxy = /** @class */ (function (_super) { | ||
@@ -43,10 +43,8 @@ __extends(OTLPExporterNodeProxy, _super); | ||
if (config === void 0) { config = defaultOptions; } | ||
var _a; | ||
var _this = _super.call(this, config) || this; | ||
_this.headers = Object.assign(_this.headers, baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS)); | ||
_this._aggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : defaultExporterTemporality; | ||
return _this; | ||
} | ||
OTLPExporterNodeProxy.prototype.convert = function (metrics) { | ||
return toOTLPExportMetricServiceRequest(metrics[0], this._aggregationTemporality, this); | ||
return createExportMetricsServiceRequest(metrics); | ||
}; | ||
@@ -57,5 +55,5 @@ OTLPExporterNodeProxy.prototype.getDefaultUrl = function (config) { | ||
: getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 | ||
? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | ||
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -62,0 +60,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.28.0"; | ||
export declare const VERSION = "0.29.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export var VERSION = '0.28.0'; | ||
export var VERSION = '0.29.0'; | ||
//# sourceMappingURL=version.js.map |
export * from './platform'; | ||
export * from './OTLPMetricExporterOptions'; | ||
export * from './OTLPMetricExporterBase'; | ||
export { toOTLPExportMetricServiceRequest } from './transformMetrics'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -19,3 +19,2 @@ /* | ||
export * from './OTLPMetricExporterBase'; | ||
export { toOTLPExportMetricServiceRequest } from './transformMetrics'; | ||
//# sourceMappingURL=index.js.map |
import { ExportResult } from '@opentelemetry/core'; | ||
import { AggregationTemporality, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; | ||
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions'; | ||
import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base'; | ||
export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest>> implements PushMetricExporter { | ||
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
export declare const CumulativeTemporalitySelector: AggregationTemporalitySelector; | ||
export declare const DeltaTemporalitySelector: AggregationTemporalitySelector; | ||
export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, IExportMetricsServiceRequest>> implements PushMetricExporter { | ||
_otlpExporter: T; | ||
protected _preferredAggregationTemporality: AggregationTemporality; | ||
protected _aggregationTemporalitySelector: AggregationTemporalitySelector; | ||
constructor(exporter: T, config?: OTLPMetricExporterOptions); | ||
@@ -13,4 +15,4 @@ export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void; | ||
forceFlush(): Promise<void>; | ||
getPreferredAggregationTemporality(): AggregationTemporality; | ||
selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality; | ||
} | ||
//# sourceMappingURL=OTLPMetricExporterBase.d.ts.map |
@@ -16,9 +16,27 @@ /* | ||
*/ | ||
import { AggregationTemporality } from '@opentelemetry/sdk-metrics-base'; | ||
import { AggregationTemporality, InstrumentType } from '@opentelemetry/sdk-metrics-base'; | ||
import { defaultOptions } from './OTLPMetricExporterOptions'; | ||
export const CumulativeTemporalitySelector = () => AggregationTemporality.CUMULATIVE; | ||
export const DeltaTemporalitySelector = (instrumentType) => { | ||
switch (instrumentType) { | ||
case InstrumentType.COUNTER: | ||
case InstrumentType.OBSERVABLE_COUNTER: | ||
case InstrumentType.HISTOGRAM: | ||
case InstrumentType.OBSERVABLE_GAUGE: | ||
return AggregationTemporality.DELTA; | ||
case InstrumentType.UP_DOWN_COUNTER: | ||
case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: | ||
return AggregationTemporality.CUMULATIVE; | ||
} | ||
}; | ||
function chooseTemporalitySelector(temporalityPreference) { | ||
if (temporalityPreference === AggregationTemporality.DELTA) { | ||
return DeltaTemporalitySelector; | ||
} | ||
return CumulativeTemporalitySelector; | ||
} | ||
export class OTLPMetricExporterBase { | ||
constructor(exporter, config = defaultOptions) { | ||
var _a; | ||
this._otlpExporter = exporter; | ||
this._preferredAggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : AggregationTemporality.CUMULATIVE; | ||
this._aggregationTemporalitySelector = chooseTemporalitySelector(config.temporalityPreference); | ||
} | ||
@@ -34,6 +52,6 @@ export(metrics, resultCallback) { | ||
} | ||
getPreferredAggregationTemporality() { | ||
return this._preferredAggregationTemporality; | ||
selectAggregationTemporality(instrumentType) { | ||
return this._aggregationTemporalitySelector(instrumentType); | ||
} | ||
} | ||
//# sourceMappingURL=OTLPMetricExporterBase.js.map |
import { AggregationTemporality } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; | ||
export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase { | ||
aggregationTemporality?: AggregationTemporality; | ||
temporalityPreference?: AggregationTemporality; | ||
} | ||
export declare const defaultExporterTemporality = AggregationTemporality.CUMULATIVE; | ||
export declare const defaultOptions: { | ||
aggregationTemporality: AggregationTemporality; | ||
temporalityPreference: AggregationTemporality; | ||
}; | ||
//# sourceMappingURL=OTLPMetricExporterOptions.d.ts.map |
@@ -18,3 +18,3 @@ /* | ||
export const defaultExporterTemporality = AggregationTemporality.CUMULATIVE; | ||
export const defaultOptions = { aggregationTemporality: defaultExporterTemporality }; | ||
export const defaultOptions = { temporalityPreference: defaultExporterTemporality }; | ||
//# sourceMappingURL=OTLPMetricExporterOptions.js.map |
@@ -1,11 +0,10 @@ | ||
import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; | ||
import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions'; | ||
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; | ||
import { OTLPExporterBrowserBase, OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; | ||
declare class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> { | ||
protected readonly _aggregationTemporality: AggregationTemporality; | ||
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
declare class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, IExportMetricsServiceRequest> { | ||
constructor(config?: OTLPMetricExporterOptions & OTLPExporterConfigBase); | ||
getDefaultUrl(config: OTLPExporterConfigBase): string; | ||
convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; | ||
convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest; | ||
} | ||
@@ -12,0 +11,0 @@ /** |
@@ -16,15 +16,13 @@ /* | ||
*/ | ||
import { toOTLPExportMetricServiceRequest } from '../../transformMetrics'; | ||
import { baggageUtils, getEnv } from '@opentelemetry/core'; | ||
import { defaultExporterTemporality, defaultOptions } from '../../OTLPMetricExporterOptions'; | ||
import { defaultOptions } from '../../OTLPMetricExporterOptions'; | ||
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; | ||
import { appendResourcePathToUrlIfNotPresent, OTLPExporterBrowserBase } from '@opentelemetry/otlp-exporter-base'; | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
import { OTLPExporterBrowserBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from '@opentelemetry/otlp-exporter-base'; | ||
import { createExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase { | ||
constructor(config = defaultOptions) { | ||
var _a; | ||
super(config); | ||
this._headers = Object.assign(this._headers, baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS)); | ||
this._aggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : defaultExporterTemporality; | ||
} | ||
@@ -35,9 +33,9 @@ getDefaultUrl(config) { | ||
: getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 | ||
? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | ||
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
} | ||
convert(metrics) { | ||
return toOTLPExportMetricServiceRequest(metrics[0], this._aggregationTemporality, this); | ||
return createExportMetricsServiceRequest(metrics); | ||
} | ||
@@ -44,0 +42,0 @@ } |
@@ -1,10 +0,9 @@ | ||
import { ResourceMetrics, AggregationTemporality } from '@opentelemetry/sdk-metrics-base'; | ||
import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; | ||
import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions'; | ||
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; | ||
import { OTLPExporterNodeBase, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; | ||
declare class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> { | ||
protected readonly _aggregationTemporality: AggregationTemporality; | ||
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
declare class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> { | ||
constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions); | ||
convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; | ||
convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest; | ||
getDefaultUrl(config: OTLPExporterNodeConfigBase): string; | ||
@@ -11,0 +10,0 @@ } |
@@ -16,18 +16,16 @@ /* | ||
*/ | ||
import { toOTLPExportMetricServiceRequest } from '../../transformMetrics'; | ||
import { getEnv, baggageUtils } from '@opentelemetry/core'; | ||
import { defaultExporterTemporality, defaultOptions } from '../../OTLPMetricExporterOptions'; | ||
import { defaultOptions } from '../../OTLPMetricExporterOptions'; | ||
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; | ||
import { appendResourcePathToUrlIfNotPresent, OTLPExporterNodeBase } from '@opentelemetry/otlp-exporter-base'; | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
import { OTLPExporterNodeBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from '@opentelemetry/otlp-exporter-base'; | ||
import { createExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
class OTLPExporterNodeProxy extends OTLPExporterNodeBase { | ||
constructor(config = defaultOptions) { | ||
var _a; | ||
super(config); | ||
this.headers = Object.assign(this.headers, baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS)); | ||
this._aggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : defaultExporterTemporality; | ||
} | ||
convert(metrics) { | ||
return toOTLPExportMetricServiceRequest(metrics[0], this._aggregationTemporality, this); | ||
return createExportMetricsServiceRequest(metrics); | ||
} | ||
@@ -38,5 +36,5 @@ getDefaultUrl(config) { | ||
: getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 | ||
? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | ||
? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
? appendResourcePathToUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -43,0 +41,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.28.0"; | ||
export declare const VERSION = "0.29.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export const VERSION = '0.28.0'; | ||
export const VERSION = '0.29.0'; | ||
//# sourceMappingURL=version.js.map |
export * from './platform'; | ||
export * from './OTLPMetricExporterOptions'; | ||
export * from './OTLPMetricExporterBase'; | ||
export { toOTLPExportMetricServiceRequest } from './transformMetrics'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -28,8 +28,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toOTLPExportMetricServiceRequest = void 0; | ||
__exportStar(require("./platform"), exports); | ||
__exportStar(require("./OTLPMetricExporterOptions"), exports); | ||
__exportStar(require("./OTLPMetricExporterBase"), exports); | ||
var transformMetrics_1 = require("./transformMetrics"); | ||
Object.defineProperty(exports, "toOTLPExportMetricServiceRequest", { enumerable: true, get: function () { return transformMetrics_1.toOTLPExportMetricServiceRequest; } }); | ||
//# sourceMappingURL=index.js.map |
import { ExportResult } from '@opentelemetry/core'; | ||
import { AggregationTemporality, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; | ||
import { AggregationTemporality, AggregationTemporalitySelector, InstrumentType, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions'; | ||
import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base'; | ||
export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest>> implements PushMetricExporter { | ||
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
export declare const CumulativeTemporalitySelector: AggregationTemporalitySelector; | ||
export declare const DeltaTemporalitySelector: AggregationTemporalitySelector; | ||
export declare class OTLPMetricExporterBase<T extends OTLPExporterBase<OTLPMetricExporterOptions, ResourceMetrics, IExportMetricsServiceRequest>> implements PushMetricExporter { | ||
_otlpExporter: T; | ||
protected _preferredAggregationTemporality: AggregationTemporality; | ||
protected _aggregationTemporalitySelector: AggregationTemporalitySelector; | ||
constructor(exporter: T, config?: OTLPMetricExporterOptions); | ||
@@ -13,4 +15,4 @@ export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void; | ||
forceFlush(): Promise<void>; | ||
getPreferredAggregationTemporality(): AggregationTemporality; | ||
selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality; | ||
} | ||
//# sourceMappingURL=OTLPMetricExporterBase.d.ts.map |
@@ -18,10 +18,30 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.OTLPMetricExporterBase = void 0; | ||
exports.OTLPMetricExporterBase = exports.DeltaTemporalitySelector = exports.CumulativeTemporalitySelector = void 0; | ||
const sdk_metrics_base_1 = require("@opentelemetry/sdk-metrics-base"); | ||
const OTLPMetricExporterOptions_1 = require("./OTLPMetricExporterOptions"); | ||
const CumulativeTemporalitySelector = () => sdk_metrics_base_1.AggregationTemporality.CUMULATIVE; | ||
exports.CumulativeTemporalitySelector = CumulativeTemporalitySelector; | ||
const DeltaTemporalitySelector = (instrumentType) => { | ||
switch (instrumentType) { | ||
case sdk_metrics_base_1.InstrumentType.COUNTER: | ||
case sdk_metrics_base_1.InstrumentType.OBSERVABLE_COUNTER: | ||
case sdk_metrics_base_1.InstrumentType.HISTOGRAM: | ||
case sdk_metrics_base_1.InstrumentType.OBSERVABLE_GAUGE: | ||
return sdk_metrics_base_1.AggregationTemporality.DELTA; | ||
case sdk_metrics_base_1.InstrumentType.UP_DOWN_COUNTER: | ||
case sdk_metrics_base_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: | ||
return sdk_metrics_base_1.AggregationTemporality.CUMULATIVE; | ||
} | ||
}; | ||
exports.DeltaTemporalitySelector = DeltaTemporalitySelector; | ||
function chooseTemporalitySelector(temporalityPreference) { | ||
if (temporalityPreference === sdk_metrics_base_1.AggregationTemporality.DELTA) { | ||
return exports.DeltaTemporalitySelector; | ||
} | ||
return exports.CumulativeTemporalitySelector; | ||
} | ||
class OTLPMetricExporterBase { | ||
constructor(exporter, config = OTLPMetricExporterOptions_1.defaultOptions) { | ||
var _a; | ||
this._otlpExporter = exporter; | ||
this._preferredAggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : sdk_metrics_base_1.AggregationTemporality.CUMULATIVE; | ||
this._aggregationTemporalitySelector = chooseTemporalitySelector(config.temporalityPreference); | ||
} | ||
@@ -37,4 +57,4 @@ export(metrics, resultCallback) { | ||
} | ||
getPreferredAggregationTemporality() { | ||
return this._preferredAggregationTemporality; | ||
selectAggregationTemporality(instrumentType) { | ||
return this._aggregationTemporalitySelector(instrumentType); | ||
} | ||
@@ -41,0 +61,0 @@ } |
import { AggregationTemporality } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; | ||
export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase { | ||
aggregationTemporality?: AggregationTemporality; | ||
temporalityPreference?: AggregationTemporality; | ||
} | ||
export declare const defaultExporterTemporality = AggregationTemporality.CUMULATIVE; | ||
export declare const defaultOptions: { | ||
aggregationTemporality: AggregationTemporality; | ||
temporalityPreference: AggregationTemporality; | ||
}; | ||
//# sourceMappingURL=OTLPMetricExporterOptions.d.ts.map |
@@ -21,3 +21,3 @@ "use strict"; | ||
exports.defaultExporterTemporality = sdk_metrics_base_1.AggregationTemporality.CUMULATIVE; | ||
exports.defaultOptions = { aggregationTemporality: exports.defaultExporterTemporality }; | ||
exports.defaultOptions = { temporalityPreference: exports.defaultExporterTemporality }; | ||
//# sourceMappingURL=OTLPMetricExporterOptions.js.map |
@@ -1,11 +0,10 @@ | ||
import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; | ||
import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions'; | ||
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; | ||
import { OTLPExporterBrowserBase, OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; | ||
declare class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> { | ||
protected readonly _aggregationTemporality: AggregationTemporality; | ||
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
declare class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase<ResourceMetrics, IExportMetricsServiceRequest> { | ||
constructor(config?: OTLPMetricExporterOptions & OTLPExporterConfigBase); | ||
getDefaultUrl(config: OTLPExporterConfigBase): string; | ||
convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; | ||
convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest; | ||
} | ||
@@ -12,0 +11,0 @@ /** |
@@ -19,3 +19,2 @@ "use strict"; | ||
exports.OTLPMetricExporter = void 0; | ||
const transformMetrics_1 = require("../../transformMetrics"); | ||
const core_1 = require("@opentelemetry/core"); | ||
@@ -25,10 +24,9 @@ const OTLPMetricExporterOptions_1 = require("../../OTLPMetricExporterOptions"); | ||
const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base"); | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
const otlp_transformer_1 = require("@opentelemetry/otlp-transformer"); | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
class OTLPExporterBrowserProxy extends otlp_exporter_base_1.OTLPExporterBrowserBase { | ||
constructor(config = OTLPMetricExporterOptions_1.defaultOptions) { | ||
var _a; | ||
super(config); | ||
this._headers = Object.assign(this._headers, core_1.baggageUtils.parseKeyPairsIntoRecord((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_HEADERS)); | ||
this._aggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : OTLPMetricExporterOptions_1.defaultExporterTemporality; | ||
} | ||
@@ -39,9 +37,9 @@ getDefaultUrl(config) { | ||
: (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 | ||
? (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | ||
? (0, otlp_exporter_base_1.appendRootPathToUrlIfNeeded)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? (0, otlp_exporter_base_1.appendResourcePathToUrlIfNotPresent)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
? (0, otlp_exporter_base_1.appendResourcePathToUrl)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
} | ||
convert(metrics) { | ||
return (0, transformMetrics_1.toOTLPExportMetricServiceRequest)(metrics[0], this._aggregationTemporality, this); | ||
return (0, otlp_transformer_1.createExportMetricsServiceRequest)(metrics); | ||
} | ||
@@ -48,0 +46,0 @@ } |
@@ -1,10 +0,9 @@ | ||
import { ResourceMetrics, AggregationTemporality } from '@opentelemetry/sdk-metrics-base'; | ||
import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; | ||
import { ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions'; | ||
import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; | ||
import { OTLPExporterNodeBase, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; | ||
declare class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest> { | ||
protected readonly _aggregationTemporality: AggregationTemporality; | ||
import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
declare class OTLPExporterNodeProxy extends OTLPExporterNodeBase<ResourceMetrics, IExportMetricsServiceRequest> { | ||
constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions); | ||
convert(metrics: ResourceMetrics[]): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; | ||
convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest; | ||
getDefaultUrl(config: OTLPExporterNodeConfigBase): string; | ||
@@ -11,0 +10,0 @@ } |
@@ -19,3 +19,2 @@ "use strict"; | ||
exports.OTLPMetricExporter = void 0; | ||
const transformMetrics_1 = require("../../transformMetrics"); | ||
const core_1 = require("@opentelemetry/core"); | ||
@@ -25,13 +24,12 @@ const OTLPMetricExporterOptions_1 = require("../../OTLPMetricExporterOptions"); | ||
const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base"); | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
const otlp_transformer_1 = require("@opentelemetry/otlp-transformer"); | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/metrics'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
class OTLPExporterNodeProxy extends otlp_exporter_base_1.OTLPExporterNodeBase { | ||
constructor(config = OTLPMetricExporterOptions_1.defaultOptions) { | ||
var _a; | ||
super(config); | ||
this.headers = Object.assign(this.headers, core_1.baggageUtils.parseKeyPairsIntoRecord((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_HEADERS)); | ||
this._aggregationTemporality = (_a = config.aggregationTemporality) !== null && _a !== void 0 ? _a : OTLPMetricExporterOptions_1.defaultExporterTemporality; | ||
} | ||
convert(metrics) { | ||
return (0, transformMetrics_1.toOTLPExportMetricServiceRequest)(metrics[0], this._aggregationTemporality, this); | ||
return (0, otlp_transformer_1.createExportMetricsServiceRequest)(metrics); | ||
} | ||
@@ -42,5 +40,5 @@ getDefaultUrl(config) { | ||
: (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 | ||
? (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | ||
? (0, otlp_exporter_base_1.appendRootPathToUrlIfNeeded)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? (0, otlp_exporter_base_1.appendResourcePathToUrlIfNotPresent)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
? (0, otlp_exporter_base_1.appendResourcePathToUrl)((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -47,0 +45,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.28.0"; | ||
export declare const VERSION = "0.29.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.28.0'; | ||
exports.VERSION = '0.29.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/exporter-metrics-otlp-http", | ||
"version": "0.28.0", | ||
"version": "0.29.0", | ||
"description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector", | ||
@@ -87,3 +87,3 @@ "main": "build/src/index.js", | ||
"ts-loader": "8.3.0", | ||
"ts-mocha": "8.0.0", | ||
"ts-mocha": "9.0.2", | ||
"typescript": "4.4.4", | ||
@@ -98,10 +98,10 @@ "webpack": "4.46.0", | ||
"dependencies": { | ||
"@opentelemetry/api-metrics": "0.28.0", | ||
"@opentelemetry/core": "1.2.0", | ||
"@opentelemetry/exporter-trace-otlp-http": "0.28.0", | ||
"@opentelemetry/otlp-exporter-base": "0.28.0", | ||
"@opentelemetry/resources": "1.2.0", | ||
"@opentelemetry/sdk-metrics-base": "0.28.0" | ||
"@opentelemetry/api-metrics": "0.29.0", | ||
"@opentelemetry/core": "1.3.0", | ||
"@opentelemetry/otlp-exporter-base": "0.29.0", | ||
"@opentelemetry/otlp-transformer": "0.29.0", | ||
"@opentelemetry/resources": "1.3.0", | ||
"@opentelemetry/sdk-metrics-base": "0.29.0" | ||
}, | ||
"gitHead": "a0a670a03fd35b0799bee8cc466f79e93b5b6dd2" | ||
"gitHead": "eda0b092db484855ded8b4837ba7fc19a377c5a7" | ||
} |
@@ -6,3 +6,4 @@ # OpenTelemetry Collector Metrics Exporter for web and node | ||
This module provides exporter for web and node to be used with [opentelemetry-collector][opentelemetry-collector-url] - last tested with version **0.25.0**. | ||
This module provides exporter for web and node to be used with [opentelemetry-collector][opentelemetry-collector-url]. | ||
Compatible with [opentelemetry-collector][opentelemetry-collector-url] versions `>=0.48 <=0.50`. | ||
@@ -26,3 +27,3 @@ ## Installation | ||
```js | ||
import { MeterProvider } from '@opentelemetry/sdk-metrics-base'; | ||
import { MeterProvider, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics-base'; | ||
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http'; | ||
@@ -35,13 +36,13 @@ const collectorOptions = { | ||
const exporter = new OTLPMetricExporter(collectorOptions); | ||
const meterProvider = new MeterProvider({}); | ||
// Register the exporter | ||
const meter = new MeterProvider({ | ||
exporter, | ||
interval: 60000, | ||
}).getMeter('example-meter'); | ||
meterProvider.addMetricReader(new PeriodicExportingMetricReader({ | ||
exporter: metricExporter, | ||
exportIntervalMillis: 1000, | ||
})); | ||
// Now, start recording data | ||
const meter = meterProvider.getMeter('example-meter'); | ||
const counter = meter.createCounter('metric_name'); | ||
counter.add(10, { 'key': 'value' }); | ||
``` | ||
@@ -52,3 +53,3 @@ | ||
```js | ||
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base'); | ||
const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics-base'); | ||
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-http'); | ||
@@ -60,10 +61,11 @@ const collectorOptions = { | ||
const exporter = new OTLPMetricExporter(collectorOptions); | ||
const meterProvider = new MeterProvider({}); | ||
// Register the exporter | ||
const meter = new MeterProvider({ | ||
exporter, | ||
interval: 60000, | ||
}).getMeter('example-meter'); | ||
meterProvider.addMetricReader(new PeriodicExportingMetricReader({ | ||
exporter: metricExporter, | ||
exportIntervalMillis: 1000, | ||
})); | ||
// Now, start recording data | ||
const meter = meterProvider.getMeter('example-meter'); | ||
const counter = meter.createCounter('metric_name'); | ||
@@ -87,5 +89,5 @@ counter.add(10, { 'key': 'value' }); | ||
```sh | ||
OTEL_EXPORTER_OTLP_ENDPOINT=https://localhost:4317 | ||
OTEL_EXPORTER_OTLP_ENDPOINT=https://localhost:4318 | ||
# this will automatically append the version and signal path | ||
# e.g. https://localhost:4317/v1/traces for `OTLPTraceExporter` and https://localhost:4317/v1/metrics for `OTLPMetricExporter` | ||
# e.g. https://localhost:4318/v1/traces for `OTLPTraceExporter` and https://localhost:4318/v1/metrics for `OTLPMetricExporter` | ||
``` | ||
@@ -96,4 +98,4 @@ | ||
```sh | ||
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://trace-service:4317/v1/traces | ||
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://metric-service:4317/v1/metrics | ||
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://trace-service:4318/v1/traces | ||
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://metric-service:4318/v1/metrics | ||
# version and signal needs to be explicit | ||
@@ -108,5 +110,4 @@ ``` | ||
1. Go to examples/otlp-exporter-node | ||
2. run `npm run docker:start` | ||
3. Open page at `http://localhost:9411/zipkin/` to observe the metrics | ||
1. Go to `examples/otlp-exporter-node` | ||
2. Follow the instructions there to observe the metrics. | ||
@@ -113,0 +114,0 @@ ## Useful links |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
127
0
131454
84
1113
+ Added@opentelemetry/api-metrics@0.29.0(transitive)
+ Added@opentelemetry/core@1.3.0(transitive)
+ Added@opentelemetry/otlp-exporter-base@0.29.0(transitive)
+ Added@opentelemetry/otlp-transformer@0.29.0(transitive)
+ Added@opentelemetry/resources@1.3.0(transitive)
+ Added@opentelemetry/sdk-metrics-base@0.29.0(transitive)
+ Added@opentelemetry/sdk-trace-base@1.3.0(transitive)
+ Added@opentelemetry/semantic-conventions@1.3.0(transitive)
- Removed@opentelemetry/api-metrics@0.28.0(transitive)
- Removed@opentelemetry/core@1.2.0(transitive)
- Removed@opentelemetry/exporter-trace-otlp-http@0.28.0(transitive)
- Removed@opentelemetry/otlp-exporter-base@0.28.0(transitive)
- Removed@opentelemetry/resources@1.2.0(transitive)
- Removed@opentelemetry/sdk-metrics-base@0.28.0(transitive)
- Removed@opentelemetry/sdk-trace-base@1.2.0(transitive)
- Removed@opentelemetry/semantic-conventions@1.2.0(transitive)
Updated@opentelemetry/core@1.3.0