@opentelemetry/exporter-collector
Advanced tools
Comparing version 0.11.1-alpha.36 to 0.11.1-alpha.44
@@ -57,5 +57,3 @@ "use strict"; | ||
.catch((error) => { | ||
if (error.message) { | ||
this.logger.error(error.message); | ||
} | ||
core_1.globalErrorHandler(error); | ||
if (error.code && error.code < 500) { | ||
@@ -62,0 +60,0 @@ resultCallback(core_1.ExportResult.FAILED_NOT_RETRYABLE); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sendWithXhr = exports.sendWithBeacon = void 0; | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const collectorTypes = require("../../types"); | ||
/** | ||
@@ -16,4 +32,4 @@ * Send metrics/spans using browser navigator.sendBeacon | ||
else { | ||
logger.error('sendBeacon - cannot send', body); | ||
onError({}); | ||
const error = new collectorTypes.CollectorExporterError(`sendBeacon - cannot send ${body}`); | ||
onError(error); | ||
} | ||
@@ -45,8 +61,4 @@ } | ||
else { | ||
logger.error('body', body); | ||
logger.error('xhr error', xhr); | ||
onError({ | ||
code: xhr.status, | ||
message: xhr.responseText, | ||
}); | ||
const error = new collectorTypes.CollectorExporterError(xhr.responseText, xhr.status); | ||
onError(error); | ||
} | ||
@@ -53,0 +65,0 @@ } |
@@ -20,3 +20,2 @@ "use strict"; | ||
const CollectorExporterBase_1 = require("../../CollectorExporterBase"); | ||
const collectorTypes = require("../../types"); | ||
const util_1 = require("../../util"); | ||
@@ -30,5 +29,3 @@ const util_2 = require("./util"); | ||
super(config); | ||
this.DEFAULT_HEADERS = { | ||
[collectorTypes.OT_REQUEST_HEADER]: '1', | ||
}; | ||
this.DEFAULT_HEADERS = {}; | ||
if (config.metadata) { | ||
@@ -35,0 +32,0 @@ this.logger.warn('Metadata cannot be set when using http'); |
@@ -22,2 +22,3 @@ "use strict"; | ||
const https = require("https"); | ||
const collectorTypes = require("../../types"); | ||
/** | ||
@@ -47,14 +48,8 @@ * Sends data using http | ||
else { | ||
collector.logger.error(`statusCode: ${res.statusCode}`); | ||
onError({ | ||
code: res.statusCode, | ||
message: res.statusMessage, | ||
}); | ||
const error = new collectorTypes.CollectorExporterError(res.statusMessage, res.statusCode); | ||
onError(error); | ||
} | ||
}); | ||
req.on('error', (error) => { | ||
collector.logger.error('error', error.message); | ||
onError({ | ||
message: error.message, | ||
}); | ||
onError(error); | ||
}); | ||
@@ -61,0 +56,0 @@ req.write(data); |
import { SpanKind, Logger, Attributes } from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api'; | ||
export declare const OT_REQUEST_HEADER = "x-opentelemetry-outgoing-request"; | ||
export declare namespace opentelemetryProto { | ||
@@ -218,6 +217,6 @@ namespace collector { | ||
*/ | ||
export interface CollectorExporterError { | ||
code?: number; | ||
message?: string; | ||
stack?: string; | ||
export declare class CollectorExporterError extends Error { | ||
readonly code?: number; | ||
readonly name: string; | ||
constructor(message?: string, code?: number); | ||
} | ||
@@ -228,2 +227,3 @@ /** | ||
export interface ExportServiceError { | ||
name: string; | ||
code: number; | ||
@@ -230,0 +230,0 @@ details: string; |
@@ -18,6 +18,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.COLLECTOR_SPAN_KIND_MAPPING = exports.opentelemetryProto = exports.OT_REQUEST_HEADER = void 0; | ||
exports.COLLECTOR_SPAN_KIND_MAPPING = exports.CollectorExporterError = exports.opentelemetryProto = void 0; | ||
const api_1 = require("@opentelemetry/api"); | ||
// header to prevent instrumentation on request | ||
exports.OT_REQUEST_HEADER = 'x-opentelemetry-outgoing-request'; | ||
/* eslint-disable @typescript-eslint/no-namespace */ | ||
@@ -91,2 +89,13 @@ var opentelemetryProto; | ||
/** | ||
* Interface for handling error | ||
*/ | ||
class CollectorExporterError extends Error { | ||
constructor(message, code) { | ||
super(message); | ||
this.name = 'CollectorExporterError'; | ||
this.code = code; | ||
} | ||
} | ||
exports.CollectorExporterError = CollectorExporterError; | ||
/** | ||
* Mapping between api SpanKind and proto SpanKind | ||
@@ -93,0 +102,0 @@ */ |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.11.1-alpha.36+6eb157c6"; | ||
export declare const VERSION = "0.11.1-alpha.44+240f852c"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.11.1-alpha.36+6eb157c6'; | ||
exports.VERSION = '0.11.1-alpha.44+240f852c'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/exporter-collector", | ||
"version": "0.11.1-alpha.36+6eb157c6", | ||
"version": "0.11.1-alpha.44+240f852c", | ||
"description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", | ||
@@ -82,10 +82,10 @@ "main": "build/src/index.js", | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.11.1-alpha.36+6eb157c6", | ||
"@opentelemetry/core": "^0.11.1-alpha.36+6eb157c6", | ||
"@opentelemetry/metrics": "^0.11.1-alpha.36+6eb157c6", | ||
"@opentelemetry/resources": "^0.11.1-alpha.36+6eb157c6", | ||
"@opentelemetry/tracing": "^0.11.1-alpha.36+6eb157c6", | ||
"@opentelemetry/api": "^0.11.1-alpha.44+240f852c", | ||
"@opentelemetry/core": "^0.11.1-alpha.44+240f852c", | ||
"@opentelemetry/metrics": "^0.11.1-alpha.44+240f852c", | ||
"@opentelemetry/resources": "^0.11.1-alpha.44+240f852c", | ||
"@opentelemetry/tracing": "^0.11.1-alpha.44+240f852c", | ||
"axios": "^0.19.2" | ||
}, | ||
"gitHead": "6eb157c66925fe84b4960f247a86678441f3cb60" | ||
"gitHead": "240f852cc41707c751f28811b7ce3d243382e3dd" | ||
} |
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
121568
1895