Documentation
¶
Overview ¶
Package observe provides observability infrastructure for the Bowrain server: structured logging, Prometheus metrics, request correlation, and profiling.
Index ¶
- Constants
- Variables
- func CaptureError(err error, reference string, tags map[string]string) string
- func FeatureFromRoute(route string) string
- func FlushSentry(timeout time.Duration)
- func GRPCTracingStreamInterceptor() grpc.StreamServerInterceptor
- func GRPCTracingUnaryInterceptor() grpc.UnaryServerInterceptor
- func InitSentry(cfg SentryConfig) bool
- func InitSentryFromEnv(serverName, release string) bool
- func InstallFrameworkTracer()
- func Logger(ctx context.Context) *slog.Logger
- func MeteringDiscarded(ctx context.Context, meter string, quantity float64, err error, attrs ...any)
- func MetricsAccessMiddlewareStd(token string, next http.Handler) http.Handler
- func MetricsMiddleware(sizeRoutes ...string) echo.MiddlewareFunc
- func ObserveJob(queue, outcome string, started time.Time)
- func RegisterDBStats(db *sql.DB, name string)
- func RequestIDFromContext(ctx context.Context) (string, bool)
- func RequestIDMiddleware() echo.MiddlewareFunc
- func RequestLogMiddleware(logger *slog.Logger, cfg RequestLogConfig) echo.MiddlewareFunc
- func SentryEnabled() bool
- func SetupLogger(format, level string) *slog.Logger
- func SpanContext(ctx context.Context, operation, description string) (context.Context, func())
- func StartPprofServer(ctx context.Context) (shutdown func(context.Context) error)
- func StartSpan(ctx context.Context, operation, description string) func()
- func TagScope(ctx context.Context, s Scope)
- func TagTransaction(ctx context.Context, key, value string)
- func TraceIDFromContext(ctx context.Context) (string, bool)
- func TracingMiddleware() echo.MiddlewareFunc
- func Transaction(ctx context.Context, op, name string) (context.Context, func(error))
- func WithLogger(ctx context.Context, l *slog.Logger) context.Context
- func WithRequestID(ctx context.Context, id string) context.Context
- func WithTraceID(ctx context.Context, id string) context.Context
- type ContextHandler
- type RequestLogConfig
- type Scope
- type SentryConfig
Constants ¶
const ( // MeterAITokens is the ai_usage abuse-cap ledger (jobs.QuotaStore.RecordUsage). MeterAITokens = "ai_tokens" // MeterAgentTokens is the @bravo per-message token ledger (AgentStore.RecordUsage). MeterAgentTokens = "agent_tokens" // MeterRunnerSeconds is container/runner wall time (QuotaStore.RecordRunnerUsage). MeterRunnerSeconds = "runner_seconds" )
Meter names. Bounded label values — never a workspace, job, or model id.
const RequestIDHeader = "X-Request-ID"
Variables ¶
var ( // HTTPRequestsTotal counts total HTTP requests. // PromQL: rate(bowrain_http_requests_total[5m]) // Alert: rate(bowrain_http_requests_total{status=~"5.."}[5m]) > 1 HTTPRequestsTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: "bowrain", Subsystem: "http", Name: "requests_total", Help: "Total HTTP requests by method, route pattern, and status code.", }, []string{"method", "route", "status"}, ) // HTTPRequestDuration measures request latency. // PromQL: histogram_quantile(0.99, rate(bowrain_http_request_duration_seconds_bucket[5m])) HTTPRequestDuration = promauto.NewHistogramVec( prometheus.HistogramOpts{ Namespace: "bowrain", Subsystem: "http", Name: "request_duration_seconds", Help: "HTTP request duration in seconds.", Buckets: prometheus.DefBuckets, }, []string{"method", "route", "status"}, ) // HTTPRequestsInFlight tracks concurrent in-flight requests. // PromQL: bowrain_http_requests_in_flight HTTPRequestsInFlight = promauto.NewGauge(prometheus.GaugeOpts{ Namespace: "bowrain", Subsystem: "http", Name: "requests_in_flight", Help: "Current number of HTTP requests being processed.", }) // HTTPResponseSizeBytes measures response payload size for a small set of // payload-hot routes (opted in via MetricsMiddleware's sizeRoutes) so // payload-shape regressions on those endpoints are visible without paying // a second full-cardinality histogram across every route. // PromQL: histogram_quantile(0.99, rate(bowrain_http_response_size_bytes_bucket[5m])) HTTPResponseSizeBytes = promauto.NewHistogramVec( prometheus.HistogramOpts{ Namespace: "bowrain", Subsystem: "http", Name: "response_size_bytes", Help: "HTTP response body size in bytes for selected payload-hot routes.", Buckets: prometheus.ExponentialBuckets(256, 4, 10), }, []string{"method", "route", "status"}, ) )
var ( // JobsProcessedTotal counts terminal job outcomes by queue and result. // outcome ∈ {success, failed, transient}. queue is a bounded label // (translation|extraction|brand-scan|...), never a job ID. // PromQL: sum by (queue) (rate(bowrain_jobs_processed_total{outcome="failed"}[5m])) // Alert: rate(bowrain_jobs_processed_total{outcome="failed"}[10m]) > 0.1 JobsProcessedTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: "bowrain", Subsystem: "jobs", Name: "processed_total", Help: "Total jobs processed by queue and terminal outcome (success|failed|transient).", }, []string{"queue", "outcome"}, ) // JobDuration measures end-to-end job processing latency by queue. // PromQL: histogram_quantile(0.95, sum by (le,queue) (rate(bowrain_jobs_duration_seconds_bucket[5m]))) JobDuration = promauto.NewHistogramVec( prometheus.HistogramOpts{ Namespace: "bowrain", Subsystem: "jobs", Name: "duration_seconds", Help: "Job processing duration in seconds by queue.", Buckets: []float64{0.5, 1, 2.5, 5, 10, 30, 60, 120, 300, 600}, }, []string{"queue"}, ) // JobsInFlight tracks jobs currently being processed, by queue. // PromQL: bowrain_jobs_in_flight JobsInFlight = promauto.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "bowrain", Subsystem: "jobs", Name: "in_flight", Help: "Jobs currently being processed, by queue.", }, []string{"queue"}, ) // ConvergenceRunsTotal counts convergence-loop run outcomes. // outcome ∈ {completed, parked, failed, canceled}. This is the core product // loop — a rising failed/parked rate is a direct product-health signal. // PromQL: sum by (outcome) (rate(bowrain_convergence_runs_total[15m])) ConvergenceRunsTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: "bowrain", Subsystem: "convergence", Name: "runs_total", Help: "Convergence run terminal outcomes (completed|parked|failed|canceled).", }, []string{"outcome"}, ) )
var ( // MeteringDiscardedTotal counts usage-metering writes that failed and were // dropped rather than retried or escalated. // PromQL: sum by (meter) (increase(bowrain_metering_discarded_total[24h])) // Alert: increase(bowrain_metering_discarded_total[1h]) > 0 MeteringDiscardedTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: "bowrain", Subsystem: "metering", Name: "discarded_total", Help: "Usage-metering writes that failed and were discarded, by meter.", }, []string{"meter"}, ) // MeteringUnrecordedTotal accumulates the quantity those discarded writes // were carrying — the "how much" half of the question. Units differ per // meter (tokens, seconds), hence the unit label; never sum across meters. // PromQL: sum by (meter, unit) (increase(bowrain_metering_unrecorded_total[24h])) MeteringUnrecordedTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: "bowrain", Subsystem: "metering", Name: "unrecorded_total", Help: "Usage quantity that failed to be metered, by meter and unit.", }, []string{"meter", "unit"}, ) )
var ( // BreakerState is the current position of each dependency's circuit: // 0 = closed, 1 = half-open, 2 = open. Ordered by severity so max() over // instances answers "is anything tripped anywhere". // PromQL: max by (dependency) (bowrain_dependency_breaker_state) // Alert: max by (dependency) (bowrain_dependency_breaker_state) == 2 BreakerState = promauto.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "bowrain", Subsystem: "dependency", Name: "breaker_state", Help: "Circuit breaker state per dependency (0=closed, 1=half-open, 2=open).", }, []string{"dependency", "kind"}, ) // BreakerTransitionsTotal counts state changes. A high open→half-open→open // rate means the dependency is flapping rather than simply down. // PromQL: rate(bowrain_dependency_breaker_transitions_total{to="open"}[15m]) BreakerTransitionsTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: "bowrain", Subsystem: "dependency", Name: "breaker_transitions_total", Help: "Circuit breaker state transitions by dependency and direction.", }, []string{"dependency", "kind", "from", "to"}, ) // BreakerRejectionsTotal counts calls short-circuited without being // attempted. This is the load an open breaker is shedding — the number to // quote when explaining why work was deferred rather than run. // PromQL: rate(bowrain_dependency_breaker_rejections_total[5m]) BreakerRejectionsTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: "bowrain", Subsystem: "dependency", Name: "breaker_rejections_total", Help: "Calls rejected without being attempted because the circuit was open.", }, []string{"dependency", "kind"}, ) // DependencyCallsTotal counts attempted outbound calls by outcome: // success | failure (upstream trouble, counts toward tripping) | // rejected_upstream (the dependency answered with a permanent refusal) | // ignored (caller cancelled or caller-side fault) | rejected (open circuit). // PromQL: sum by (dependency) (rate(bowrain_dependency_calls_total{outcome="failure"}[5m])) DependencyCallsTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: "bowrain", Subsystem: "dependency", Name: "calls_total", Help: "Outbound dependency calls by dependency and outcome.", }, []string{"dependency", "kind", "outcome"}, ) // DependencyCallDuration measures outbound call latency. Rejections are not // observed here — they took no upstream time and would flatten the quantiles. // PromQL: histogram_quantile(0.99, rate(bowrain_dependency_call_duration_seconds_bucket[5m])) DependencyCallDuration = promauto.NewHistogramVec( prometheus.HistogramOpts{ Namespace: "bowrain", Subsystem: "dependency", Name: "call_duration_seconds", Help: "Outbound dependency call duration in seconds.", Buckets: []float64{0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 20, 30, 60, 120}, }, []string{"dependency", "kind"}, ) // JobsDeferredTotal counts jobs parked because a dependency was known-down. // A deferral is not a retry: it costs the job no attempt budget, so this // series is how an outage's cost shows up as waiting rather than failures. // PromQL: rate(bowrain_jobs_deferred_total[5m]) JobsDeferredTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: "bowrain", Subsystem: "jobs", Name: "deferred_total", Help: "Jobs deferred (requeued without consuming a retry attempt) because a dependency was unavailable.", }, []string{"queue", "dependency"}, ) // EventsDroppedTotal counts events the in-process bus threw away because a // subscriber's buffer was full. It has no pending list and no redelivery, // so a drop here is permanent — this series is the only evidence it // happened, and a non-zero rate is the signal that the deployment has // outgrown the in-process bus and needs Redis. // PromQL: rate(bowrain_events_dropped_total[5m]) EventsDroppedTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: "bowrain", Subsystem: "events", Name: "dropped_total", Help: "Events dropped by the in-process event bus because a subscriber's buffer was full.", }, []string{"event_type"}, ) )
Circuit-breaker and outbound-dependency series. The "dependency" label is a breaker name from bowrain/resilience — a bounded, code-declared identifier such as "ai:bedrock" or "connector:figma", never a workspace, URL, or job ID.
Functions ¶
func CaptureError ¶
CaptureError reports err to Sentry with the given correlation tags. The reference tag is the request/run ID the user sees, so quoting it in Sentry search resolves straight to the event. No-op when Sentry is disabled.
tags is a small set of low-cardinality-ish attributes (route, method, status); reference is the high-value correlation handle. Returns the Sentry event ID (empty when disabled or dropped).
func FeatureFromRoute ¶
FeatureFromRoute names the product area a route belongs to.
Derived from the registered pattern rather than declared in a table, because a table drifts: a route added to a new area would keep whatever the table last said, and nobody would notice a filter quietly under-reporting.
The rule is the first path segment that is not a version, a parameter, or the api prefix — `/api/v1/:ws/:id/dashboard/:ref` is "dashboard", `/api/v1/:ws/projects` is "projects". A route with nothing but parameters after the prefix is "workspace", which is what those routes serve.
func FlushSentry ¶
FlushSentry flushes buffered events; call on shutdown. No-op when disabled.
func GRPCTracingStreamInterceptor ¶
func GRPCTracingStreamInterceptor() grpc.StreamServerInterceptor
GRPCTracingStreamInterceptor opens a transaction per streaming RPC.
A stream's transaction spans the whole stream, not one message: that is the unit whose duration means something, and the one that hangs.
func GRPCTracingUnaryInterceptor ¶
func GRPCTracingUnaryInterceptor() grpc.UnaryServerInterceptor
GRPCTracingUnaryInterceptor opens a transaction per unary RPC.
The gRPC surface carries the CLI's pushes and flow executions — the calls most likely to be slow, and the ones least likely to be watched, since no browser is waiting on them. It shares the server process and therefore the traces sample rate, and produced nothing until this existed.
Chain it OUTSIDE the auth interceptors, so a call rejected for its credentials is still a transaction: "authentication is slow" and "authentication refuses everything" are both things worth being able to see.
func InitSentry ¶
func InitSentry(cfg SentryConfig) bool
InitSentry initializes the global Sentry client. Safe to call with an empty DSN (returns false, no-op). PII scrubbing: SendDefaultPII stays false and a BeforeSend hook drops request cookies/headers that could carry tokens.
func InitSentryFromEnv ¶
InitSentryFromEnv configures Sentry from the standard environment variables, so the server and worker stay in sync:
SENTRY_DSN error-tracking DSN (empty → disabled) SENTRY_ENVIRONMENT "production" | "staging" | "dev" (default "production") SENTRY_TRACES_SAMPLE_RATE 0..1 performance tracing (default 0 = off)
serverName distinguishes the emitting service ("server", "worker"); release ties events to a build for regression/release-health tracking.
func InstallFrameworkTracer ¶
func InstallFrameworkTracer()
InstallFrameworkTracer routes the framework's spans into Sentry.
Call once at startup, after Sentry is initialised. Calling it when Sentry is not configured is harmless: every span it produces then short-circuits.
func MeteringDiscarded ¶
func MeteringDiscarded(ctx context.Context, meter string, quantity float64, err error, attrs ...any)
MeteringDiscarded records one usage-metering write that failed and was deliberately not retried. meter must be one of the Meter* constants; quantity is the amount that went unrecorded, in that meter's unit. attrs are extra slog key/value pairs identifying the work (job id, workspace, operation) and must not carry content or credentials.
func MetricsAccessMiddlewareStd ¶
MetricsAccessMiddlewareStd is the net/http twin of the server's echo-based metrics gate, for the worker's standalone health/metrics mux. Same policy:
- token != "" → require "Authorization: Bearer <token>" (constant-time).
- token == "" → allow only loopback/private/link-local source IPs (an in-cluster scraper reaching the pod directly), refuse public callers.
Refused requests get 404 so the endpoint's existence is not confirmed.
func MetricsMiddleware ¶
func MetricsMiddleware(sizeRoutes ...string) echo.MiddlewareFunc
MetricsMiddleware returns Echo middleware that records Prometheus metrics for every HTTP request: total count, latency histogram, and in-flight gauge.
Labels use the registered route pattern (c.Path()), e.g. "/api/v1/projects/:id", NOT the actual URL, to keep label cardinality bounded. The status label is the status the client receives, including a response the error handler writes for a returned error.
sizeRoutes opts specific route patterns into the response-size histogram (HTTPResponseSizeBytes). Only listed routes are observed so the extra histogram stays cheap; pass the payload-hot endpoints (e.g. the workspace project list and the translation dashboard).
func ObserveJob ¶
ObserveJob records a completed job's outcome and duration in one call. queue must be a bounded label value; outcome is success|failed|transient.
func RegisterDBStats ¶
RegisterDBStats exposes a database/sql pool's live stats as gauges. Call once per pool (name distinguishes multiple pools). Cheap: read on scrape.
PromQL: bowrain_db_pool_in_use / bowrain_db_pool_open (saturation) Alert: bowrain_db_pool_wait_count increasing → pool too small
func RequestIDFromContext ¶
RequestIDFromContext returns the correlation ID stored on ctx, if any.
func RequestIDMiddleware ¶
func RequestIDMiddleware() echo.MiddlewareFunc
RequestIDMiddleware generates or propagates a unique request ID per request. The ID is set in the response header and stored in the context as a child slog logger with "request_id" pre-attached.
func RequestLogMiddleware ¶
func RequestLogMiddleware(logger *slog.Logger, cfg RequestLogConfig) echo.MiddlewareFunc
RequestLogMiddleware logs one structured record per request through logger.
The record carries two groups and the request ID. CloudWatch metric filters and the monitoring dashboard read these keys, so they are a contract:
request: time, method, host, path, query, params, route, referer, length response: time, latency (a duration; nanoseconds in JSON), status, length id: the X-Request-ID of the request, or of the response
route is the matched route pattern (c.Path()); length is the number of body bytes read from the request and written to the response. The record does not carry the client's address.
A handler error that carries no HTTP status is answered here. It is wrapped as a 500 *echo.HTTPError and passed to the Echo error handler, so the record shows the status the client received. The wrapped error is then returned up the chain, where the error handler finds the response already committed. An HTTP error is returned unhandled and logged with its own status.
func SetupLogger ¶
SetupLogger creates and installs a structured slog.Logger as the default.
format controls the output handler:
- "json" (default) — slog.JSONHandler for production
- "text" — colorized tint handler for local development
level controls the minimum log level:
- "debug", "info" (default), "warn", "error"
The logger includes PII redaction middleware that masks sensitive fields (email addresses, connection strings) before they reach any handler.
Calling slog.SetDefault bridges the stdlib log package so existing log.Printf calls automatically flow through this handler (Go 1.22+).
func SpanContext ¶
SpanContext is StartSpan for a call that needs to pass the span's context on, so work it starts nests inside rather than beside it.
func StartPprofServer ¶
StartPprofServer conditionally starts a separate HTTP server for /debug/pprof/* endpoints. Enabled only when BOWRAIN_PPROF_ENABLED=true.
The server binds to localhost only (127.0.0.1:6060 by default) so it is never reachable from external networks. Override the port with BOWRAIN_PPROF_PORT.
Returns a shutdown function that should be called during graceful shutdown. Returns nil if pprof is disabled.
func StartSpan ¶
StartSpan opens a child span on whatever transaction ctx is carrying, and returns the function that ends it.
This is the half that makes a transaction worth having. A transaction saying "this took 22 seconds" only restates what the request log already said; the spans inside it are what say which query, how many times.
Safe on a context with no transaction: the returned function is then a no-op, so a call site does not need to know whether tracing is on:
end := observe.StartSpan(ctx, "db.query", "GetBlocks") defer end()
func TagScope ¶
TagScope puts the dimensions on whatever transaction ctx is carrying.
Empty fields are skipped rather than written as "", so a filter for a missing dimension finds nothing instead of finding everything that lacked it.
func TagTransaction ¶
TagTransaction adds a tag to whatever transaction ctx is carrying.
For the identifying detail a name must not hold: which workspace, which project, which tool. Tags are indexed and may be high-cardinality; a transaction NAME may not.
func TraceIDFromContext ¶
TraceIDFromContext returns the trace ID stored on ctx, if any.
func TracingMiddleware ¶
func TracingMiddleware() echo.MiddlewareFunc
TracingMiddleware opens one Sentry transaction per request.
Place it INSIDE RequestIDMiddleware, so the request id exists to tag the transaction with, and OUTSIDE middleware.Recover, so a panic the recover middleware turns into a 500 is still observed here and the transaction records the failure rather than ending in whatever state the unwind left.
It is a no-op when Sentry is not configured, which is the default for local and self-hosted deployments.
func Transaction ¶
Transaction opens a root transaction for a unit of work that is not an HTTP request — a gRPC call, a queued job, an MCP method.
The HTTP middleware cannot serve these: it needs an echo.Context, and more to the point a request is only one of the ways this system does slow things. The worker carries the same SENTRY_TRACES_SAMPLE_RATE as the server and, until this existed, produced nothing at all — a convergence run that took an hour was as invisible as the 22-second dashboard that prompted the HTTP half.
name is what Sentry aggregates on, so it must be the SHAPE of the work — the queue, the RPC method — and never carry a job id, project id or workspace. The identifying handle goes on as a tag instead, where high cardinality is what tags are for.
The returned function ends the transaction and records whether the work failed. Call it with the work's error, or nil:
ctx, end := observe.Transaction(ctx, "queue.task", "translation") err := process(ctx) end(err)
It is a no-op when Sentry is unconfigured, and returns ctx unchanged, so a call site never needs to know whether tracing is on.
func WithLogger ¶
WithLogger stores a logger in the context. Used by RequestIDMiddleware to attach a per-request child logger with the request ID pre-set.
func WithRequestID ¶
WithRequestID stores the per-request correlation ID on the context so that ContextHandler can stamp it onto every log record produced with this ctx (via slog's *Context variants), without threading a child logger by hand.
Types ¶
type ContextHandler ¶
ContextHandler wraps a slog.Handler and enriches every record with the correlation identifiers carried on the context (request_id, trace_id).
This is what makes drill-down work: any log emitted with a *Context variant (slog.InfoContext, ErrorContext, …) whose ctx flowed from RequestIDMiddleware — or from a background run seeded via WithRequestID — automatically carries the same request_id the client sees as its error "reference". Package-level slog.Info calls (no ctx) are unaffected, so this is a safe, additive change.
func NewContextHandler ¶
func NewContextHandler(h slog.Handler) *ContextHandler
NewContextHandler wraps h so that context-borne correlation IDs are appended to each record before it reaches h.
func (*ContextHandler) Handle ¶
Handle appends request_id / trace_id from ctx (when present) then delegates.
type RequestLogConfig ¶
type RequestLogConfig struct {
// DefaultLevel is the level of a request answered below 400.
DefaultLevel slog.Level
// ClientErrorLevel is the level of a request answered 4xx.
ClientErrorLevel slog.Level
// ServerErrorLevel is the level of a request answered 5xx.
ServerErrorLevel slog.Level
// SkipPaths are request paths (URL.Path, exact match) that are not logged.
SkipPaths []string
}
RequestLogConfig configures RequestLogMiddleware.
type Scope ¶
type Scope struct {
// WorkspaceID is the customer. Opaque id rather than slug: a slug is a
// display name that can be changed and read over someone's shoulder, and
// the id is what every other system already joins on.
WorkspaceID string
// ProjectID scopes within a customer.
ProjectID string
// Plan is the entitlement tier — free, pro, enterprise. The lowest
// cardinality dimension here and the highest value: "the slow ones are all
// on the trial plan" is a finding, and it is one query.
Plan string
// Feature is the product area, derived from the route rather than declared,
// so it cannot drift from what the code actually serves.
Feature string
// UserID is the acting user, opaque. Deliberately not name or email: those
// are what SendDefaultPII=false and the BeforeSend scrubber exist to keep
// out, and an id answers "is it one user or all of them" just as well.
UserID string
}
Scope is the set of dimensions a trace should be filterable by.
Duration alone answers "is it slow" and nothing a person can act on. The questions that get asked are "is it slow for THIS customer", "is it only the enterprise plan", "is it this project or all of them", "is it the dashboard or everything" — and none of them are answerable unless the trace carries the dimension. A transaction with a duration and no scope is a number without a subject.
These are TAGS, never part of the transaction name: tags are indexed for filtering and may be high-cardinality, while a name is what Sentry groups by and must stay one row per shape of work. Putting a workspace id in a name makes every customer their own transaction and the aggregate disappears.
type SentryConfig ¶
type SentryConfig struct {
DSN string
Environment string // e.g. "production", "staging", "dev"
Release string // e.g. version+commit, for release health / regressions
// SampleRate for error events (0..1); defaults to 1.0 (report everything).
SampleRate float64
// TracesSampleRate for performance traces (0..1); 0 disables tracing.
TracesSampleRate float64
// ServerName tags events with which service produced them ("server"/"worker").
ServerName string
}
SentryConfig configures error reporting. When DSN is empty, InitSentry is a no-op and the service runs with error tracking disabled — this is the default for local/self-hosted deployments that have not provisioned a Sentry project.