@dash0/sdk-web 0.11.0 → 0.11.2
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/api/events.js +2 -2
- package/dist/modules/semantic-conventions.js +1 -1
- package/dist/modules/utils/otel/attributes.js +2 -0
- package/dist/modules/utils/otel/attributes_test.js +13 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/api/events.d.ts +1 -1
- package/dist/types/semantic-conventions.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/events.ts +3 -3
- package/src/semantic-conventions.ts +1 -1
- package/src/utils/otel/attributes.ts +2 -0
- package/src/utils/otel/attributes_test.ts +20 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect, describe, it } from "vitest";
|
|
2
|
-
import { toAnyValue } from "./attributes";
|
|
3
|
-
import { AnyValue } from "../../../types/otlp";
|
|
2
|
+
import { addAttribute, toAnyValue } from "./attributes";
|
|
3
|
+
import { AnyValue, KeyValue } from "../../../types/otlp";
|
|
4
4
|
|
|
5
5
|
describe("toAnyValue", () => {
|
|
6
6
|
describe("primitive values", () => {
|
|
@@ -178,4 +178,22 @@ describe("toAnyValue", () => {
|
|
|
178
178
|
expect(result).toBeUndefined();
|
|
179
179
|
});
|
|
180
180
|
});
|
|
181
|
+
|
|
182
|
+
describe("addAttribute", () => {
|
|
183
|
+
it("adds attributes to attribute set", () => {
|
|
184
|
+
const attributes: KeyValue[] = [];
|
|
185
|
+
|
|
186
|
+
addAttribute(attributes, "some.attribute", { stringValue: "a value" });
|
|
187
|
+
|
|
188
|
+
expect(attributes).toEqual(expect.arrayContaining([expect.objectContaining({ key: "some.attribute" })]));
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it("ignores attributes without key", () => {
|
|
192
|
+
const attributes: KeyValue[] = [];
|
|
193
|
+
|
|
194
|
+
addAttribute(attributes, "", { stringValue: "a value" });
|
|
195
|
+
|
|
196
|
+
expect(attributes).toHaveLength(0);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
181
199
|
});
|