A continuation of HomeBox the inventory and organization system built for the Home User
chore: cleanup after merge
Matthew Kilgorea14e1e9d49b5
diff --git a/backend/app/api/main.go b/backend/app/api/main.goindex 50c0cc3a..057898bc 100644--- a/backend/app/api/main.go+++ b/backend/app/api/main.go@@ -233,7 +233,6 @@ func run(cfg *config.Config) error {otelchi.Middleware(cfg.Otel.ServiceName, otelchi.WithChiRoutes(router)),otelchimetric.NewResponseSizeBytes(otelChiBaseCfg),otelchimetric.NewRequestInFlight(otelChiBaseCfg),- otelchimetric.NewResponseSizeBytes(otelChiBaseCfg),)}diff --git a/backend/internal/sys/otel/database.go b/backend/internal/sys/otel/database.goindex 49190b15..36270a36 100644--- a/backend/internal/sys/otel/database.go+++ b/backend/internal/sys/otel/database.go@@ -47,7 +47,7 @@ func (p *Provider) OpenDatabase(driverName, dataSourceName string) (*sql.DB, err}// Register stats for metrics (ignoring error as it's non-fatal)- _, _ = otelsql.RegisterDBStatsMetrics(db,+ _ = otelsql.RegisterDBStatsMetrics(db,otelsql.WithAttributes(semconv.DBSystemKey.String(dbSystem),),diff --git a/backend/internal/sys/otel/otel.go b/backend/internal/sys/otel/otel.goindex d6fffa26..546d35cb 100644--- a/backend/internal/sys/otel/otel.go+++ b/backend/internal/sys/otel/otel.go@@ -371,7 +371,8 @@ func createOTLPMetricExporter(ctx context.Context, cfg *config.OTelConfig) (sdkmopts = append(opts, otlpmetricgrpc.WithEndpoint(cfg.Endpoint))}if cfg.Insecure {- opts = append(opts, otlpmetricgrpc.WithInsecure())+ // Insecure mode disables TLS; use only for dev/testing or trusted networks.+ opts = append(opts, otlpmetricgrpc.WithDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())))}if len(headers) > 0 {opts = append(opts, otlpmetricgrpc.WithHeaders(headers))@@ -425,7 +426,8 @@ func createOTLPLogExporter(ctx context.Context, cfg *config.OTelConfig) (sdklog.opts = append(opts, otlploggrpc.WithEndpoint(cfg.Endpoint))}if cfg.Insecure {- opts = append(opts, otlploggrpc.WithInsecure())+ // Insecure mode disables TLS; use only for dev/testing or trusted networks.+ opts = append(opts, otlploggrpc.WithDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())))}if len(headers) > 0 {opts = append(opts, otlploggrpc.WithHeaders(headers))diff --git a/backend/internal/sys/otel/proxy.go b/backend/internal/sys/otel/proxy.goindex d5e4310b..a89eaadd 100644--- a/backend/internal/sys/otel/proxy.go+++ b/backend/internal/sys/otel/proxy.go@@ -17,6 +17,7 @@ import (resourcepb "go.opentelemetry.io/proto/otlp/resource/v1"tracepb "go.opentelemetry.io/proto/otlp/trace/v1""google.golang.org/grpc"+ "google.golang.org/grpc/credentials""google.golang.org/grpc/credentials/insecure""google.golang.org/protobuf/proto")@@ -239,6 +240,8 @@ func (p *Provider) createProxyClient(_ context.Context) (otlpClient, error) {dialOpts := []grpc.DialOption{}if p.cfg.Insecure {dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials()))+ } else {+ dialOpts = append(dialOpts, grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")))}conn, err := grpc.NewClient(p.cfg.Endpoint, dialOpts...)diff --git a/frontend/global.d.ts b/frontend/global.d.tsindex f71a96dd..69699fec 100644--- a/frontend/global.d.ts+++ b/frontend/global.d.ts@@ -1 +1,14 @@/// <reference types="unplugin-icons/types/vue" />++declare module "#app" {+ interface NuxtApp {+ $otelEnabled: boolean;+ }+}++declare module "vue" {+ interface ComponentCustomProperties {+ $otelEnabled: boolean;+ }+}+export {};diff --git a/frontend/lib/otel/index.ts b/frontend/lib/otel/index.tsindex f04496ea..db580010 100644--- a/frontend/lib/otel/index.ts+++ b/frontend/lib/otel/index.ts@@ -101,12 +101,11 @@ class BackendProxyExporter implements SpanExporter {private convertSpan(span: ReadableSpan): object {const spanContext = span.spanContext();- // Get parent span ID from the span context if available- const parentSpanContext = (span as unknown as { parentSpanId?: string }).parentSpanId;+ const parentSpanContext = span.parentSpanContext;return {traceId: spanContext.traceId,spanId: spanContext.spanId,- parentSpanId: parentSpanContext || undefined,+ parentSpanId: parentSpanContext?.spanId,name: span.name,kind: this.spanKindToString(span.kind),startTime: span.startTime[0] * 1000 + Math.floor(span.startTime[1] / 1000000),diff --git a/frontend/plugins/otel.client.ts b/frontend/plugins/otel.client.tsindex 8cf08550..05729992 100644--- a/frontend/plugins/otel.client.ts+++ b/frontend/plugins/otel.client.ts@@ -41,42 +41,39 @@ async function fetchBackendTelemetryStatus(debug: boolean): Promise<boolean> {}export default defineNuxtPlugin(async () => {- // Only run on client side- if (import.meta.client) {- const runtimeConfig = useRuntimeConfig();- const otelDebug = String(runtimeConfig.public?.otelDebug || "false") === "true";+ const runtimeConfig = useRuntimeConfig();+ const otelDebug = String(runtimeConfig.public?.otelDebug || "false") === "true";- // Check if backend has telemetry enabled via the status endpoint- const backendTelemetryEnabled = await fetchBackendTelemetryStatus(otelDebug);+ // Check if backend has telemetry enabled via the status endpoint+ const backendTelemetryEnabled = await fetchBackendTelemetryStatus(otelDebug);- // Only enable if backend telemetry is enabled- if (!backendTelemetryEnabled) {- if (otelDebug) {- console.log("[OTel] Telemetry disabled (backend telemetry not enabled)");- }- return {- provide: {- otelEnabled: false,- },- };+ // Only enable if backend telemetry is enabled+ if (!backendTelemetryEnabled) {+ if (otelDebug) {+ console.log("[OTel] Telemetry disabled (backend telemetry not enabled)");}-- const otelConfig = {- enabled: true,- serviceName: String(runtimeConfig.public?.otelServiceName || "homebox-frontend"),- serviceVersion: String(runtimeConfig.public?.otelServiceVersion || "1.0.0"),- useBackendProxy: true, // Always use backend proxy for security- sampleRate: parseFloat(String(runtimeConfig.public?.otelSampleRate || "1.0")),- debug: otelDebug,- };-- // Initialize OpenTelemetry- initializeOTel(otelConfig);-return {provide: {- otelEnabled: true,+ otelEnabled: false,},};}++ const otelConfig = {+ enabled: true,+ serviceName: String(runtimeConfig.public?.otelServiceName || "homebox-frontend"),+ serviceVersion: String(runtimeConfig.public?.otelServiceVersion || "1.0.0"),+ useBackendProxy: true, // Always use backend proxy for security+ sampleRate: parseFloat(String(runtimeConfig.public?.otelSampleRate || "1.0")),+ debug: otelDebug,+ };++ // Initialize OpenTelemetry+ initializeOTel(otelConfig);++ return {+ provide: {+ otelEnabled: true,+ },+ };});