forked from mtusi2026/mtusi2026lab6
feat: add bounded observability and verified SLO incident alerts
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package objectstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type tracerFixture struct {
|
||||
operation string
|
||||
finished bool
|
||||
}
|
||||
|
||||
// Start records a stable operation name and closes it through the returned callback.
|
||||
func (f *tracerFixture) Start(ctx context.Context, name, _ string) (context.Context, func(error)) {
|
||||
f.operation = name
|
||||
return ctx, func(error) {
|
||||
f.finished = true
|
||||
}
|
||||
}
|
||||
|
||||
// TestObjectObservationOmitsCoordinates keeps bucket keys and credentials outside the tracer boundary.
|
||||
func TestObjectObservationOmitsCoordinates(t *testing.T) {
|
||||
tracer := &tracerFixture{}
|
||||
client := (&Client{}).WithTracer(tracer)
|
||||
_, finish := client.start(t.Context(), "s3.put")
|
||||
finish(nil)
|
||||
if tracer.operation != "s3.put" || !tracer.finished {
|
||||
t.Fatal("operation span missing")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user