mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 09:44:21 +01:00
Remove unused OpenTelemetry tracing and fix overlapping highlights (#1738)
Co-authored-by: opencode <noreply@opencode.ai>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
description: You MUST use this agent when writing documentation
|
description: ALWAYS use this when writing docs
|
||||||
---
|
---
|
||||||
|
|
||||||
You are an expert technical documentation writer
|
You are an expert technical documentation writer
|
||||||
|
|||||||
@@ -38,13 +38,6 @@
|
|||||||
"@openauthjs/openauth": "0.4.3",
|
"@openauthjs/openauth": "0.4.3",
|
||||||
"@opencode-ai/plugin": "workspace:*",
|
"@opencode-ai/plugin": "workspace:*",
|
||||||
"@opencode-ai/sdk": "workspace:*",
|
"@opencode-ai/sdk": "workspace:*",
|
||||||
"@opentelemetry/auto-instrumentations-node": "0.62.0",
|
|
||||||
"@opentelemetry/exporter-jaeger": "2.0.1",
|
|
||||||
"@opentelemetry/exporter-otlp-http": "0.26.0",
|
|
||||||
"@opentelemetry/exporter-trace-otlp-http": "0.203.0",
|
|
||||||
"@opentelemetry/instrumentation-fetch": "0.203.0",
|
|
||||||
"@opentelemetry/sdk-node": "0.203.0",
|
|
||||||
"@opentelemetry/sdk-trace-node": "2.0.1",
|
|
||||||
"@standard-schema/spec": "1.0.0",
|
"@standard-schema/spec": "1.0.0",
|
||||||
"@zip.js/zip.js": "2.7.62",
|
"@zip.js/zip.js": "2.7.62",
|
||||||
"ai": "catalog:",
|
"ai": "catalog:",
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import "zod-openapi/extend"
|
import "zod-openapi/extend"
|
||||||
import { Trace } from "./trace"
|
|
||||||
Trace.init()
|
|
||||||
import yargs from "yargs"
|
import yargs from "yargs"
|
||||||
import { hideBin } from "yargs/helpers"
|
import { hideBin } from "yargs/helpers"
|
||||||
import { RunCommand } from "./cli/cmd/run"
|
import { RunCommand } from "./cli/cmd/run"
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import { NodeSDK } from "@opentelemetry/sdk-node"
|
|
||||||
import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch"
|
|
||||||
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"
|
|
||||||
|
|
||||||
export namespace Trace {
|
|
||||||
export function init() {
|
|
||||||
const sdk = new NodeSDK({
|
|
||||||
serviceName: "opencode",
|
|
||||||
instrumentations: [new FetchInstrumentation()],
|
|
||||||
traceExporter: new OTLPTraceExporter({
|
|
||||||
url: "http://localhost:4318/v1/traces", // or your OTLP endpoint
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
sdk.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -268,7 +268,26 @@ func renderText(
|
|||||||
return 0
|
return 0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Merge overlapping highlights to prevent duplication
|
||||||
|
merged := make([]highlightPart, 0)
|
||||||
for _, part := range highlights {
|
for _, part := range highlights {
|
||||||
|
if len(merged) == 0 {
|
||||||
|
merged = append(merged, part)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
last := &merged[len(merged)-1]
|
||||||
|
// If current part overlaps with the last one, merge them
|
||||||
|
if part.start <= last.end {
|
||||||
|
if part.end > last.end {
|
||||||
|
last.end = part.end
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
merged = append(merged, part)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, part := range merged {
|
||||||
highlight := base.Foreground(part.color)
|
highlight := base.Foreground(part.color)
|
||||||
start, end := part.start, part.end
|
start, end := part.start, part.end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user