Skip to content

Commit

Permalink
Fix version in trace (#30982)
Browse files Browse the repository at this point in the history
Noticed the trace can't be imported because the tags are a nested as apparently the type was not restrictive of that.


## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
  • Loading branch information
timneutkens committed Nov 4, 2021
1 parent b408d73 commit ad6b9c2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/next/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default async function build(
runLint = true
): Promise<void> {
const nextBuildSpan = trace('next-build', undefined, {
attrs: { version: process.env.__NEXT_VERSION },
version: process.env.__NEXT_VERSION as string,
})

const buildResult = await nextBuildSpan.traceAsyncFn(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/next/server/dev/hot-reloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default class HotReloader {
this.previewProps = previewProps
this.rewrites = rewrites
this.hotReloaderSpan = trace('hot-reloader', undefined, {
attrs: { version: process.env.__NEXT_VERSION },
version: process.env.__NEXT_VERSION as string,
})
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
// of the current `next dev` invocation.
Expand Down
6 changes: 5 additions & 1 deletion packages/next/trace/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ export class Span {
}
}

export const trace = (name: string, parentId?: SpanId, attrs?: Object) => {
export const trace = (
name: string,
parentId?: SpanId,
attrs?: { [key: string]: string }
) => {
return new Span({ name, parentId, attrs })
}

Expand Down
13 changes: 8 additions & 5 deletions scripts/send-trace-to-jaeger.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ file.pipe(eventStream.split()).pipe(
)
.then(async (res) => {
if (res.status !== 202) {
console.log({
status: res.status,
body: await res.text(),
events: eventsJson,
})
console.dir(
{
status: res.status,
body: await res.text(),
events: eventsJson,
},
{ depth: null }
)
}
cb(null, '')
})
Expand Down

0 comments on commit ad6b9c2

Please sign in to comment.