mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
Client:
- ci.yml: patch auto-generated events.ts to rename Event -> _Event
so @typescript-eslint/no-unused-vars does not fail on generated code
Server (gocritic):
- service/channel.go: rangeValCopy (line 74), elseif (line 174)
- service/message.go: rangeValCopy (line 648), elseif (lines 438, 496)
- ws/emit.go: caseOrder — ChannelEvent before BroadcastAllEvent
- ws/handlers_command_test.go: stringXbytes — use bytes.Equal
- ws/pubsub_test.go: stringXbytes — use bytes.Equal
Server (nilerr):
- service/channel.go: nolint:nilerr for intentional silent drops in HandleTyping
Server (gosec):
- plugin/host_ui.go: G703 nolint — path already sanitized above
- plugin/registry.go: G302 — tighten plugin file permissions 0o640 → 0o600
- ws/hub.go, ws/serve.go: G115 nolint — seq counters never reach MaxInt64
Server (unused/unparam):
- plugin/registry.go: nolint:unused for wazero-tagged module field
- telemetry/metrics.go: nolint:unused for otel-tagged resetAppMetricsForInit
- ws/command.go: nolint:unparam for map entries whose error return is always nil
Server (staticcheck ST1000/ST1020):
- Add blank line before package declarations in phase-comment files
(api/plugins_handler.go, plugin/host_{commands,events,http}.go,
telemetry/metrics.go, telemetry/middleware.go,
telemetry/telemetry_default.go, ws/event_persister.go)
- Fix GlobalTracer/GlobalMeter doc comments to start with function name
23 lines
977 B
Go
23 lines
977 B
Go
// Phase B Step 8 — HTTP middleware that delegates tracing to the global
|
|
// provider. The default no-op build returns next unchanged; the otel-tagged
|
|
// build wraps next with otelchi.Middleware. Mount it from the Chi router so
|
|
// every REST request becomes a span automatically.
|
|
|
|
package telemetry
|
|
|
|
import "net/http"
|
|
|
|
// HTTPMiddleware returns an HTTP middleware that traces every request via
|
|
// the currently installed Provider. Safe to mount unconditionally — it is a
|
|
// pass-through when telemetry is disabled.
|
|
func HTTPMiddleware() func(http.Handler) http.Handler {
|
|
return func(next http.Handler) http.Handler {
|
|
return Global().HTTPMiddleware(next)
|
|
}
|
|
}
|
|
|
|
// PrometheusHandler returns the active Prometheus exporter handler, or nil if
|
|
// no Prometheus exporter is wired. Mount it from the API router only when
|
|
// non-nil so the legacy /metrics endpoint stays untouched in the no-op build.
|
|
func PrometheusHandler() http.Handler { return Global().PrometheusHandler() }
|