Renamed from initializeObservability to better reflect its purpose
(ctx context.Context, cfg *config.Configuration)
| 292 | |
| 293 | // Renamed from initializeObservability to better reflect its purpose |
| 294 | func initializeTelemetryAndObservability(ctx context.Context, cfg *config.Configuration) (posthog.Client, func(context.Context) error, error) { |
| 295 | var phClient posthog.Client |
| 296 | var tracingShutdown func(context.Context) error = func(context.Context) error { return nil } |
| 297 | var err error |
| 298 | |
| 299 | // Initialize tracing if observability is enabled |
| 300 | if cfg.EnableObservability { |
| 301 | tracingShutdown, err = initializeOpenTelemetry(ctx) |
| 302 | if err != nil { |
| 303 | return nil, nil, fmt.Errorf("failed to initialize tracing: %w", err) |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | // Initialize PostHog if telemetry is enabled |
| 308 | if cfg.EnableTelemetry { |
| 309 | phClient, _ = initializePostHog(cfg) |
| 310 | } |
| 311 | |
| 312 | return phClient, tracingShutdown, nil |
| 313 | } |
| 314 | |
| 315 | /* |
| 316 | serverCommands returns the Cobra command responsible for starting the LedgerForge server. |
no test coverage detected