- 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
@@ -1,6 +1,7 @@
|
||||
package obsx
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
@@ -31,7 +32,7 @@ const (
|
||||
type TracerConfig struct {
|
||||
ServiceName string
|
||||
ServiceVersion string
|
||||
// Environment is the deployment.environment resource attribute, e.g. "production".
|
||||
// Environment is the deployment.environment.name resource attribute, e.g. "production".
|
||||
Environment string
|
||||
// Endpoint is the OTLP collector endpoint: "host:port" or a URL
|
||||
// ("https://collector:4318"). When empty, the standard
|
||||
@@ -39,7 +40,9 @@ type TracerConfig struct {
|
||||
// variables are used; if those are unset too, spans are still created and
|
||||
// propagated (trace IDs appear in logs) but not exported.
|
||||
Endpoint string
|
||||
// Protocol is ProtocolGRPC (default) or ProtocolHTTP.
|
||||
// Protocol is ProtocolGRPC or ProtocolHTTP. When empty,
|
||||
// OTEL_EXPORTER_OTLP_TRACES_PROTOCOL / OTEL_EXPORTER_OTLP_PROTOCOL apply,
|
||||
// then ProtocolGRPC.
|
||||
Protocol string
|
||||
// Insecure disables TLS for the OTLP connection (local collectors, sidecars).
|
||||
Insecure bool
|
||||
@@ -65,7 +68,7 @@ func (c *TracerConfig) defaults() {
|
||||
c.Sampler = 1.0
|
||||
}
|
||||
if c.Protocol == "" {
|
||||
c.Protocol = ProtocolGRPC
|
||||
c.Protocol = cmp.Or(os.Getenv("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL"), os.Getenv("OTEL_EXPORTER_OTLP_PROTOCOL"), ProtocolGRPC)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +191,7 @@ func newResource(ctx context.Context, cfg TracerConfig) (*resource.Resource, err
|
||||
attrs = append(attrs, semconv.ServiceVersion(cfg.ServiceVersion))
|
||||
}
|
||||
if cfg.Environment != "" {
|
||||
attrs = append(attrs, semconv.DeploymentEnvironment(cfg.Environment))
|
||||
attrs = append(attrs, attribute.String("deployment.environment.name", cfg.Environment))
|
||||
}
|
||||
if host, err := os.Hostname(); err == nil {
|
||||
attrs = append(attrs, semconv.ServiceInstanceID(host))
|
||||
|
||||
Reference in new issue
Block a user