- Admin pprof is opt-in (AdminConfig.EnablePprof) - Client spans drop the URL query string; HostFunc bounds the host label - Config.HTTP/HTTPClient/GRPC configure the Observer's instrumentation - A panic after a partial HTTP response counts as 500 - GaugeFunc, CounterFunc and RegisterDBStats panic on duplicates - Abandoned client gRPC streams are recorded as Canceled - OTEL_EXPORTER_OTLP_PROTOCOL selects the protocol when unset - Health reports are cached for 1s; hung checks are not restarted - Environment is exported as deployment.environment.name Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
8647fdf1bb
commit
c92fd9826b
21 files changed
+457
-101
No files matched your search
+6
-4
@@ -182,7 +182,7 @@ func TestObserver_TrackError(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestObserver_AdminServer(t *testing.T) {
|
||||
o, _, _ := newTestObserver(t, Config{Admin: AdminConfig{Addr: "127.0.0.1:0"}})
|
||||
o, _, _ := newTestObserver(t, Config{Admin: AdminConfig{Addr: "127.0.0.1:0", EnablePprof: true}})
|
||||
base := "http://" + o.AdminAddr()
|
||||
|
||||
get := func(path string) (int, string) {
|
||||
@@ -249,8 +249,8 @@ func TestObserver_AdminServer(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestObserver_AdminDisablePprof(t *testing.T) {
|
||||
o, _, _ := newTestObserver(t, Config{Admin: AdminConfig{DisablePprof: true}})
|
||||
func TestObserver_AdminPprofOffByDefault(t *testing.T) {
|
||||
o, _, _ := newTestObserver(t, Config{Admin: AdminConfig{}})
|
||||
w := httptest.NewRecorder()
|
||||
o.AdminHandler().ServeHTTP(w, httptest.NewRequest("GET", "/debug/pprof/", nil))
|
||||
if w.Code != http.StatusNotFound {
|
||||
@@ -294,6 +294,8 @@ func TestConfig_WithEnv(t *testing.T) {
|
||||
t.Setenv("OBSX_LOG_LEVEL", "debug")
|
||||
t.Setenv("OBSX_TRACING_SAMPLER", "0.25")
|
||||
t.Setenv("OBSX_TRACING_DISABLED", "true")
|
||||
t.Setenv("OBSX_TRACING_INSECURE", "true")
|
||||
t.Setenv("OBSX_ADMIN_ENABLE_PPROF", "true")
|
||||
t.Setenv("OBSX_HEALTH_TIMEOUT", "3s")
|
||||
t.Setenv("OBSX_ADMIN_ADDR", ":9999")
|
||||
t.Setenv("OBSX_DISABLE_ACCESS_LOG", "not-a-bool")
|
||||
@@ -306,7 +308,7 @@ func TestConfig_WithEnv(t *testing.T) {
|
||||
if cfg.Environment != "staging" || cfg.Logging.Level != "debug" || cfg.Logging.Format != "text" {
|
||||
t.Errorf("unexpected config: %+v", cfg)
|
||||
}
|
||||
if cfg.Tracing.Sampler != 0.25 || !cfg.Tracing.Disabled {
|
||||
if cfg.Tracing.Sampler != 0.25 || !cfg.Tracing.Disabled || !cfg.Tracing.Insecure || !cfg.Admin.EnablePprof {
|
||||
t.Errorf("unexpected tracing config: %+v", cfg.Tracing)
|
||||
}
|
||||
if cfg.Health.Timeout != 3*time.Second || cfg.Admin.Addr != ":9999" {
|
||||
|
||||
Reference in new issue
Block a user