@splitsoftware/browser-rum-agent
Advanced tools
Comparing version 0.5.1-rc.0 to 0.5.1-rc.1
"use strict"; | ||
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); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.openTelemetryIntegration = void 0; | ||
exports.openTelemetryIntegration = exports.convert = void 0; | ||
var core_1 = require("@opentelemetry/core"); | ||
// Convert span to an Split event | ||
var sanitizeEventTypeId_1 = require("../utils/sanitizeEventTypeId"); | ||
// Convert span to Split event | ||
function convert(span) { | ||
var duration = Math.round((0, core_1.hrTimeToMicroseconds)(span.duration)); | ||
var duration = span.duration ? Math.round((0, core_1.hrTimeToMilliseconds)(span.duration)) : undefined; | ||
return { | ||
eventTypeId: span.name, | ||
eventTypeId: (0, sanitizeEventTypeId_1.sanitizeEventTypeId)(span.name), | ||
value: duration, | ||
timestamp: (0, core_1.hrTimeToMicroseconds)(span.startTime), | ||
properties: { | ||
duration: duration, | ||
// @TODO map these | ||
// attributes: span.attributes, | ||
// status: span.status, | ||
// events: span.events, | ||
// resource: span.resource, | ||
// @TODO should we map these? | ||
// traceId: span.spanContext().traceId, | ||
// parentId: span.parentSpanId, | ||
// id: span.spanContext().spanId, | ||
// kind: SPAN_KIND_MAPPING[span.kind], | ||
// droppedAttributesCount: span.droppedAttributesCount, | ||
// droppedEventsCount: span.droppedEventsCount, | ||
// droppedLinksCount: span.droppedLinksCount, | ||
// links: span.links, | ||
} | ||
timestamp: span.startTime ? Math.round((0, core_1.hrTimeToMilliseconds)(span.startTime)) : undefined, | ||
properties: __assign(__assign(__assign(__assign({}, (duration ? { duration: duration } : {})), (span.attributes || {})), (span.resource && span.resource.attributes || {})), (span.events && span.events.reduce(function (props, event) { | ||
var _a; | ||
return (__assign(__assign({}, props), (_a = {}, _a[event.name] = Math.round((0, core_1.hrTimeToMilliseconds)(event.time)), _a))); | ||
}, {}) || {})) | ||
}; | ||
} | ||
exports.convert = convert; | ||
function openTelemetryIntegration(options) { | ||
@@ -32,0 +32,0 @@ if (options === void 0) { options = {}; } |
@@ -38,2 +38,2 @@ "use strict"; | ||
exports.userAgent = getUserAgent(); | ||
exports.languageVersion = 'jsrum-' + '0.5.1-rc.0'; | ||
exports.languageVersion = 'jsrum-' + '0.5.1-rc.1'; |
@@ -1,26 +0,25 @@ | ||
import { ExportResultCode, hrTimeToMicroseconds } from '@opentelemetry/core'; | ||
// Convert span to an Split event | ||
function convert(span) { | ||
var duration = Math.round(hrTimeToMicroseconds(span.duration)); | ||
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 { ExportResultCode, hrTimeToMilliseconds } from '@opentelemetry/core'; | ||
import { sanitizeEventTypeId } from '../utils/sanitizeEventTypeId'; | ||
// Convert span to Split event | ||
export function convert(span) { | ||
var duration = span.duration ? Math.round(hrTimeToMilliseconds(span.duration)) : undefined; | ||
return { | ||
eventTypeId: span.name, | ||
eventTypeId: sanitizeEventTypeId(span.name), | ||
value: duration, | ||
timestamp: hrTimeToMicroseconds(span.startTime), | ||
properties: { | ||
duration: duration, | ||
// @TODO map these | ||
// attributes: span.attributes, | ||
// status: span.status, | ||
// events: span.events, | ||
// resource: span.resource, | ||
// @TODO should we map these? | ||
// traceId: span.spanContext().traceId, | ||
// parentId: span.parentSpanId, | ||
// id: span.spanContext().spanId, | ||
// kind: SPAN_KIND_MAPPING[span.kind], | ||
// droppedAttributesCount: span.droppedAttributesCount, | ||
// droppedEventsCount: span.droppedEventsCount, | ||
// droppedLinksCount: span.droppedLinksCount, | ||
// links: span.links, | ||
} | ||
timestamp: span.startTime ? Math.round(hrTimeToMilliseconds(span.startTime)) : undefined, | ||
properties: __assign(__assign(__assign(__assign({}, (duration ? { duration: duration } : {})), (span.attributes || {})), (span.resource && span.resource.attributes || {})), (span.events && span.events.reduce(function (props, event) { | ||
var _a; | ||
return (__assign(__assign({}, props), (_a = {}, _a[event.name] = Math.round(hrTimeToMilliseconds(event.time)), _a))); | ||
}, {}) || {})) | ||
}; | ||
@@ -27,0 +26,0 @@ } |
@@ -31,2 +31,2 @@ /* eslint-disable compat/compat */ | ||
export var userAgent = getUserAgent(); | ||
export var languageVersion = 'jsrum-' + '0.5.1-rc.0'; | ||
export var languageVersion = 'jsrum-' + '0.5.1-rc.1'; |
{ | ||
"name": "@splitsoftware/browser-rum-agent", | ||
"version": "0.5.1-rc.0", | ||
"version": "0.5.1-rc.1", | ||
"description": "Split Software RUM Agent for Browsers.", | ||
@@ -5,0 +5,0 @@ "main": "cjs/index.js", |
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
139603
75
2943