Skip to content

Commit 20c25f9

Browse files
authored
fix span attributes for Stream.withSpan (#277)
1 parent e8d6cc7 commit 20c25f9

File tree

5 files changed

+71
-56
lines changed

5 files changed

+71
-56
lines changed

packages/discord-bot/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
"devDependencies": {
1010
"@chat/discord": "workspace:*",
1111
"@chat/shared": "workspace:*",
12-
"@effect/ai-openai": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/ai-openai@989d1cc",
13-
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@989d1cc",
12+
"@effect/ai-openai": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/ai-openai@e691909",
13+
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@e691909",
1414
"@octokit/plugin-rest-endpoint-methods": "^17.0.0",
1515
"@octokit/types": "^16.0.0",
1616
"@types/node": "^24.10.1",
1717
"dfx": "^1.0.5",
18-
"effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@989d1cc",
18+
"effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@e691909",
1919
"fuzzysort": "^3.1.0",
2020
"glob": "^13.0.6",
2121
"html-entities": "^2.6.0",

packages/discord-bot/src/EffectRepo.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,19 @@ export class EffectRepo extends ServiceMap.Service<
7777
readonly pattern: string
7878
readonly glob?: string | undefined
7979
}) =>
80-
Stream.unwrap(
81-
Effect.map(repo, (repoPath) =>
80+
repo.pipe(
81+
Effect.map((repoPath) =>
8282
rg.search({
8383
directory: repoPath,
8484
pattern: options.pattern,
8585
glob: options.glob
86-
}))
87-
).pipe(Stream.mapError((cause) => new EffectRepoError({ cause })))
86+
})
87+
),
88+
Stream.unwrap,
89+
Stream.mapError((cause) => new EffectRepoError({ cause }))
90+
)
8891

89-
const readFileRange = Effect.fn("EffectRepo.readFileRange")(
92+
const readFileRange = Effect.fnUntraced(
9093
function*(options: {
9194
readonly path: string
9295
readonly startLine?: number | undefined
@@ -101,17 +104,29 @@ export class EffectRepo extends ServiceMap.Service<
101104
const end = options.endLine ?? lines.length
102105
return lines.slice(start, end).join("\n")
103106
},
104-
Effect.mapError((cause) => new EffectRepoError({ cause }))
107+
Effect.mapError((cause) => new EffectRepoError({ cause })),
108+
Effect.withSpan("EffectRepo.readFileRange", (options) => ({
109+
attributes: {
110+
"file.path": options.path,
111+
"file.startLine": options.startLine ?? 1,
112+
"file.endLine": options.endLine ?? "EOF"
113+
}
114+
}))
105115
)
106116

107-
const globFiles = Effect.fn("EffectRepo.glob")(
117+
const globFiles = Effect.fnUntraced(
108118
function*(options: { readonly pattern: string }) {
109119
const repoPath = yield* repo
110120
return yield* Effect.tryPromise(() =>
111121
glob(options.pattern, { cwd: repoPath })
112122
)
113123
},
114-
Effect.mapError((cause) => new EffectRepoError({ cause }))
124+
Effect.mapError((cause) => new EffectRepoError({ cause })),
125+
Effect.withSpan("EffectRepo.glob", (options) => ({
126+
attributes: {
127+
"glob.pattern": options.pattern
128+
}
129+
}))
115130
)
116131

117132
const llmsMd = yield* RcRef.make({

packages/discord/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"./*": "./src/*.ts"
1010
},
1111
"dependencies": {
12-
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@989d1cc",
12+
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@e691909",
1313
"dfx": "^1.0.5",
14-
"effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@989d1cc"
14+
"effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@e691909"
1515
}
1616
}

packages/shared/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"./*": "./src/*.ts"
1010
},
1111
"dependencies": {
12-
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@989d1cc",
13-
"effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@989d1cc"
12+
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@e691909",
13+
"effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@e691909"
1414
}
1515
}

pnpm-lock.yaml

Lines changed: 41 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)