@opentelemetry/exporter-collector
Advanced tools
Comparing version 0.25.1-alpha.13 to 0.25.1-alpha.14
@@ -6,2 +6,3 @@ export * from './CollectorExporterBase'; | ||
export { toCollectorExportMetricServiceRequest } from './transformMetrics'; | ||
export { appendResourcePathToUrlIfNotPresent } from './util'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -22,2 +22,3 @@ /* | ||
export { toCollectorExportMetricServiceRequest } from './transformMetrics'; | ||
export { appendResourcePathToUrlIfNotPresent } from './util'; | ||
//# sourceMappingURL=index.js.map |
@@ -34,3 +34,5 @@ /* | ||
import { getEnv, baggageUtils } from '@opentelemetry/core'; | ||
var DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/metrics'; | ||
import { appendResourcePathToUrlIfNotPresent } from '../../util'; | ||
var DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; | ||
var DEFAULT_COLLECTOR_URL = "http://localhost:55681" + DEFAULT_COLLECTOR_RESOURCE_PATH; | ||
/** | ||
@@ -58,3 +60,3 @@ * Collector Metric Exporter for Web | ||
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT | ||
? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -61,0 +63,0 @@ }; |
@@ -34,3 +34,5 @@ /* | ||
import { getEnv, baggageUtils } from '@opentelemetry/core'; | ||
var DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/traces'; | ||
import { appendResourcePathToUrlIfNotPresent } from '../../util'; | ||
var DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces'; | ||
var DEFAULT_COLLECTOR_URL = "http://localhost:55681" + DEFAULT_COLLECTOR_RESOURCE_PATH; | ||
/** | ||
@@ -56,3 +58,3 @@ * Collector Trace Exporter for Web | ||
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT | ||
? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -59,0 +61,0 @@ }; |
@@ -34,3 +34,5 @@ /* | ||
import { getEnv, baggageUtils } from '@opentelemetry/core'; | ||
var DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/metrics'; | ||
import { appendResourcePathToUrlIfNotPresent } from '../../util'; | ||
var DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; | ||
var DEFAULT_COLLECTOR_URL = "http://localhost:55681" + DEFAULT_COLLECTOR_RESOURCE_PATH; | ||
/** | ||
@@ -58,3 +60,3 @@ * Collector Metric Exporter for Node | ||
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT | ||
? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -61,0 +63,0 @@ }; |
@@ -34,3 +34,5 @@ /* | ||
import { getEnv, baggageUtils } from '@opentelemetry/core'; | ||
var DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/traces'; | ||
import { appendResourcePathToUrlIfNotPresent } from '../../util'; | ||
var DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces'; | ||
var DEFAULT_COLLECTOR_URL = "http://localhost:55681" + DEFAULT_COLLECTOR_RESOURCE_PATH; | ||
/** | ||
@@ -56,3 +58,3 @@ * Collector Trace Exporter for Node | ||
: getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT | ||
? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -59,0 +61,0 @@ }; |
@@ -6,2 +6,3 @@ /** | ||
export declare function parseHeaders(partialHeaders?: Partial<Record<string, unknown>>): Record<string, string>; | ||
export declare function appendResourcePathToUrlIfNotPresent(url: string, path: string): string; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -35,2 +35,7 @@ /* | ||
} | ||
export function appendResourcePathToUrlIfNotPresent(url, path) { | ||
if (url.match(/v\d\/(traces|metrics)$/)) | ||
return url; | ||
return url + path; | ||
} | ||
//# sourceMappingURL=util.js.map |
@@ -6,2 +6,3 @@ export * from './CollectorExporterBase'; | ||
export { toCollectorExportMetricServiceRequest } from './transformMetrics'; | ||
export { appendResourcePathToUrlIfNotPresent } from './util'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -28,3 +28,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toCollectorExportMetricServiceRequest = exports.toCollectorExportTraceServiceRequest = exports.collectorTypes = void 0; | ||
exports.appendResourcePathToUrlIfNotPresent = exports.toCollectorExportMetricServiceRequest = exports.toCollectorExportTraceServiceRequest = exports.collectorTypes = void 0; | ||
__exportStar(require("./CollectorExporterBase"), exports); | ||
@@ -37,2 +37,4 @@ __exportStar(require("./platform"), exports); | ||
Object.defineProperty(exports, "toCollectorExportMetricServiceRequest", { enumerable: true, get: function () { return transformMetrics_1.toCollectorExportMetricServiceRequest; } }); | ||
var util_1 = require("./util"); | ||
Object.defineProperty(exports, "appendResourcePathToUrlIfNotPresent", { enumerable: true, get: function () { return util_1.appendResourcePathToUrlIfNotPresent; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -22,3 +22,5 @@ "use strict"; | ||
const core_1 = require("@opentelemetry/core"); | ||
const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/metrics'; | ||
const util_1 = require("../../util"); | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
/** | ||
@@ -43,3 +45,3 @@ * Collector Metric Exporter for Web | ||
: core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT | ||
? util_1.appendResourcePathToUrlIfNotPresent(core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -46,0 +48,0 @@ } |
@@ -22,3 +22,5 @@ "use strict"; | ||
const core_1 = require("@opentelemetry/core"); | ||
const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/traces'; | ||
const util_1 = require("../../util"); | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
/** | ||
@@ -41,3 +43,3 @@ * Collector Trace Exporter for Web | ||
: core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT | ||
? util_1.appendResourcePathToUrlIfNotPresent(core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -44,0 +46,0 @@ } |
@@ -22,3 +22,5 @@ "use strict"; | ||
const core_1 = require("@opentelemetry/core"); | ||
const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/metrics'; | ||
const util_1 = require("../../util"); | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
/** | ||
@@ -43,3 +45,3 @@ * Collector Metric Exporter for Node | ||
: core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT | ||
? util_1.appendResourcePathToUrlIfNotPresent(core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -46,0 +48,0 @@ } |
@@ -22,3 +22,5 @@ "use strict"; | ||
const core_1 = require("@opentelemetry/core"); | ||
const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/traces'; | ||
const util_1 = require("../../util"); | ||
const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces'; | ||
const DEFAULT_COLLECTOR_URL = `http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`; | ||
/** | ||
@@ -41,3 +43,3 @@ * Collector Trace Exporter for Node | ||
: core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 | ||
? core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT | ||
? util_1.appendResourcePathToUrlIfNotPresent(core_1.getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) | ||
: DEFAULT_COLLECTOR_URL; | ||
@@ -44,0 +46,0 @@ } |
@@ -6,2 +6,3 @@ /** | ||
export declare function parseHeaders(partialHeaders?: Partial<Record<string, unknown>>): Record<string, string>; | ||
export declare function appendResourcePathToUrlIfNotPresent(url: string, path: string): string; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseHeaders = void 0; | ||
exports.appendResourcePathToUrlIfNotPresent = exports.parseHeaders = void 0; | ||
const api_1 = require("@opentelemetry/api"); | ||
@@ -38,2 +38,8 @@ /** | ||
exports.parseHeaders = parseHeaders; | ||
function appendResourcePathToUrlIfNotPresent(url, path) { | ||
if (url.match(/v\d\/(traces|metrics)$/)) | ||
return url; | ||
return url + path; | ||
} | ||
exports.appendResourcePathToUrlIfNotPresent = appendResourcePathToUrlIfNotPresent; | ||
//# sourceMappingURL=util.js.map |
{ | ||
"name": "@opentelemetry/exporter-collector", | ||
"version": "0.25.1-alpha.13+f0caa22f", | ||
"version": "0.25.1-alpha.14+dc574f71", | ||
"description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", | ||
@@ -89,9 +89,9 @@ "main": "build/src/index.js", | ||
"dependencies": { | ||
"@opentelemetry/api-metrics": "^0.25.1-alpha.13+f0caa22f", | ||
"@opentelemetry/core": "^0.25.1-alpha.13+f0caa22f", | ||
"@opentelemetry/resources": "^0.25.1-alpha.13+f0caa22f", | ||
"@opentelemetry/sdk-metrics-base": "^0.25.1-alpha.13+f0caa22f", | ||
"@opentelemetry/sdk-trace-base": "^0.25.1-alpha.13+f0caa22f" | ||
"@opentelemetry/api-metrics": "^0.25.0", | ||
"@opentelemetry/core": "^0.25.0", | ||
"@opentelemetry/resources": "^0.25.0", | ||
"@opentelemetry/sdk-metrics-base": "^0.25.0", | ||
"@opentelemetry/sdk-trace-base": "^0.25.0" | ||
}, | ||
"gitHead": "f0caa22ffcb26af2a2f05260f138a494e120a955" | ||
"gitHead": "dc574f71685b90c3541c8ede9a91f852c8345fe7" | ||
} |
@@ -31,3 +31,3 @@ # OpenTelemetry Collector Exporter for web and node | ||
const collectorOptions = { | ||
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/trace | ||
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/traces | ||
headers: {}, // an optional object containing custom headers to be sent with each request | ||
@@ -87,3 +87,3 @@ concurrencyLimit: 10, // an optional limit on pending requests | ||
const collectorOptions = { | ||
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/trace | ||
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/traces | ||
headers: { | ||
@@ -139,2 +139,24 @@ foo: 'bar' | ||
## Configuration options as environment variables | ||
Instead of providing options to `CollectorMetricExporter` and `CollectorTraceExporter` explicitly, environment variables may be provided instead. | ||
```sh | ||
OTEL_EXPORTER_OTLP_ENDPOINT=https://localhost:4317 | ||
# this will automatically append the version and signal path | ||
# e.g. https://localhost:4317/v1/traces for `CollectorTraceExporter` and https://localhost:4317/v1/metrics for `CollectorMetricExporter` | ||
``` | ||
If the trace and metric exporter endpoints have different providers, the env var for per-signal endpoints are available to use | ||
```sh | ||
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://trace-service:4317/v1/traces | ||
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://metric-service:4317/v1/metrics | ||
# version and signal needs to be explicit | ||
``` | ||
> The per-signal endpoints take precedence and overrides `OTEL_EXPORTER_OTLP_ENDPOINT` | ||
For more details, see [OpenTelemetry Specification on Protocol Exporter][opentelemetry-spec-protocol-exporter]. | ||
## Running opentelemetry-collector locally to see the traces | ||
@@ -168,2 +190,3 @@ | ||
[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector | ||
[opentelemetry-spec-protocol-exporter]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options | ||
[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
253021
4037
189
+ Added@opentelemetry/core@0.25.0(transitive)
+ Added@opentelemetry/resources@0.25.0(transitive)
+ Added@opentelemetry/sdk-metrics-base@0.25.0(transitive)
+ Added@opentelemetry/sdk-trace-base@0.25.0(transitive)
- Removed@opentelemetry/api-metrics@0.25.1-alpha.21(transitive)
- Removed@opentelemetry/core@0.25.1-alpha.23(transitive)
- Removed@opentelemetry/resources@0.25.1-alpha.23(transitive)
- Removed@opentelemetry/sdk-metrics-base@0.25.1-alpha.23(transitive)
- Removed@opentelemetry/sdk-trace-base@0.25.1-alpha.23(transitive)
Updated@opentelemetry/core@^0.25.0