-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(unstable): otel context with multiple keys (#27230)
`SafeMap` treats its argument as an object with a "length" and index properties, rather than a generic iterator, so every time we cloned it, it was dropping all the data.
- Loading branch information
Showing
3 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { assertEquals } from "@std/assert"; | ||
|
||
const { ContextManager } = Deno.telemetry; | ||
|
||
const cm = new ContextManager(); | ||
|
||
const a = cm.active(); | ||
const b = a.setValue("b", 1); | ||
const c = b.setValue("c", 2); | ||
|
||
const subB = c.deleteValue("b"); | ||
const subC = subB.deleteValue("c"); | ||
|
||
assertEquals(a.getValue("b"), undefined); | ||
assertEquals(b.getValue("b"), 1); | ||
assertEquals(c.getValue("b"), 1); | ||
|
||
assertEquals(a.getValue("c"), undefined); | ||
assertEquals(b.getValue("c"), undefined); | ||
assertEquals(c.getValue("c"), 2); | ||
|
||
assertEquals(subB.getValue("b"), undefined); | ||
assertEquals(subB.getValue("c"), 2); | ||
|
||
assertEquals(subC.getValue("b"), undefined); | ||
assertEquals(subC.getValue("c"), undefined); |