A continuation of HomeBox the inventory and organization system built for the Home User
fix: handle path prefix better
Matthew Kilgoref9d3c8e966f1
diff --git a/backend/internal/sys/config/conf_otel.go b/backend/internal/sys/config/conf_otel.goindex 5267838e..4cd6ced1 100644--- a/backend/internal/sys/config/conf_otel.go+++ b/backend/internal/sys/config/conf_otel.go@@ -19,6 +19,8 @@ type OTelConfig struct {// The full address including port should be specifiedEndpoint string `yaml:"endpoint"`+ PathPrefix string `yaml:"path_prefix"`+// Protocol specifies the OTLP protocol: "grpc" or "http"Protocol string `yaml:"protocol" conf:"default:grpc"`diff --git a/backend/internal/sys/otel/otel.go b/backend/internal/sys/otel/otel.goindex 97de4474..1b5ebb17 100644--- a/backend/internal/sys/otel/otel.go+++ b/backend/internal/sys/otel/otel.go@@ -299,12 +299,8 @@ func createOTLPExporter(ctx context.Context, cfg *config.OTelConfig) (*otlptracecase "http":opts := []otlptracehttp.Option{}if cfg.Endpoint != "" {- host, path := parseEndpoint(cfg.Endpoint)- opts = append(opts, otlptracehttp.WithEndpoint(host))- if path != "" {- // Custom base path - append the standard OTLP trace path- opts = append(opts, otlptracehttp.WithURLPath(path+"/v1/traces"))- }+ opts = append(opts, otlptracehttp.WithEndpoint(cfg.Endpoint))+ opts = append(opts, otlptracehttp.WithURLPath(cfg.PathPrefix+"/v1/traces"))}if cfg.Insecure {opts = append(opts, otlptracehttp.WithInsecure())@@ -358,12 +354,8 @@ func createOTLPMetricExporter(ctx context.Context, cfg *config.OTelConfig) (sdkmcase "http":opts := []otlpmetrichttp.Option{}if cfg.Endpoint != "" {- host, path := parseEndpoint(cfg.Endpoint)- opts = append(opts, otlpmetrichttp.WithEndpoint(host))- if path != "" {- // Custom base path - append the standard OTLP metrics path- opts = append(opts, otlpmetrichttp.WithURLPath(path+"/v1/metrics"))- }+ opts = append(opts, otlpmetrichttp.WithEndpoint(cfg.Endpoint))+ opts = append(opts, otlpmetrichttp.WithURLPath(cfg.PathPrefix+"/v1/metrics"))}if cfg.Insecure {opts = append(opts, otlpmetrichttp.WithInsecure())@@ -416,12 +408,8 @@ func createOTLPLogExporter(ctx context.Context, cfg *config.OTelConfig) (sdklog.case "http":opts := []otlploghttp.Option{}if cfg.Endpoint != "" {- host, path := parseEndpoint(cfg.Endpoint)- opts = append(opts, otlploghttp.WithEndpoint(host))- if path != "" {- // Custom base path - append the standard OTLP logs path- opts = append(opts, otlploghttp.WithURLPath(path+"/v1/logs"))- }+ opts = append(opts, otlploghttp.WithEndpoint(cfg.Endpoint))+ opts = append(opts, otlploghttp.WithURLPath(cfg.PathPrefix+"/v1/logs"))}if cfg.Insecure {opts = append(opts, otlploghttp.WithInsecure())