Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/exporter-collector

Package Overview
Dependencies
Maintainers
4
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/exporter-collector - npm Package Compare versions

Comparing version 0.23.1-alpha.28 to 0.23.1-alpha.29

3

build/esm/platform/node/CollectorExporterNodeBase.d.ts

@@ -5,3 +5,3 @@ /// <reference types="node" />

import { CollectorExporterBase } from '../../CollectorExporterBase';
import { CollectorExporterNodeConfigBase } from './types';
import { CollectorExporterNodeConfigBase, CompressionAlgorithm } from './types';
import * as collectorTypes from '../../types';

@@ -15,2 +15,3 @@ /**

agent: http.Agent | https.Agent | undefined;
compression: CompressionAlgorithm;
constructor(config?: CollectorExporterNodeConfigBase);

@@ -17,0 +18,0 @@ onInit(_config: CollectorExporterNodeConfigBase): void;

@@ -32,2 +32,3 @@ /*

import { CollectorExporterBase } from '../../CollectorExporterBase';
import { CompressionAlgorithm } from './types';
import { parseHeaders } from '../../util';

@@ -51,2 +52,3 @@ import { createHttpAgent, sendWithHttp } from './util';

_this.agent = createHttpAgent(config);
_this.compression = config.compression || CompressionAlgorithm.NONE;
return _this;

@@ -53,0 +55,0 @@ }

@@ -10,4 +10,9 @@ /// <reference types="node" />

keepAlive?: boolean;
compression?: CompressionAlgorithm;
httpAgentOptions?: http.AgentOptions | https.AgentOptions;
}
export declare enum CompressionAlgorithm {
NONE = "none",
GZIP = "gzip"
}
//# sourceMappingURL=types.d.ts.map

@@ -1,2 +0,6 @@

export {};
export var CompressionAlgorithm;
(function (CompressionAlgorithm) {
CompressionAlgorithm["NONE"] = "none";
CompressionAlgorithm["GZIP"] = "gzip";
})(CompressionAlgorithm || (CompressionAlgorithm = {}));
//# sourceMappingURL=types.js.map

@@ -30,4 +30,8 @@ var __assign = (this && this.__assign) || function () {

import * as https from 'https';
import * as zlib from 'zlib';
import { Readable } from 'stream';
import * as collectorTypes from '../../types';
import { diag } from '@opentelemetry/api';
import { CompressionAlgorithm } from './types';
var gzip = zlib.createGzip();
/**

@@ -69,5 +73,23 @@ * Sends data using http

});
req.write(data);
req.end();
switch (collector.compression) {
case CompressionAlgorithm.GZIP: {
req.setHeader('Content-Encoding', 'gzip');
var dataStream = readableFromBuffer(data);
dataStream.on('error', onError)
.pipe(gzip).on('error', onError)
.pipe(req);
break;
}
default:
req.write(data);
req.end();
break;
}
}
function readableFromBuffer(buff) {
var readable = new Readable();
readable.push(buff);
readable.push(null);
return readable;
}
export function createHttpAgent(config) {

@@ -74,0 +96,0 @@ if (config.httpAgentOptions && config.keepAlive === false) {

@@ -5,3 +5,3 @@ /// <reference types="node" />

import { CollectorExporterBase } from '../../CollectorExporterBase';
import { CollectorExporterNodeConfigBase } from './types';
import { CollectorExporterNodeConfigBase, CompressionAlgorithm } from './types';
import * as collectorTypes from '../../types';

@@ -15,2 +15,3 @@ /**

agent: http.Agent | https.Agent | undefined;
compression: CompressionAlgorithm;
constructor(config?: CollectorExporterNodeConfigBase);

@@ -17,0 +18,0 @@ onInit(_config: CollectorExporterNodeConfigBase): void;

@@ -20,2 +20,3 @@ "use strict";

const CollectorExporterBase_1 = require("../../CollectorExporterBase");
const types_1 = require("./types");
const util_1 = require("../../util");

@@ -37,2 +38,3 @@ const util_2 = require("./util");

this.agent = util_2.createHttpAgent(config);
this.compression = config.compression || types_1.CompressionAlgorithm.NONE;
}

@@ -39,0 +41,0 @@ onInit(_config) {

@@ -10,4 +10,9 @@ /// <reference types="node" />

keepAlive?: boolean;
compression?: CompressionAlgorithm;
httpAgentOptions?: http.AgentOptions | https.AgentOptions;
}
export declare enum CompressionAlgorithm {
NONE = "none",
GZIP = "gzip"
}
//# sourceMappingURL=types.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompressionAlgorithm = void 0;
var CompressionAlgorithm;
(function (CompressionAlgorithm) {
CompressionAlgorithm["NONE"] = "none";
CompressionAlgorithm["GZIP"] = "gzip";
})(CompressionAlgorithm = exports.CompressionAlgorithm || (exports.CompressionAlgorithm = {}));
//# sourceMappingURL=types.js.map

@@ -22,4 +22,8 @@ "use strict";

const https = require("https");
const zlib = require("zlib");
const stream_1 = require("stream");
const collectorTypes = require("../../types");
const api_1 = require("@opentelemetry/api");
const types_1 = require("./types");
const gzip = zlib.createGzip();
/**

@@ -61,6 +65,24 @@ * Sends data using http

});
req.write(data);
req.end();
switch (collector.compression) {
case types_1.CompressionAlgorithm.GZIP: {
req.setHeader('Content-Encoding', 'gzip');
const dataStream = readableFromBuffer(data);
dataStream.on('error', onError)
.pipe(gzip).on('error', onError)
.pipe(req);
break;
}
default:
req.write(data);
req.end();
break;
}
}
exports.sendWithHttp = sendWithHttp;
function readableFromBuffer(buff) {
const readable = new stream_1.Readable();
readable.push(buff);
readable.push(null);
return readable;
}
function createHttpAgent(config) {

@@ -67,0 +89,0 @@ if (config.httpAgentOptions && config.keepAlive === false) {

{
"name": "@opentelemetry/exporter-collector",
"version": "0.23.1-alpha.28+d8fbedda",
"version": "0.23.1-alpha.29+ec883444",
"description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector",

@@ -88,8 +88,8 @@ "main": "build/src/index.js",

"@opentelemetry/api-metrics": "^0.23.0",
"@opentelemetry/core": "^0.23.1-alpha.28+d8fbedda",
"@opentelemetry/metrics": "^0.23.1-alpha.28+d8fbedda",
"@opentelemetry/resources": "^0.23.1-alpha.28+d8fbedda",
"@opentelemetry/tracing": "^0.23.1-alpha.28+d8fbedda"
"@opentelemetry/core": "^0.23.0",
"@opentelemetry/metrics": "^0.23.0",
"@opentelemetry/resources": "^0.23.0",
"@opentelemetry/tracing": "^0.23.0"
},
"gitHead": "d8fbeddacce3e27aab40b24c2ca3c271155e74ea"
"gitHead": "ec8834442a4c15c268f0ca1c07a236fc3fa2210a"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc