@dash0/sdk-web 0.13.4 → 0.13.5
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/dist/dash0.iife.js +1 -1
- package/dist/dash0.iife.js.map +1 -1
- package/dist/dash0.js +1 -1
- package/dist/dash0.js.map +1 -1
- package/dist/dash0.umd.cjs +1 -1
- package/dist/dash0.umd.cjs.map +1 -1
- package/dist/modules/types/errors.js +1 -0
- package/dist/modules/types/globals.js +1 -0
- package/dist/modules/types/otlp.js +1 -0
- package/dist/modules/vars.js +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/api/attributes.d.ts +1 -1
- package/dist/types/api/events.d.ts +1 -1
- package/dist/types/api/init.d.ts +1 -1
- package/dist/types/api/report-error.d.ts +1 -1
- package/dist/types/attributes/common.d.ts +1 -1
- package/dist/types/attributes/url.d.ts +1 -1
- package/dist/types/instrumentations/errors/unhandled-error.d.ts +1 -1
- package/dist/types/transport/index.d.ts +1 -1
- package/dist/types/types/errors.d.ts +8 -0
- package/dist/types/types/globals.d.ts +12 -0
- package/dist/types/types/otlp.d.ts +104 -0
- package/dist/types/utils/otel/attributes.d.ts +1 -1
- package/dist/types/utils/otel/error.d.ts +1 -1
- package/dist/types/utils/otel/span.d.ts +1 -1
- package/dist/types/vars.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/attributes.ts +1 -1
- package/src/api/events.ts +1 -1
- package/src/api/init.ts +1 -1
- package/src/api/report-error.ts +1 -1
- package/src/attributes/common.ts +1 -1
- package/src/attributes/common_test.ts +1 -1
- package/src/attributes/url.ts +1 -1
- package/src/instrumentations/errors/unhandled-error.ts +2 -2
- package/src/instrumentations/navigation/event.ts +1 -1
- package/src/instrumentations/navigation/page-load.ts +1 -1
- package/src/instrumentations/web-vitals.ts +1 -1
- package/src/transport/index.ts +1 -1
- package/src/types/errors.ts +9 -0
- package/src/types/globals.ts +19 -0
- package/src/types/otlp.ts +121 -0
- package/src/utils/otel/attributes.ts +1 -1
- package/src/utils/otel/attributes_test.ts +1 -1
- package/src/utils/otel/error.ts +1 -1
- package/src/utils/otel/span.ts +1 -1
- package/src/vars.ts +1 -3
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { LOG_SEVERITY_NUMBER, LOG_SEVERITY_TEXT } from "../semantic-conventions";
|
|
2
|
+
export type AnyValue = {
|
|
3
|
+
["stringValue"]?: string;
|
|
4
|
+
["boolValue"]?: boolean;
|
|
5
|
+
/** Format: int64 */
|
|
6
|
+
["intValue"]?: string;
|
|
7
|
+
/** Format: double */
|
|
8
|
+
["doubleValue"]?: number;
|
|
9
|
+
["arrayValue"]?: ArrayValue;
|
|
10
|
+
["kvlistValue"]?: KeyValueList;
|
|
11
|
+
/** Format: byte */
|
|
12
|
+
["bytesValue"]?: string;
|
|
13
|
+
};
|
|
14
|
+
export type ArrayValue = {
|
|
15
|
+
["values"]: AnyValue[];
|
|
16
|
+
};
|
|
17
|
+
export type KeyValue = {
|
|
18
|
+
["key"]: string;
|
|
19
|
+
["value"]: AnyValue;
|
|
20
|
+
};
|
|
21
|
+
export type KeyValueList = {
|
|
22
|
+
["values"]: KeyValue[];
|
|
23
|
+
};
|
|
24
|
+
export type Resource = {
|
|
25
|
+
["attributes"]: KeyValue[];
|
|
26
|
+
};
|
|
27
|
+
export type InstrumentationScope = {
|
|
28
|
+
["name"]?: string;
|
|
29
|
+
["version"]?: string;
|
|
30
|
+
["attributes"]: KeyValue[];
|
|
31
|
+
};
|
|
32
|
+
export type ExportLogsServiceRequest = {
|
|
33
|
+
resourceLogs: ResourceLogs[];
|
|
34
|
+
};
|
|
35
|
+
export type ResourceLogs = {
|
|
36
|
+
resource: Resource;
|
|
37
|
+
scopeLogs: ScopeLogs[];
|
|
38
|
+
};
|
|
39
|
+
export type ScopeLogs = {
|
|
40
|
+
scope?: InstrumentationScope;
|
|
41
|
+
logRecords: LogRecord[];
|
|
42
|
+
schemaUrl?: string;
|
|
43
|
+
};
|
|
44
|
+
export type LogRecord = {
|
|
45
|
+
/** Format: uint64 */
|
|
46
|
+
timeUnixNano: string;
|
|
47
|
+
severityNumber?: LOG_SEVERITY_NUMBER;
|
|
48
|
+
severityText?: LOG_SEVERITY_TEXT;
|
|
49
|
+
body?: AnyValue;
|
|
50
|
+
attributes: KeyValue[];
|
|
51
|
+
/** Format: byte */
|
|
52
|
+
traceId?: string;
|
|
53
|
+
/** Format: byte */
|
|
54
|
+
spanId?: string;
|
|
55
|
+
};
|
|
56
|
+
export type ExportTraceServiceRequest = {
|
|
57
|
+
resourceSpans: ResourceSpans[];
|
|
58
|
+
};
|
|
59
|
+
export type ResourceSpans = {
|
|
60
|
+
resource: Resource;
|
|
61
|
+
scopeSpans: ScopeSpans[];
|
|
62
|
+
};
|
|
63
|
+
export type ScopeSpans = {
|
|
64
|
+
scope?: InstrumentationScope;
|
|
65
|
+
spans: Span[];
|
|
66
|
+
};
|
|
67
|
+
export type SpanStatus = {
|
|
68
|
+
message?: string;
|
|
69
|
+
code: 0 | 1 | 2;
|
|
70
|
+
};
|
|
71
|
+
export type SpanEvent = {
|
|
72
|
+
timeUnixNano: string;
|
|
73
|
+
name: string;
|
|
74
|
+
attributes: KeyValue[];
|
|
75
|
+
};
|
|
76
|
+
export type SpanLink = {
|
|
77
|
+
/** Format: byte */
|
|
78
|
+
traceId: string;
|
|
79
|
+
/** Format: byte */
|
|
80
|
+
spanId: string;
|
|
81
|
+
traceState?: string;
|
|
82
|
+
attributes: KeyValue[];
|
|
83
|
+
droppedAttributesCount: number;
|
|
84
|
+
flags?: number;
|
|
85
|
+
};
|
|
86
|
+
export type Span = {
|
|
87
|
+
/** Format: byte */
|
|
88
|
+
traceId: string;
|
|
89
|
+
/** Format: byte */
|
|
90
|
+
spanId: string;
|
|
91
|
+
traceState?: string;
|
|
92
|
+
/** Format: byte */
|
|
93
|
+
parentSpanId?: string;
|
|
94
|
+
name: string;
|
|
95
|
+
kind: number;
|
|
96
|
+
startTimeUnixNano: string;
|
|
97
|
+
endTimeUnixNano: string;
|
|
98
|
+
attributes: KeyValue[];
|
|
99
|
+
events: SpanEvent[];
|
|
100
|
+
/** Format: int64 */
|
|
101
|
+
droppedEventsCount?: number;
|
|
102
|
+
links: SpanLink[];
|
|
103
|
+
status: SpanStatus;
|
|
104
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyValue, KeyValue } from "
|
|
1
|
+
import { AnyValue, KeyValue } from "../../types/otlp";
|
|
2
2
|
type PrimitiveAttributeValue = string | number | boolean;
|
|
3
3
|
export type AttributeValueType = PrimitiveAttributeValue | Array<PrimitiveAttributeValue> | Record<string, PrimitiveAttributeValue>;
|
|
4
4
|
export declare function toAnyValue(value: AttributeValueType | AnyValue): AnyValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KeyValue, Span, SpanStatus } from "
|
|
1
|
+
import { KeyValue, Span, SpanStatus } from "../../types/otlp";
|
|
2
2
|
export type InProgressSpan = Omit<Span, "endTimeUnixNano">;
|
|
3
3
|
export declare function startSpan(name: string): InProgressSpan;
|
|
4
4
|
export declare function endSpan(span: InProgressSpan, status: SpanStatus | undefined, durationNano: number | undefined): Span;
|
package/dist/types/vars.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AnyValue, InstrumentationScope, KeyValue, Resource } from "../types/otlp";
|
|
2
1
|
import { AttributeValueType } from "./utils/otel";
|
|
2
|
+
import { AnyValue, InstrumentationScope, KeyValue, Resource } from "./types/otlp";
|
|
3
3
|
export type Endpoint = {
|
|
4
4
|
/**
|
|
5
5
|
* OTLP HTTP URL excluding the /v1/* prefix
|
package/package.json
CHANGED
package/src/api/attributes.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AnyValue } from "../../types/otlp";
|
|
2
1
|
import { addAttribute, AttributeValueType, removeAttribute } from "../utils/otel";
|
|
3
2
|
import { vars } from "../vars";
|
|
3
|
+
import { AnyValue } from "../types/otlp";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Adds a signal attribute to be transmitted with every signal.
|
package/src/api/events.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AnyValue, KeyValue } from "../../types/otlp";
|
|
2
1
|
import { EVENT_NAME, EVENT_NAMES, WEB_EVENT_TITLE, LOG_SEVERITIES, LOG_SEVERITY_TEXT } from "../semantic-conventions";
|
|
3
2
|
import { sendLog } from "../transport";
|
|
4
3
|
import { addCommonAttributes } from "../attributes";
|
|
5
4
|
import { addAttribute, AttributeValueType, toAnyValue } from "../utils/otel";
|
|
6
5
|
import { nowNanos, TimeInput, toNanosTs, warn } from "../utils";
|
|
6
|
+
import { AnyValue, KeyValue } from "../types/otlp";
|
|
7
7
|
|
|
8
8
|
type EventOptions = {
|
|
9
9
|
/**
|
package/src/api/init.ts
CHANGED
|
@@ -25,10 +25,10 @@ import { startWebVitalsInstrumentation } from "../instrumentations/web-vitals";
|
|
|
25
25
|
import { startErrorInstrumentation } from "../instrumentations/errors";
|
|
26
26
|
import { addAttribute, AttributeValueType } from "../utils/otel";
|
|
27
27
|
import { instrumentFetch } from "../instrumentations/http/fetch";
|
|
28
|
-
import { AnyValue } from "../../types/otlp";
|
|
29
28
|
import { startNavigationInstrumentation } from "../instrumentations/navigation";
|
|
30
29
|
import { merge } from "ts-deepmerge";
|
|
31
30
|
import { initializeTabId } from "../utils/tab-id";
|
|
31
|
+
import { AnyValue } from "../types/otlp";
|
|
32
32
|
|
|
33
33
|
export type InitOptions = {
|
|
34
34
|
serviceName: string;
|
package/src/api/report-error.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorLike, ReportErrorOpts } from "../../types/errors";
|
|
2
1
|
import { reportError as reportErrorInternal } from "../instrumentations/errors/unhandled-error";
|
|
2
|
+
import { ReportErrorOpts, ErrorLike } from "../types/errors";
|
|
3
3
|
|
|
4
4
|
export function reportError(error: string | ErrorLike, opts?: ReportErrorOpts) {
|
|
5
5
|
reportErrorInternal(error, opts);
|
package/src/attributes/common.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { KeyValue } from "../../types/otlp";
|
|
2
1
|
import { generateUniqueId, nav, NO_VALUE_FALLBACK, WEB_EVENT_ID_BYTES, win } from "../utils";
|
|
3
2
|
import {
|
|
4
3
|
BROWSER_TAB_ID,
|
|
@@ -14,6 +13,7 @@ import { vars } from "../vars";
|
|
|
14
13
|
import { addAttribute } from "../utils/otel";
|
|
15
14
|
import { addUrlAttributes } from "./url";
|
|
16
15
|
import { tabId } from "../utils/tab-id";
|
|
16
|
+
import { KeyValue } from "../types/otlp";
|
|
17
17
|
|
|
18
18
|
type Options = {
|
|
19
19
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
2
|
import { addCommonAttributes } from "./common";
|
|
3
|
-
import { KeyValue } from "../../types/otlp";
|
|
4
3
|
import * as utils from "../utils";
|
|
5
4
|
import * as varsModule from "../vars";
|
|
6
5
|
import * as urlModule from "./url";
|
|
7
6
|
import * as sessionApi from "../api/session";
|
|
8
7
|
import * as tabIdModule from "../utils/tab-id";
|
|
8
|
+
import { KeyValue } from "../types/otlp";
|
|
9
9
|
|
|
10
10
|
describe("addCommonAttributes", () => {
|
|
11
11
|
beforeEach(() => {
|
package/src/attributes/url.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { KeyValue } from "../../types/otlp";
|
|
2
1
|
import { addAttribute, AttrPrefix, withPrefix } from "../utils/otel";
|
|
3
2
|
import { URL_DOMAIN, URL_FRAGMENT, URL_FULL, URL_PATH, URL_QUERY, URL_SCHEME } from "../semantic-conventions";
|
|
4
3
|
import { parseUrl } from "../utils";
|
|
4
|
+
import { KeyValue } from "../types/otlp";
|
|
5
5
|
|
|
6
6
|
export function addUrlAttributes(attributes: KeyValue[], url: string | URL, prefix?: AttrPrefix) {
|
|
7
7
|
const applyPrefix = withPrefix(prefix);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { KeyValue, LogRecord } from "../../../types/otlp";
|
|
2
1
|
import { hasOwnProperty, nowNanos, win } from "../../utils";
|
|
3
|
-
import { ErrorLike, ReportErrorOpts } from "../../../types/errors";
|
|
4
2
|
import { isErrorMessageIgnored } from "../../utils/ignore-rules";
|
|
5
3
|
import { sendLog } from "../../transport";
|
|
6
4
|
import {
|
|
@@ -14,6 +12,8 @@ import {
|
|
|
14
12
|
} from "../../semantic-conventions";
|
|
15
13
|
import { addAttribute } from "../../utils/otel";
|
|
16
14
|
import { addCommonAttributes } from "../../attributes";
|
|
15
|
+
import { KeyValue, LogRecord } from "../../types/otlp";
|
|
16
|
+
import { ReportErrorOpts, ErrorLike } from "../../types/errors";
|
|
17
17
|
|
|
18
18
|
type TrackedError = {
|
|
19
19
|
seenCount: number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { KeyValue, LogRecord } from "../../../types/otlp";
|
|
2
1
|
import { addAttribute, getTraceContextForPageLoad } from "../../utils/otel";
|
|
3
2
|
import {
|
|
4
3
|
EVENT_NAME,
|
|
@@ -13,6 +12,7 @@ import { doc, NO_VALUE_FALLBACK } from "../../utils";
|
|
|
13
12
|
import { addCommonAttributes } from "../../attributes";
|
|
14
13
|
import { sendLog } from "../../transport";
|
|
15
14
|
import { PageViewMeta, vars } from "../../vars";
|
|
15
|
+
import { KeyValue, LogRecord } from "../../types/otlp";
|
|
16
16
|
|
|
17
17
|
function getPageViewMeta(url?: URL): PageViewMeta {
|
|
18
18
|
if (!url) return {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { addEventListener, debug, doc, win, roundToTwoDecimals, error, toNanosTs, getTimeOrigin } from "../../utils";
|
|
2
|
-
import { KeyValue, LogRecord } from "../../../types/otlp";
|
|
3
2
|
import { EVENT_NAME, EVENT_NAMES, LOG_SEVERITIES } from "../../semantic-conventions";
|
|
4
3
|
import { sendLog } from "../../transport";
|
|
5
4
|
import { getTraceContextForPageLoad, addAttribute } from "../../utils/otel";
|
|
6
5
|
import { addCommonAttributes } from "../../attributes";
|
|
7
6
|
import { transmitPageViewEvent } from "./event";
|
|
7
|
+
import { KeyValue, LogRecord } from "../../types/otlp";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Tracks page loads as per this OTel spec:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { onLCP, onINP, onCLS, Metric } from "web-vitals";
|
|
2
|
-
import { KeyValue, LogRecord } from "
|
|
2
|
+
import { KeyValue, LogRecord } from "../types/otlp";
|
|
3
3
|
import { EVENT_NAME, EVENT_NAMES, LOG_SEVERITIES } from "../semantic-conventions";
|
|
4
4
|
import { nowNanos, roundToTwoDecimals } from "../utils";
|
|
5
5
|
import { sendLog } from "../transport";
|
package/src/transport/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ExportLogsServiceRequest, ExportTraceServiceRequest, LogRecord, Span } from "../../types/otlp";
|
|
2
1
|
import { newBatcher } from "./batcher";
|
|
3
2
|
import { send } from "./fetch";
|
|
4
3
|
import { vars } from "../vars";
|
|
5
4
|
import { createRateLimiter } from "../utils/rate-limit";
|
|
6
5
|
import { debug, error } from "../utils";
|
|
6
|
+
import { ExportLogsServiceRequest, ExportTraceServiceRequest, LogRecord, Span } from "../types/otlp";
|
|
7
7
|
|
|
8
8
|
const logBatcher = newBatcher<LogRecord>(sendLogs);
|
|
9
9
|
const spanBatcher = newBatcher<Span>(sendSpans);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Ensure this is treated as a module.
|
|
2
|
+
export {};
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
Zone?: any;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type ErrorLike = {
|
|
10
|
+
message: string;
|
|
11
|
+
stack?: string;
|
|
12
|
+
|
|
13
|
+
// to permit ['foo'] based access that doesn't break
|
|
14
|
+
// when pushed through the Closure compiler
|
|
15
|
+
[key: string]: number | string | null | undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
let __sdkVersion: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { LOG_SEVERITY_NUMBER, LOG_SEVERITY_TEXT } from "../semantic-conventions";
|
|
2
|
+
|
|
3
|
+
export type AnyValue = {
|
|
4
|
+
["stringValue"]?: string;
|
|
5
|
+
["boolValue"]?: boolean;
|
|
6
|
+
/** Format: int64 */
|
|
7
|
+
["intValue"]?: string;
|
|
8
|
+
/** Format: double */
|
|
9
|
+
["doubleValue"]?: number;
|
|
10
|
+
["arrayValue"]?: ArrayValue;
|
|
11
|
+
["kvlistValue"]?: KeyValueList;
|
|
12
|
+
/** Format: byte */
|
|
13
|
+
["bytesValue"]?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type ArrayValue = {
|
|
17
|
+
["values"]: AnyValue[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type KeyValue = {
|
|
21
|
+
["key"]: string;
|
|
22
|
+
["value"]: AnyValue;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type KeyValueList = {
|
|
26
|
+
["values"]: KeyValue[];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type Resource = {
|
|
30
|
+
["attributes"]: KeyValue[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type InstrumentationScope = {
|
|
34
|
+
["name"]?: string;
|
|
35
|
+
["version"]?: string;
|
|
36
|
+
["attributes"]: KeyValue[];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type ExportLogsServiceRequest = {
|
|
40
|
+
resourceLogs: ResourceLogs[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type ResourceLogs = {
|
|
44
|
+
resource: Resource;
|
|
45
|
+
scopeLogs: ScopeLogs[];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type ScopeLogs = {
|
|
49
|
+
scope?: InstrumentationScope;
|
|
50
|
+
logRecords: LogRecord[];
|
|
51
|
+
schemaUrl?: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type LogRecord = {
|
|
55
|
+
/** Format: uint64 */
|
|
56
|
+
timeUnixNano: string;
|
|
57
|
+
severityNumber?: LOG_SEVERITY_NUMBER;
|
|
58
|
+
severityText?: LOG_SEVERITY_TEXT;
|
|
59
|
+
body?: AnyValue;
|
|
60
|
+
attributes: KeyValue[];
|
|
61
|
+
/** Format: byte */
|
|
62
|
+
traceId?: string;
|
|
63
|
+
/** Format: byte */
|
|
64
|
+
spanId?: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type ExportTraceServiceRequest = {
|
|
68
|
+
resourceSpans: ResourceSpans[];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type ResourceSpans = {
|
|
72
|
+
resource: Resource;
|
|
73
|
+
scopeSpans: ScopeSpans[];
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export type ScopeSpans = {
|
|
77
|
+
scope?: InstrumentationScope;
|
|
78
|
+
spans: Span[];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type SpanStatus = {
|
|
82
|
+
message?: string;
|
|
83
|
+
code: 0 | 1 | 2;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type SpanEvent = {
|
|
87
|
+
timeUnixNano: string;
|
|
88
|
+
name: string;
|
|
89
|
+
attributes: KeyValue[];
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export type SpanLink = {
|
|
93
|
+
/** Format: byte */
|
|
94
|
+
traceId: string;
|
|
95
|
+
/** Format: byte */
|
|
96
|
+
spanId: string;
|
|
97
|
+
traceState?: string;
|
|
98
|
+
attributes: KeyValue[];
|
|
99
|
+
droppedAttributesCount: number;
|
|
100
|
+
flags?: number;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export type Span = {
|
|
104
|
+
/** Format: byte */
|
|
105
|
+
traceId: string;
|
|
106
|
+
/** Format: byte */
|
|
107
|
+
spanId: string;
|
|
108
|
+
traceState?: string;
|
|
109
|
+
/** Format: byte */
|
|
110
|
+
parentSpanId?: string;
|
|
111
|
+
name: string;
|
|
112
|
+
kind: number;
|
|
113
|
+
startTimeUnixNano: string;
|
|
114
|
+
endTimeUnixNano: string;
|
|
115
|
+
attributes: KeyValue[];
|
|
116
|
+
events: SpanEvent[];
|
|
117
|
+
/** Format: int64 */
|
|
118
|
+
droppedEventsCount?: number;
|
|
119
|
+
links: SpanLink[];
|
|
120
|
+
status: SpanStatus;
|
|
121
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect, describe, it } from "vitest";
|
|
2
2
|
import { addAttribute, toAnyValue } from "./attributes";
|
|
3
|
-
import { AnyValue, KeyValue } from "
|
|
3
|
+
import { AnyValue, KeyValue } from "../../types/otlp";
|
|
4
4
|
|
|
5
5
|
describe("toAnyValue", () => {
|
|
6
6
|
describe("primitive values", () => {
|
package/src/utils/otel/error.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { addSpanEvent, InProgressSpan } from "./span";
|
|
2
|
-
import { KeyValue, SpanStatus } from "../../../types/otlp";
|
|
3
2
|
import { addAttribute } from "./attributes";
|
|
4
3
|
import {
|
|
5
4
|
SPAN_EVENT_NAME_EXCEPTION,
|
|
@@ -8,6 +7,7 @@ import {
|
|
|
8
7
|
EXCEPTION_TYPE,
|
|
9
8
|
SPAN_STATUS_ERROR,
|
|
10
9
|
} from "../../semantic-conventions";
|
|
10
|
+
import { KeyValue, SpanStatus } from "../../types/otlp";
|
|
11
11
|
|
|
12
12
|
interface ExceptionWithCode {
|
|
13
13
|
code: string | number;
|
package/src/utils/otel/span.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { KeyValue, Span, SpanStatus } from "../../../types/otlp";
|
|
2
1
|
import { nowNanos } from "../time";
|
|
3
2
|
import { SPAN_KIND_CLIENT, SPAN_STATUS_UNSET, WEB_EVENT_ID } from "../../semantic-conventions";
|
|
4
3
|
import { sessionId } from "../../api/session";
|
|
5
4
|
import { generateTraceId } from "../trace-id";
|
|
6
5
|
import { generateSpanId } from "../span-id";
|
|
7
6
|
import { addAttribute } from "./attributes";
|
|
7
|
+
import { KeyValue, Span, SpanStatus } from "../../types/otlp";
|
|
8
8
|
|
|
9
9
|
export type InProgressSpan = Omit<Span, "endTimeUnixNano">;
|
|
10
10
|
|
package/src/vars.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
// TODO use OTel types here?
|
|
2
|
-
|
|
3
|
-
import { AnyValue, InstrumentationScope, KeyValue, Resource } from "../types/otlp";
|
|
4
1
|
import { AttributeValueType } from "./utils/otel";
|
|
2
|
+
import { AnyValue, InstrumentationScope, KeyValue, Resource } from "./types/otlp";
|
|
5
3
|
|
|
6
4
|
export type Endpoint = {
|
|
7
5
|
/**
|