@dynatrace/opentelemetry-core
Version:
Dynatrace OpenTelemetry core package
49 lines (46 loc) • 1.93 kB
JavaScript
;
/*
Copyright 2022 Dynatrace LLC
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
http://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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.setXDtc = setXDtc;
exports.getXDtc = getXDtc;
exports.setServerId = setServerId;
exports.getServerId = getServerId;
exports.setMobileTag = setMobileTag;
exports.getMobileTag = getMobileTag;
const api_1 = require("@opentelemetry/api");
const cXDtcContextKey = (0, api_1.createContextKey)("Dynatrace x-dtc header");
const cServerIdContextKey = (0, api_1.createContextKey)("Dynatrace x-dtc server ID");
const cMobileTagContextKey = (0, api_1.createContextKey)("Dynatrace mobile tag");
function setXDtc(context, xDtc) {
return context.setValue(cXDtcContextKey, xDtc);
}
function getXDtc(context) {
const xDtc = context.getValue(cXDtcContextKey);
return typeof (xDtc) === "string" ? xDtc : undefined;
}
function setServerId(context, serverId) {
return context.setValue(cServerIdContextKey, serverId);
}
function getServerId(context) {
const serverId = context.getValue(cServerIdContextKey);
return typeof (serverId) === "number" ? serverId : undefined;
}
function setMobileTag(context, mt) {
return context.setValue(cMobileTagContextKey, mt);
}
function getMobileTag(context) {
const mt = context.getValue(cMobileTagContextKey);
return typeof (mt) === "string" ? mt : undefined;
}
//# sourceMappingURL=RumLite.js.map