@glasstrace/sdk 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/{chunk-MV3F7HVX.js → chunk-ZBTC5QIQ.js} +45 -23
- package/dist/{chunk-MV3F7HVX.js.map → chunk-ZBTC5QIQ.js.map} +1 -1
- package/dist/cli/init.cjs +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/index.cjs +134 -111
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/node-entry.cjs +134 -111
- package/dist/node-entry.cjs.map +1 -1
- package/dist/node-entry.js +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
package/dist/node-entry.cjs
CHANGED
|
@@ -18608,7 +18608,7 @@ function getStringFromEnv(key) {
|
|
|
18608
18608
|
}
|
|
18609
18609
|
|
|
18610
18610
|
// ../../node_modules/@opentelemetry/core/build/esm/version.js
|
|
18611
|
-
var VERSION2 = "2.
|
|
18611
|
+
var VERSION2 = "2.7.0";
|
|
18612
18612
|
|
|
18613
18613
|
// ../../node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js
|
|
18614
18614
|
var ATTR_EXCEPTION_MESSAGE = "exception.message";
|
|
@@ -18772,6 +18772,9 @@ function mergeTwoObjects(one, two, level = 0, objects) {
|
|
|
18772
18772
|
const keys = Object.keys(two);
|
|
18773
18773
|
for (let i = 0, j = keys.length; i < j; i++) {
|
|
18774
18774
|
const key = keys[i];
|
|
18775
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
18776
|
+
continue;
|
|
18777
|
+
}
|
|
18775
18778
|
result[key] = takeValue(two[key]);
|
|
18776
18779
|
}
|
|
18777
18780
|
}
|
|
@@ -18784,6 +18787,9 @@ function mergeTwoObjects(one, two, level = 0, objects) {
|
|
|
18784
18787
|
const keys = Object.keys(two);
|
|
18785
18788
|
for (let i = 0, j = keys.length; i < j; i++) {
|
|
18786
18789
|
const key = keys[i];
|
|
18790
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
18791
|
+
continue;
|
|
18792
|
+
}
|
|
18787
18793
|
const twoValue = two[key];
|
|
18788
18794
|
if (isPrimitive(twoValue)) {
|
|
18789
18795
|
if (typeof twoValue === "undefined") {
|
|
@@ -18995,95 +19001,6 @@ function createOtlpExportDelegate(components, settings) {
|
|
|
18995
19001
|
return new OTLPExportDelegate(components.transport, components.serializer, createLoggingPartialSuccessResponseHandler(), components.promiseHandler, settings.timeout);
|
|
18996
19002
|
}
|
|
18997
19003
|
|
|
18998
|
-
// ../../node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js
|
|
18999
|
-
function createResource(resource, encoder) {
|
|
19000
|
-
const result = {
|
|
19001
|
-
attributes: toAttributes(resource.attributes, encoder),
|
|
19002
|
-
droppedAttributesCount: 0
|
|
19003
|
-
};
|
|
19004
|
-
const schemaUrl = resource.schemaUrl;
|
|
19005
|
-
if (schemaUrl && schemaUrl !== "")
|
|
19006
|
-
result.schemaUrl = schemaUrl;
|
|
19007
|
-
return result;
|
|
19008
|
-
}
|
|
19009
|
-
function createInstrumentationScope(scope) {
|
|
19010
|
-
return {
|
|
19011
|
-
name: scope.name,
|
|
19012
|
-
version: scope.version
|
|
19013
|
-
};
|
|
19014
|
-
}
|
|
19015
|
-
function toAttributes(attributes, encoder) {
|
|
19016
|
-
return Object.keys(attributes).map((key) => toKeyValue(key, attributes[key], encoder));
|
|
19017
|
-
}
|
|
19018
|
-
function toKeyValue(key, value, encoder) {
|
|
19019
|
-
return {
|
|
19020
|
-
key,
|
|
19021
|
-
value: toAnyValue(value, encoder)
|
|
19022
|
-
};
|
|
19023
|
-
}
|
|
19024
|
-
function toAnyValue(value, encoder) {
|
|
19025
|
-
const t = typeof value;
|
|
19026
|
-
if (t === "string")
|
|
19027
|
-
return { stringValue: value };
|
|
19028
|
-
if (t === "number") {
|
|
19029
|
-
if (!Number.isInteger(value))
|
|
19030
|
-
return { doubleValue: value };
|
|
19031
|
-
return { intValue: value };
|
|
19032
|
-
}
|
|
19033
|
-
if (t === "boolean")
|
|
19034
|
-
return { boolValue: value };
|
|
19035
|
-
if (value instanceof Uint8Array)
|
|
19036
|
-
return { bytesValue: encoder.encodeUint8Array(value) };
|
|
19037
|
-
if (Array.isArray(value)) {
|
|
19038
|
-
const values = new Array(value.length);
|
|
19039
|
-
for (let i = 0; i < value.length; i++) {
|
|
19040
|
-
values[i] = toAnyValue(value[i], encoder);
|
|
19041
|
-
}
|
|
19042
|
-
return { arrayValue: { values } };
|
|
19043
|
-
}
|
|
19044
|
-
if (t === "object" && value != null) {
|
|
19045
|
-
const keys = Object.keys(value);
|
|
19046
|
-
const values = new Array(keys.length);
|
|
19047
|
-
for (let i = 0; i < keys.length; i++) {
|
|
19048
|
-
values[i] = {
|
|
19049
|
-
key: keys[i],
|
|
19050
|
-
value: toAnyValue(value[keys[i]], encoder)
|
|
19051
|
-
};
|
|
19052
|
-
}
|
|
19053
|
-
return { kvlistValue: { values } };
|
|
19054
|
-
}
|
|
19055
|
-
return {};
|
|
19056
|
-
}
|
|
19057
|
-
|
|
19058
|
-
// ../../node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js
|
|
19059
|
-
function hrTimeToNanos(hrTime2) {
|
|
19060
|
-
const NANOSECONDS = BigInt(1e9);
|
|
19061
|
-
return BigInt(Math.trunc(hrTime2[0])) * NANOSECONDS + BigInt(Math.trunc(hrTime2[1]));
|
|
19062
|
-
}
|
|
19063
|
-
function encodeAsString(hrTime2) {
|
|
19064
|
-
const nanos = hrTimeToNanos(hrTime2);
|
|
19065
|
-
return nanos.toString();
|
|
19066
|
-
}
|
|
19067
|
-
var encodeTimestamp = typeof BigInt !== "undefined" ? encodeAsString : hrTimeToNanoseconds;
|
|
19068
|
-
function identity(value) {
|
|
19069
|
-
return value;
|
|
19070
|
-
}
|
|
19071
|
-
var JSON_ENCODER = {
|
|
19072
|
-
encodeHrTime: encodeTimestamp,
|
|
19073
|
-
encodeSpanContext: identity,
|
|
19074
|
-
encodeOptionalSpanContext: identity,
|
|
19075
|
-
encodeUint8Array: (bytes) => {
|
|
19076
|
-
if (typeof Buffer !== "undefined") {
|
|
19077
|
-
return Buffer.from(bytes).toString("base64");
|
|
19078
|
-
}
|
|
19079
|
-
const chars = new Array(bytes.length);
|
|
19080
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
19081
|
-
chars[i] = String.fromCharCode(bytes[i]);
|
|
19082
|
-
}
|
|
19083
|
-
return btoa(chars.join(""));
|
|
19084
|
-
}
|
|
19085
|
-
};
|
|
19086
|
-
|
|
19087
19004
|
// ../../node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js
|
|
19088
19005
|
init_esm();
|
|
19089
19006
|
|
|
@@ -19228,6 +19145,95 @@ function mergeSchemaUrl(old, updating) {
|
|
|
19228
19145
|
return void 0;
|
|
19229
19146
|
}
|
|
19230
19147
|
|
|
19148
|
+
// ../../node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js
|
|
19149
|
+
function createResource(resource, encoder) {
|
|
19150
|
+
const result = {
|
|
19151
|
+
attributes: toAttributes(resource.attributes, encoder),
|
|
19152
|
+
droppedAttributesCount: 0
|
|
19153
|
+
};
|
|
19154
|
+
const schemaUrl = resource.schemaUrl;
|
|
19155
|
+
if (schemaUrl && schemaUrl !== "")
|
|
19156
|
+
result.schemaUrl = schemaUrl;
|
|
19157
|
+
return result;
|
|
19158
|
+
}
|
|
19159
|
+
function createInstrumentationScope(scope) {
|
|
19160
|
+
return {
|
|
19161
|
+
name: scope.name,
|
|
19162
|
+
version: scope.version
|
|
19163
|
+
};
|
|
19164
|
+
}
|
|
19165
|
+
function toAttributes(attributes, encoder) {
|
|
19166
|
+
return Object.keys(attributes).map((key) => toKeyValue(key, attributes[key], encoder));
|
|
19167
|
+
}
|
|
19168
|
+
function toKeyValue(key, value, encoder) {
|
|
19169
|
+
return {
|
|
19170
|
+
key,
|
|
19171
|
+
value: toAnyValue(value, encoder)
|
|
19172
|
+
};
|
|
19173
|
+
}
|
|
19174
|
+
function toAnyValue(value, encoder) {
|
|
19175
|
+
const t = typeof value;
|
|
19176
|
+
if (t === "string")
|
|
19177
|
+
return { stringValue: value };
|
|
19178
|
+
if (t === "number") {
|
|
19179
|
+
if (!Number.isInteger(value))
|
|
19180
|
+
return { doubleValue: value };
|
|
19181
|
+
return { intValue: value };
|
|
19182
|
+
}
|
|
19183
|
+
if (t === "boolean")
|
|
19184
|
+
return { boolValue: value };
|
|
19185
|
+
if (value instanceof Uint8Array)
|
|
19186
|
+
return { bytesValue: encoder.encodeUint8Array(value) };
|
|
19187
|
+
if (Array.isArray(value)) {
|
|
19188
|
+
const values = new Array(value.length);
|
|
19189
|
+
for (let i = 0; i < value.length; i++) {
|
|
19190
|
+
values[i] = toAnyValue(value[i], encoder);
|
|
19191
|
+
}
|
|
19192
|
+
return { arrayValue: { values } };
|
|
19193
|
+
}
|
|
19194
|
+
if (t === "object" && value != null) {
|
|
19195
|
+
const keys = Object.keys(value);
|
|
19196
|
+
const values = new Array(keys.length);
|
|
19197
|
+
for (let i = 0; i < keys.length; i++) {
|
|
19198
|
+
values[i] = {
|
|
19199
|
+
key: keys[i],
|
|
19200
|
+
value: toAnyValue(value[keys[i]], encoder)
|
|
19201
|
+
};
|
|
19202
|
+
}
|
|
19203
|
+
return { kvlistValue: { values } };
|
|
19204
|
+
}
|
|
19205
|
+
return {};
|
|
19206
|
+
}
|
|
19207
|
+
|
|
19208
|
+
// ../../node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js
|
|
19209
|
+
function hrTimeToNanos(hrTime2) {
|
|
19210
|
+
const NANOSECONDS = BigInt(1e9);
|
|
19211
|
+
return BigInt(Math.trunc(hrTime2[0])) * NANOSECONDS + BigInt(Math.trunc(hrTime2[1]));
|
|
19212
|
+
}
|
|
19213
|
+
function encodeAsString(hrTime2) {
|
|
19214
|
+
const nanos = hrTimeToNanos(hrTime2);
|
|
19215
|
+
return nanos.toString();
|
|
19216
|
+
}
|
|
19217
|
+
var encodeTimestamp = typeof BigInt !== "undefined" ? encodeAsString : hrTimeToNanoseconds;
|
|
19218
|
+
function identity(value) {
|
|
19219
|
+
return value;
|
|
19220
|
+
}
|
|
19221
|
+
var JSON_ENCODER = {
|
|
19222
|
+
encodeHrTime: encodeTimestamp,
|
|
19223
|
+
encodeSpanContext: identity,
|
|
19224
|
+
encodeOptionalSpanContext: identity,
|
|
19225
|
+
encodeUint8Array: (bytes) => {
|
|
19226
|
+
if (typeof Buffer !== "undefined") {
|
|
19227
|
+
return Buffer.from(bytes).toString("base64");
|
|
19228
|
+
}
|
|
19229
|
+
const chars = new Array(bytes.length);
|
|
19230
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
19231
|
+
chars[i] = String.fromCharCode(bytes[i]);
|
|
19232
|
+
}
|
|
19233
|
+
return btoa(chars.join(""));
|
|
19234
|
+
}
|
|
19235
|
+
};
|
|
19236
|
+
|
|
19231
19237
|
// ../../node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js
|
|
19232
19238
|
var SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 256;
|
|
19233
19239
|
var SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 512;
|
|
@@ -19342,6 +19348,7 @@ function spanRecordsToResourceSpans(readableSpans, encoder) {
|
|
|
19342
19348
|
}
|
|
19343
19349
|
|
|
19344
19350
|
// ../../node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js
|
|
19351
|
+
init_esm();
|
|
19345
19352
|
var JsonTraceSerializer = {
|
|
19346
19353
|
serializeRequest: (arg) => {
|
|
19347
19354
|
const request = createExportTraceServiceRequest(arg, JSON_ENCODER);
|
|
@@ -19353,7 +19360,12 @@ var JsonTraceSerializer = {
|
|
|
19353
19360
|
return {};
|
|
19354
19361
|
}
|
|
19355
19362
|
const decoder = new TextDecoder();
|
|
19356
|
-
|
|
19363
|
+
try {
|
|
19364
|
+
return JSON.parse(decoder.decode(arg));
|
|
19365
|
+
} catch (err) {
|
|
19366
|
+
diag2.warn(`Failed to parse trace export response: ${err.message}. Returning empty response`);
|
|
19367
|
+
return {};
|
|
19368
|
+
}
|
|
19357
19369
|
}
|
|
19358
19370
|
};
|
|
19359
19371
|
|
|
@@ -19464,10 +19476,11 @@ function parseRetryAfterToMills(retryAfter) {
|
|
|
19464
19476
|
}
|
|
19465
19477
|
|
|
19466
19478
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/version.js
|
|
19467
|
-
var VERSION3 = "0.
|
|
19479
|
+
var VERSION3 = "0.215.0";
|
|
19468
19480
|
|
|
19469
19481
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
|
|
19470
19482
|
var DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION3}`;
|
|
19483
|
+
var MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;
|
|
19471
19484
|
function sendWithHttp(request, url2, headers, compression, userAgent, agent, data, timeoutMillis) {
|
|
19472
19485
|
return new Promise((resolve3) => {
|
|
19473
19486
|
const parsedUrl = new URL(url2);
|
|
@@ -19486,7 +19499,17 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
|
|
|
19486
19499
|
};
|
|
19487
19500
|
const req = request(options, (res) => {
|
|
19488
19501
|
const responseData = [];
|
|
19489
|
-
|
|
19502
|
+
let responseSize = 0;
|
|
19503
|
+
res.on("data", (chunk) => {
|
|
19504
|
+
responseSize += chunk.length;
|
|
19505
|
+
if (responseSize > MAX_RESPONSE_BODY_SIZE) {
|
|
19506
|
+
const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
|
|
19507
|
+
resolve3({ status: "failure", error: sizeError });
|
|
19508
|
+
res.destroy();
|
|
19509
|
+
return;
|
|
19510
|
+
}
|
|
19511
|
+
responseData.push(chunk);
|
|
19512
|
+
});
|
|
19490
19513
|
res.on("end", () => {
|
|
19491
19514
|
if (res.statusCode && res.statusCode <= 299) {
|
|
19492
19515
|
resolve3({
|
|
@@ -20689,7 +20712,7 @@ function samplingDecisionToString(decision) {
|
|
|
20689
20712
|
}
|
|
20690
20713
|
|
|
20691
20714
|
// ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js
|
|
20692
|
-
var VERSION4 = "2.
|
|
20715
|
+
var VERSION4 = "2.7.0";
|
|
20693
20716
|
|
|
20694
20717
|
// ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js
|
|
20695
20718
|
var Tracer = class {
|
|
@@ -21456,24 +21479,24 @@ function detectSentry() {
|
|
|
21456
21479
|
}
|
|
21457
21480
|
|
|
21458
21481
|
// src/otel-config.ts
|
|
21459
|
-
var
|
|
21460
|
-
var
|
|
21461
|
-
var
|
|
21462
|
-
var
|
|
21482
|
+
var resolvedApiKey = API_KEY_PENDING;
|
|
21483
|
+
var activeExporter = null;
|
|
21484
|
+
var additionalExporters = [];
|
|
21485
|
+
var injectedProcessor = null;
|
|
21463
21486
|
function setResolvedApiKey(key) {
|
|
21464
|
-
|
|
21487
|
+
resolvedApiKey = key;
|
|
21465
21488
|
}
|
|
21466
21489
|
function getResolvedApiKey() {
|
|
21467
|
-
return
|
|
21490
|
+
return resolvedApiKey;
|
|
21468
21491
|
}
|
|
21469
21492
|
function notifyApiKeyResolved() {
|
|
21470
|
-
|
|
21471
|
-
for (const exporter of
|
|
21493
|
+
activeExporter?.notifyKeyResolved();
|
|
21494
|
+
for (const exporter of additionalExporters) {
|
|
21472
21495
|
exporter.notifyKeyResolved();
|
|
21473
21496
|
}
|
|
21474
21497
|
}
|
|
21475
21498
|
function registerExporterForKeyNotification(exporter) {
|
|
21476
|
-
|
|
21499
|
+
additionalExporters.push(exporter);
|
|
21477
21500
|
}
|
|
21478
21501
|
async function tryImport(moduleId) {
|
|
21479
21502
|
try {
|
|
@@ -21516,7 +21539,7 @@ async function runCoexistencePath(existingProvider, config2) {
|
|
|
21516
21539
|
return;
|
|
21517
21540
|
}
|
|
21518
21541
|
if (result !== null) {
|
|
21519
|
-
|
|
21542
|
+
injectedProcessor = result.processor;
|
|
21520
21543
|
if (config2.verbose) {
|
|
21521
21544
|
sdkLog(
|
|
21522
21545
|
"info",
|
|
@@ -21527,8 +21550,8 @@ async function runCoexistencePath(existingProvider, config2) {
|
|
|
21527
21550
|
name: "coexistence-flush",
|
|
21528
21551
|
priority: 5,
|
|
21529
21552
|
fn: async () => {
|
|
21530
|
-
if (
|
|
21531
|
-
await
|
|
21553
|
+
if (injectedProcessor) {
|
|
21554
|
+
await injectedProcessor.forceFlush();
|
|
21532
21555
|
}
|
|
21533
21556
|
}
|
|
21534
21557
|
});
|
|
@@ -21564,7 +21587,7 @@ async function runRegistrationPath(config2, sessionManager) {
|
|
|
21564
21587
|
createDelegate: createOtlpExporter,
|
|
21565
21588
|
verbose: config2.verbose
|
|
21566
21589
|
});
|
|
21567
|
-
|
|
21590
|
+
activeExporter = glasstraceExporter;
|
|
21568
21591
|
const vercelOtel = await tryImport("@vercel/otel");
|
|
21569
21592
|
if (vercelOtel && typeof vercelOtel.registerOTel === "function") {
|
|
21570
21593
|
const otelConfig = {
|
|
@@ -21897,7 +21920,7 @@ function registerGlasstrace(options) {
|
|
|
21897
21920
|
setCoreState(CoreState.REGISTERING);
|
|
21898
21921
|
startRuntimeStateWriter({
|
|
21899
21922
|
projectRoot: process.cwd(),
|
|
21900
|
-
sdkVersion: "1.0
|
|
21923
|
+
sdkVersion: "1.1.0"
|
|
21901
21924
|
});
|
|
21902
21925
|
const config2 = resolveConfig(options);
|
|
21903
21926
|
if (config2.verbose) {
|
|
@@ -22063,8 +22086,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22063
22086
|
if (config2.verbose) {
|
|
22064
22087
|
console.info("[glasstrace] Background init firing.");
|
|
22065
22088
|
}
|
|
22066
|
-
const healthReport = collectHealthReport("1.0
|
|
22067
|
-
const initResult = await performInit(config2, anonKeyForInit, "1.0
|
|
22089
|
+
const healthReport = collectHealthReport("1.1.0");
|
|
22090
|
+
const initResult = await performInit(config2, anonKeyForInit, "1.1.0", healthReport);
|
|
22068
22091
|
if (generation !== registrationGeneration) return;
|
|
22069
22092
|
const currentState = getCoreState();
|
|
22070
22093
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -22087,7 +22110,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22087
22110
|
}
|
|
22088
22111
|
maybeInstallConsoleCapture();
|
|
22089
22112
|
if (didLastInitSucceed()) {
|
|
22090
|
-
startHeartbeat(config2, anonKeyForInit, "1.0
|
|
22113
|
+
startHeartbeat(config2, anonKeyForInit, "1.1.0", generation, (newApiKey, accountId) => {
|
|
22091
22114
|
setAuthState(AuthState.CLAIMING);
|
|
22092
22115
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
22093
22116
|
setResolvedApiKey(newApiKey);
|