@opentelemetry/otlp-exporter-base
Advanced tools
Comparing version 0.51.1 to 0.52.0
@@ -6,3 +6,3 @@ import { ExportResult, BindOnceFuture } from '@opentelemetry/core'; | ||
*/ | ||
export declare abstract class OTLPExporterBase<T extends OTLPExporterConfigBase, ExportItem, ServiceRequest> { | ||
export declare abstract class OTLPExporterBase<T extends OTLPExporterConfigBase, ExportItem> { | ||
readonly url: string; | ||
@@ -41,4 +41,3 @@ readonly hostname: string | undefined; | ||
abstract getDefaultUrl(config: T): string; | ||
abstract convert(objects: ExportItem[]): ServiceRequest; | ||
} | ||
//# sourceMappingURL=OTLPExporterBase.d.ts.map |
import { OTLPExporterBase } from '../../OTLPExporterBase'; | ||
import { OTLPExporterConfigBase } from '../../types'; | ||
import * as otlpTypes from '../../types'; | ||
import { ISerializer } from '@opentelemetry/otlp-transformer'; | ||
/** | ||
* Collector Metric Exporter abstract base class | ||
*/ | ||
export declare abstract class OTLPExporterBrowserBase<ExportItem, ServiceRequest> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem, ServiceRequest> { | ||
export declare abstract class OTLPExporterBrowserBase<ExportItem, ServiceResponse> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem> { | ||
protected _headers: Record<string, string>; | ||
private _useXHR; | ||
private _contentType; | ||
private _serializer; | ||
/** | ||
* @param config | ||
* @param serializer | ||
* @param contentType | ||
*/ | ||
constructor(config?: OTLPExporterConfigBase); | ||
constructor(config: OTLPExporterConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, contentType: string); | ||
onInit(): void; | ||
@@ -15,0 +20,0 @@ onShutdown(): void; |
@@ -31,2 +31,13 @@ /* | ||
})(); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
import { OTLPExporterBase } from '../../OTLPExporterBase'; | ||
@@ -44,7 +55,11 @@ import { parseHeaders } from '../../util'; | ||
* @param config | ||
* @param serializer | ||
* @param contentType | ||
*/ | ||
function OTLPExporterBrowserBase(config) { | ||
function OTLPExporterBrowserBase(config, serializer, contentType) { | ||
if (config === void 0) { config = {}; } | ||
var _this = _super.call(this, config) || this; | ||
_this._useXHR = false; | ||
_this._serializer = serializer; | ||
_this._contentType = contentType; | ||
_this._useXHR = | ||
@@ -64,2 +79,3 @@ !!config.headers || typeof navigator.sendBeacon !== 'function'; | ||
var _this = this; | ||
var _a; | ||
if (this._shutdownOnce.isCalled) { | ||
@@ -69,10 +85,9 @@ diag.debug('Shutdown already started. Cannot send objects'); | ||
} | ||
var serviceRequest = this.convert(items); | ||
var body = JSON.stringify(serviceRequest); | ||
var body = (_a = this._serializer.serializeRequest(items)) !== null && _a !== void 0 ? _a : new Uint8Array(); | ||
var promise = new Promise(function (resolve, reject) { | ||
if (_this._useXHR) { | ||
sendWithXhr(body, _this.url, _this._headers, _this.timeoutMillis, resolve, reject); | ||
sendWithXhr(body, _this.url, __assign(__assign({}, _this._headers), { 'Content-Type': _this._contentType }), _this.timeoutMillis, resolve, reject); | ||
} | ||
else { | ||
sendWithBeacon(body, _this.url, { type: 'application/json' }, resolve, reject); | ||
sendWithBeacon(body, _this.url, { type: _this._contentType }, resolve, reject); | ||
} | ||
@@ -79,0 +94,0 @@ }).then(onSuccess, onError); |
@@ -10,3 +10,3 @@ import { OTLPExporterError } from '../../types'; | ||
*/ | ||
export declare function sendWithBeacon(body: string, url: string, blobPropertyBag: BlobPropertyBag, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function sendWithBeacon(body: Uint8Array, url: string, blobPropertyBag: BlobPropertyBag, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
/** | ||
@@ -21,3 +21,3 @@ * function to send metrics/spans using browser XMLHttpRequest | ||
*/ | ||
export declare function sendWithXhr(body: string | Blob, url: string, headers: Record<string, string>, exporterTimeout: number, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function sendWithXhr(body: Uint8Array, url: string, headers: Record<string, string>, exporterTimeout: number, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -7,6 +7,7 @@ /// <reference types="node" /> | ||
import * as otlpTypes from '../../types'; | ||
import { ISerializer } from '@opentelemetry/otlp-transformer'; | ||
/** | ||
* Collector Metric Exporter abstract base class | ||
*/ | ||
export declare abstract class OTLPExporterNodeBase<ExportItem, ServiceRequest> extends OTLPExporterBase<OTLPExporterNodeConfigBase, ExportItem, ServiceRequest> { | ||
export declare abstract class OTLPExporterNodeBase<ExportItem, ServiceResponse> extends OTLPExporterBase<OTLPExporterNodeConfigBase, ExportItem> { | ||
DEFAULT_HEADERS: Record<string, string>; | ||
@@ -16,3 +17,5 @@ headers: Record<string, string>; | ||
compression: CompressionAlgorithm; | ||
constructor(config?: OTLPExporterNodeConfigBase); | ||
private _serializer; | ||
private _contentType; | ||
constructor(config: OTLPExporterNodeConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, contentType: string); | ||
onInit(_config: OTLPExporterNodeConfigBase): void; | ||
@@ -19,0 +22,0 @@ send(objects: ExportItem[], onSuccess: () => void, onError: (error: otlpTypes.OTLPExporterError) => void): void; |
@@ -41,6 +41,7 @@ /* | ||
__extends(OTLPExporterNodeBase, _super); | ||
function OTLPExporterNodeBase(config) { | ||
function OTLPExporterNodeBase(config, serializer, contentType) { | ||
if (config === void 0) { config = {}; } | ||
var _this = _super.call(this, config) || this; | ||
_this.DEFAULT_HEADERS = {}; | ||
_this._contentType = contentType; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -53,2 +54,3 @@ if (config.metadata) { | ||
_this.compression = configureCompression(config.compression); | ||
_this._serializer = serializer; | ||
return _this; | ||
@@ -63,5 +65,5 @@ } | ||
} | ||
var serviceRequest = this.convert(objects); | ||
var promise = new Promise(function (resolve, reject) { | ||
sendWithHttp(_this, JSON.stringify(serviceRequest), 'application/json', resolve, reject); | ||
var _a; | ||
sendWithHttp(_this, (_a = _this._serializer.serializeRequest(objects)) !== null && _a !== void 0 ? _a : new Uint8Array(), _this._contentType, resolve, reject); | ||
}).then(onSuccess, onError); | ||
@@ -68,0 +70,0 @@ this._sendingPromises.push(promise); |
@@ -16,5 +16,5 @@ /// <reference types="node" /> | ||
*/ | ||
export declare function sendWithHttp<ExportItem, ServiceRequest>(collector: OTLPExporterNodeBase<ExportItem, ServiceRequest>, data: string | Buffer, contentType: string, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function sendWithHttp<ExportItem, ServiceResponse>(collector: OTLPExporterNodeBase<ExportItem, ServiceResponse>, data: string | Uint8Array, contentType: string, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function createHttpAgent(config: OTLPExporterNodeConfigBase): http.Agent | https.Agent | undefined; | ||
export declare function configureCompression(compression: CompressionAlgorithm | undefined): CompressionAlgorithm; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -144,3 +144,3 @@ var __assign = (this && this.__assign) || function () { | ||
req.setHeader('Content-Encoding', 'gzip'); | ||
var dataStream = readableFromBuffer(data); | ||
var dataStream = readableFromUnit8Array(data); | ||
dataStream | ||
@@ -154,3 +154,3 @@ .on('error', onError) | ||
default: | ||
req.end(data); | ||
req.end(Buffer.from(data)); | ||
break; | ||
@@ -161,3 +161,3 @@ } | ||
} | ||
function readableFromBuffer(buff) { | ||
function readableFromUnit8Array(buff) { | ||
var readable = new Readable(); | ||
@@ -164,0 +164,0 @@ readable.push(buff); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.51.1"; | ||
export declare const VERSION = "0.52.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export var VERSION = '0.51.1'; | ||
export var VERSION = '0.52.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -6,3 +6,3 @@ import { ExportResult, BindOnceFuture } from '@opentelemetry/core'; | ||
*/ | ||
export declare abstract class OTLPExporterBase<T extends OTLPExporterConfigBase, ExportItem, ServiceRequest> { | ||
export declare abstract class OTLPExporterBase<T extends OTLPExporterConfigBase, ExportItem> { | ||
readonly url: string; | ||
@@ -41,4 +41,3 @@ readonly hostname: string | undefined; | ||
abstract getDefaultUrl(config: T): string; | ||
abstract convert(objects: ExportItem[]): ServiceRequest; | ||
} | ||
//# sourceMappingURL=OTLPExporterBase.d.ts.map |
import { OTLPExporterBase } from '../../OTLPExporterBase'; | ||
import { OTLPExporterConfigBase } from '../../types'; | ||
import * as otlpTypes from '../../types'; | ||
import { ISerializer } from '@opentelemetry/otlp-transformer'; | ||
/** | ||
* Collector Metric Exporter abstract base class | ||
*/ | ||
export declare abstract class OTLPExporterBrowserBase<ExportItem, ServiceRequest> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem, ServiceRequest> { | ||
export declare abstract class OTLPExporterBrowserBase<ExportItem, ServiceResponse> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem> { | ||
protected _headers: Record<string, string>; | ||
private _useXHR; | ||
private _contentType; | ||
private _serializer; | ||
/** | ||
* @param config | ||
* @param serializer | ||
* @param contentType | ||
*/ | ||
constructor(config?: OTLPExporterConfigBase); | ||
constructor(config: OTLPExporterConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, contentType: string); | ||
onInit(): void; | ||
@@ -15,0 +20,0 @@ onShutdown(): void; |
@@ -27,6 +27,10 @@ /* | ||
* @param config | ||
* @param serializer | ||
* @param contentType | ||
*/ | ||
constructor(config = {}) { | ||
constructor(config = {}, serializer, contentType) { | ||
super(config); | ||
this._useXHR = false; | ||
this._serializer = serializer; | ||
this._contentType = contentType; | ||
this._useXHR = | ||
@@ -44,2 +48,3 @@ !!config.headers || typeof navigator.sendBeacon !== 'function'; | ||
send(items, onSuccess, onError) { | ||
var _a; | ||
if (this._shutdownOnce.isCalled) { | ||
@@ -49,10 +54,9 @@ diag.debug('Shutdown already started. Cannot send objects'); | ||
} | ||
const serviceRequest = this.convert(items); | ||
const body = JSON.stringify(serviceRequest); | ||
const body = (_a = this._serializer.serializeRequest(items)) !== null && _a !== void 0 ? _a : new Uint8Array(); | ||
const promise = new Promise((resolve, reject) => { | ||
if (this._useXHR) { | ||
sendWithXhr(body, this.url, this._headers, this.timeoutMillis, resolve, reject); | ||
sendWithXhr(body, this.url, Object.assign(Object.assign({}, this._headers), { 'Content-Type': this._contentType }), this.timeoutMillis, resolve, reject); | ||
} | ||
else { | ||
sendWithBeacon(body, this.url, { type: 'application/json' }, resolve, reject); | ||
sendWithBeacon(body, this.url, { type: this._contentType }, resolve, reject); | ||
} | ||
@@ -59,0 +63,0 @@ }).then(onSuccess, onError); |
@@ -10,3 +10,3 @@ import { OTLPExporterError } from '../../types'; | ||
*/ | ||
export declare function sendWithBeacon(body: string, url: string, blobPropertyBag: BlobPropertyBag, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function sendWithBeacon(body: Uint8Array, url: string, blobPropertyBag: BlobPropertyBag, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
/** | ||
@@ -21,3 +21,3 @@ * function to send metrics/spans using browser XMLHttpRequest | ||
*/ | ||
export declare function sendWithXhr(body: string | Blob, url: string, headers: Record<string, string>, exporterTimeout: number, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function sendWithXhr(body: Uint8Array, url: string, headers: Record<string, string>, exporterTimeout: number, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -7,6 +7,7 @@ /// <reference types="node" /> | ||
import * as otlpTypes from '../../types'; | ||
import { ISerializer } from '@opentelemetry/otlp-transformer'; | ||
/** | ||
* Collector Metric Exporter abstract base class | ||
*/ | ||
export declare abstract class OTLPExporterNodeBase<ExportItem, ServiceRequest> extends OTLPExporterBase<OTLPExporterNodeConfigBase, ExportItem, ServiceRequest> { | ||
export declare abstract class OTLPExporterNodeBase<ExportItem, ServiceResponse> extends OTLPExporterBase<OTLPExporterNodeConfigBase, ExportItem> { | ||
DEFAULT_HEADERS: Record<string, string>; | ||
@@ -16,3 +17,5 @@ headers: Record<string, string>; | ||
compression: CompressionAlgorithm; | ||
constructor(config?: OTLPExporterNodeConfigBase); | ||
private _serializer; | ||
private _contentType; | ||
constructor(config: OTLPExporterNodeConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, contentType: string); | ||
onInit(_config: OTLPExporterNodeConfigBase): void; | ||
@@ -19,0 +22,0 @@ send(objects: ExportItem[], onSuccess: () => void, onError: (error: otlpTypes.OTLPExporterError) => void): void; |
@@ -25,5 +25,6 @@ /* | ||
export class OTLPExporterNodeBase extends OTLPExporterBase { | ||
constructor(config = {}) { | ||
constructor(config = {}, serializer, contentType) { | ||
super(config); | ||
this.DEFAULT_HEADERS = {}; | ||
this._contentType = contentType; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -36,2 +37,3 @@ if (config.metadata) { | ||
this.compression = configureCompression(config.compression); | ||
this._serializer = serializer; | ||
} | ||
@@ -44,5 +46,5 @@ onInit(_config) { } | ||
} | ||
const serviceRequest = this.convert(objects); | ||
const promise = new Promise((resolve, reject) => { | ||
sendWithHttp(this, JSON.stringify(serviceRequest), 'application/json', resolve, reject); | ||
var _a; | ||
sendWithHttp(this, (_a = this._serializer.serializeRequest(objects)) !== null && _a !== void 0 ? _a : new Uint8Array(), this._contentType, resolve, reject); | ||
}).then(onSuccess, onError); | ||
@@ -49,0 +51,0 @@ this._sendingPromises.push(promise); |
@@ -16,5 +16,5 @@ /// <reference types="node" /> | ||
*/ | ||
export declare function sendWithHttp<ExportItem, ServiceRequest>(collector: OTLPExporterNodeBase<ExportItem, ServiceRequest>, data: string | Buffer, contentType: string, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function sendWithHttp<ExportItem, ServiceResponse>(collector: OTLPExporterNodeBase<ExportItem, ServiceResponse>, data: string | Uint8Array, contentType: string, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function createHttpAgent(config: OTLPExporterNodeConfigBase): http.Agent | https.Agent | undefined; | ||
export declare function configureCompression(compression: CompressionAlgorithm | undefined): CompressionAlgorithm; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -131,3 +131,3 @@ /* | ||
req.setHeader('Content-Encoding', 'gzip'); | ||
const dataStream = readableFromBuffer(data); | ||
const dataStream = readableFromUnit8Array(data); | ||
dataStream | ||
@@ -141,3 +141,3 @@ .on('error', onError) | ||
default: | ||
req.end(data); | ||
req.end(Buffer.from(data)); | ||
break; | ||
@@ -148,3 +148,3 @@ } | ||
} | ||
function readableFromBuffer(buff) { | ||
function readableFromUnit8Array(buff) { | ||
const readable = new Readable(); | ||
@@ -151,0 +151,0 @@ readable.push(buff); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.51.1"; | ||
export declare const VERSION = "0.52.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export const VERSION = '0.51.1'; | ||
export const VERSION = '0.52.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -6,3 +6,3 @@ import { ExportResult, BindOnceFuture } from '@opentelemetry/core'; | ||
*/ | ||
export declare abstract class OTLPExporterBase<T extends OTLPExporterConfigBase, ExportItem, ServiceRequest> { | ||
export declare abstract class OTLPExporterBase<T extends OTLPExporterConfigBase, ExportItem> { | ||
readonly url: string; | ||
@@ -41,4 +41,3 @@ readonly hostname: string | undefined; | ||
abstract getDefaultUrl(config: T): string; | ||
abstract convert(objects: ExportItem[]): ServiceRequest; | ||
} | ||
//# sourceMappingURL=OTLPExporterBase.d.ts.map |
import { OTLPExporterBase } from '../../OTLPExporterBase'; | ||
import { OTLPExporterConfigBase } from '../../types'; | ||
import * as otlpTypes from '../../types'; | ||
import { ISerializer } from '@opentelemetry/otlp-transformer'; | ||
/** | ||
* Collector Metric Exporter abstract base class | ||
*/ | ||
export declare abstract class OTLPExporterBrowserBase<ExportItem, ServiceRequest> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem, ServiceRequest> { | ||
export declare abstract class OTLPExporterBrowserBase<ExportItem, ServiceResponse> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem> { | ||
protected _headers: Record<string, string>; | ||
private _useXHR; | ||
private _contentType; | ||
private _serializer; | ||
/** | ||
* @param config | ||
* @param serializer | ||
* @param contentType | ||
*/ | ||
constructor(config?: OTLPExporterConfigBase); | ||
constructor(config: OTLPExporterConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, contentType: string); | ||
onInit(): void; | ||
@@ -15,0 +20,0 @@ onShutdown(): void; |
@@ -30,6 +30,10 @@ "use strict"; | ||
* @param config | ||
* @param serializer | ||
* @param contentType | ||
*/ | ||
constructor(config = {}) { | ||
constructor(config = {}, serializer, contentType) { | ||
super(config); | ||
this._useXHR = false; | ||
this._serializer = serializer; | ||
this._contentType = contentType; | ||
this._useXHR = | ||
@@ -47,2 +51,3 @@ !!config.headers || typeof navigator.sendBeacon !== 'function'; | ||
send(items, onSuccess, onError) { | ||
var _a; | ||
if (this._shutdownOnce.isCalled) { | ||
@@ -52,10 +57,9 @@ api_1.diag.debug('Shutdown already started. Cannot send objects'); | ||
} | ||
const serviceRequest = this.convert(items); | ||
const body = JSON.stringify(serviceRequest); | ||
const body = (_a = this._serializer.serializeRequest(items)) !== null && _a !== void 0 ? _a : new Uint8Array(); | ||
const promise = new Promise((resolve, reject) => { | ||
if (this._useXHR) { | ||
(0, util_2.sendWithXhr)(body, this.url, this._headers, this.timeoutMillis, resolve, reject); | ||
(0, util_2.sendWithXhr)(body, this.url, Object.assign(Object.assign({}, this._headers), { 'Content-Type': this._contentType }), this.timeoutMillis, resolve, reject); | ||
} | ||
else { | ||
(0, util_2.sendWithBeacon)(body, this.url, { type: 'application/json' }, resolve, reject); | ||
(0, util_2.sendWithBeacon)(body, this.url, { type: this._contentType }, resolve, reject); | ||
} | ||
@@ -62,0 +66,0 @@ }).then(onSuccess, onError); |
@@ -10,3 +10,3 @@ import { OTLPExporterError } from '../../types'; | ||
*/ | ||
export declare function sendWithBeacon(body: string, url: string, blobPropertyBag: BlobPropertyBag, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function sendWithBeacon(body: Uint8Array, url: string, blobPropertyBag: BlobPropertyBag, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
/** | ||
@@ -21,3 +21,3 @@ * function to send metrics/spans using browser XMLHttpRequest | ||
*/ | ||
export declare function sendWithXhr(body: string | Blob, url: string, headers: Record<string, string>, exporterTimeout: number, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function sendWithXhr(body: Uint8Array, url: string, headers: Record<string, string>, exporterTimeout: number, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -7,6 +7,7 @@ /// <reference types="node" /> | ||
import * as otlpTypes from '../../types'; | ||
import { ISerializer } from '@opentelemetry/otlp-transformer'; | ||
/** | ||
* Collector Metric Exporter abstract base class | ||
*/ | ||
export declare abstract class OTLPExporterNodeBase<ExportItem, ServiceRequest> extends OTLPExporterBase<OTLPExporterNodeConfigBase, ExportItem, ServiceRequest> { | ||
export declare abstract class OTLPExporterNodeBase<ExportItem, ServiceResponse> extends OTLPExporterBase<OTLPExporterNodeConfigBase, ExportItem> { | ||
DEFAULT_HEADERS: Record<string, string>; | ||
@@ -16,3 +17,5 @@ headers: Record<string, string>; | ||
compression: CompressionAlgorithm; | ||
constructor(config?: OTLPExporterNodeConfigBase); | ||
private _serializer; | ||
private _contentType; | ||
constructor(config: OTLPExporterNodeConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, contentType: string); | ||
onInit(_config: OTLPExporterNodeConfigBase): void; | ||
@@ -19,0 +22,0 @@ send(objects: ExportItem[], onSuccess: () => void, onError: (error: otlpTypes.OTLPExporterError) => void): void; |
@@ -28,5 +28,6 @@ "use strict"; | ||
class OTLPExporterNodeBase extends OTLPExporterBase_1.OTLPExporterBase { | ||
constructor(config = {}) { | ||
constructor(config = {}, serializer, contentType) { | ||
super(config); | ||
this.DEFAULT_HEADERS = {}; | ||
this._contentType = contentType; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -39,2 +40,3 @@ if (config.metadata) { | ||
this.compression = (0, util_2.configureCompression)(config.compression); | ||
this._serializer = serializer; | ||
} | ||
@@ -47,5 +49,5 @@ onInit(_config) { } | ||
} | ||
const serviceRequest = this.convert(objects); | ||
const promise = new Promise((resolve, reject) => { | ||
(0, util_2.sendWithHttp)(this, JSON.stringify(serviceRequest), 'application/json', resolve, reject); | ||
var _a; | ||
(0, util_2.sendWithHttp)(this, (_a = this._serializer.serializeRequest(objects)) !== null && _a !== void 0 ? _a : new Uint8Array(), this._contentType, resolve, reject); | ||
}).then(onSuccess, onError); | ||
@@ -52,0 +54,0 @@ this._sendingPromises.push(promise); |
@@ -16,5 +16,5 @@ /// <reference types="node" /> | ||
*/ | ||
export declare function sendWithHttp<ExportItem, ServiceRequest>(collector: OTLPExporterNodeBase<ExportItem, ServiceRequest>, data: string | Buffer, contentType: string, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function sendWithHttp<ExportItem, ServiceResponse>(collector: OTLPExporterNodeBase<ExportItem, ServiceResponse>, data: string | Uint8Array, contentType: string, onSuccess: () => void, onError: (error: OTLPExporterError) => void): void; | ||
export declare function createHttpAgent(config: OTLPExporterNodeConfigBase): http.Agent | https.Agent | undefined; | ||
export declare function configureCompression(compression: CompressionAlgorithm | undefined): CompressionAlgorithm; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -134,3 +134,3 @@ "use strict"; | ||
req.setHeader('Content-Encoding', 'gzip'); | ||
const dataStream = readableFromBuffer(data); | ||
const dataStream = readableFromUnit8Array(data); | ||
dataStream | ||
@@ -144,3 +144,3 @@ .on('error', onError) | ||
default: | ||
req.end(data); | ||
req.end(Buffer.from(data)); | ||
break; | ||
@@ -152,3 +152,3 @@ } | ||
exports.sendWithHttp = sendWithHttp; | ||
function readableFromBuffer(buff) { | ||
function readableFromUnit8Array(buff) { | ||
const readable = new stream_1.Readable(); | ||
@@ -155,0 +155,0 @@ readable.push(buff); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.51.1"; | ||
export declare const VERSION = "0.52.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.51.1'; | ||
exports.VERSION = '0.52.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/otlp-exporter-base", | ||
"version": "0.51.1", | ||
"version": "0.52.0", | ||
"description": "OpenTelemetry OTLP Exporter base (for internal use only)", | ||
@@ -31,3 +31,4 @@ "main": "build/src/index.js", | ||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", | ||
"prewatch": "npm run precompile" | ||
"prewatch": "npm run precompile", | ||
"align-api-deps": "node ../../../scripts/align-api-deps.js" | ||
}, | ||
@@ -65,15 +66,16 @@ "keywords": [ | ||
"dependencies": { | ||
"@opentelemetry/core": "1.24.1" | ||
"@opentelemetry/core": "1.25.0", | ||
"@opentelemetry/otlp-transformer": "0.52.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.23.6", | ||
"@babel/preset-env": "7.22.20", | ||
"@opentelemetry/api": "1.8.0", | ||
"@babel/core": "7.24.6", | ||
"@babel/preset-env": "7.24.6", | ||
"@opentelemetry/api": "1.9.0", | ||
"@types/mocha": "10.0.6", | ||
"@types/node": "18.6.5", | ||
"@types/sinon": "10.0.20", | ||
"@types/sinon": "17.0.3", | ||
"babel-plugin-istanbul": "6.1.1", | ||
"codecov": "3.8.3", | ||
"cross-var": "1.1.0", | ||
"karma": "6.4.2", | ||
"karma": "6.4.3", | ||
"karma-chrome-launcher": "3.1.0", | ||
@@ -83,3 +85,3 @@ "karma-coverage": "2.2.1", | ||
"karma-spec-reporter": "0.0.36", | ||
"karma-webpack": "4.0.2", | ||
"karma-webpack": "5.0.1", | ||
"lerna": "6.6.2", | ||
@@ -89,3 +91,3 @@ "mocha": "10.2.0", | ||
"sinon": "15.1.2", | ||
"ts-loader": "8.4.0", | ||
"ts-loader": "9.5.1", | ||
"ts-mocha": "10.0.0", | ||
@@ -102,3 +104,3 @@ "typescript": "4.4.4", | ||
"sideEffects": false, | ||
"gitHead": "41c2626fe0ed03e2e83bd79ee43c9bdf0ffd80d8" | ||
"gitHead": "c4d3351b6b3f5593c8d7cbfec97b45cea9fe1511" | ||
} |
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
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
303620
3170
3
2
80
+ Added@opentelemetry/api-logs@0.52.0(transitive)
+ Added@opentelemetry/core@1.25.0(transitive)
+ Added@opentelemetry/otlp-transformer@0.52.0(transitive)
+ Added@opentelemetry/resources@1.25.0(transitive)
+ Added@opentelemetry/sdk-logs@0.52.0(transitive)
+ Added@opentelemetry/sdk-metrics@1.25.0(transitive)
+ Added@opentelemetry/sdk-trace-base@1.25.0(transitive)
+ Added@opentelemetry/semantic-conventions@1.25.0(transitive)
+ Added@protobufjs/aspromise@1.1.2(transitive)
+ Added@protobufjs/base64@1.1.2(transitive)
+ Added@protobufjs/codegen@2.0.4(transitive)
+ Added@protobufjs/eventemitter@1.1.0(transitive)
+ Added@protobufjs/fetch@1.1.0(transitive)
+ Added@protobufjs/float@1.0.2(transitive)
+ Added@protobufjs/inquire@1.1.0(transitive)
+ Added@protobufjs/path@1.1.2(transitive)
+ Added@protobufjs/pool@1.1.0(transitive)
+ Added@protobufjs/utf8@1.1.0(transitive)
+ Added@types/node@22.7.4(transitive)
+ Addedlodash.merge@4.6.2(transitive)
+ Addedlong@5.2.3(transitive)
+ Addedprotobufjs@7.4.0(transitive)
+ Addedundici-types@6.19.8(transitive)
- Removed@opentelemetry/api@1.8.0(transitive)
- Removed@opentelemetry/core@1.24.1(transitive)
- Removed@opentelemetry/semantic-conventions@1.24.1(transitive)
Updated@opentelemetry/core@1.25.0