GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor: initialize tracing before CLI execution to ensure proper te… · anomalyco/opencode@3b7a1a5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/opencode/src
    • index.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/opencode/src/index.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/index.ts
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ const cli = yargs(hideBin(process.argv))
6767
return "INFO"
6868
})(),
6969
})
70-
71-
await Tracing.init({})
72-
7370
process.env.AGENT = "1"
7471
process.env.OPENCODE = "1"
7572

@@ -112,8 +109,16 @@ const cli = yargs(hideBin(process.argv))
112109
})
113110
.strict()
114111

112+
// Ensure telemetry is initialized before creating the root CLI span.
113+
await Tracing.init({})
114+
115115
try {
116-
await cli.parse()
116+
// Set global active span so that all subsequent operations are included as
117+
// children and not orphaned.
118+
await Tracing.startSpan("cli", async () => {
119+
Tracing.setAttributes({ "cli.args": process.argv.slice(2).join(" ") })
120+
await cli.parse()
121+
})
117122
} catch (e) {
118123
let data: Record<string, any> = {}
119124
if (e instanceof NamedError) {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.