Shutdown releases telemetry resources (e.g. OTLP batch flush). Call on process exit.
(ctx context.Context)
| 150 | |
| 151 | // Shutdown releases telemetry resources (e.g. OTLP batch flush). Call on process exit. |
| 152 | func (s *Server) Shutdown(ctx context.Context) error { |
| 153 | if s.ledger != nil { |
| 154 | _ = s.ledger.Close() |
| 155 | } |
| 156 | type shutdowner interface { |
| 157 | Shutdown(context.Context) error |
| 158 | } |
| 159 | if x, ok := s.telemetry.(shutdowner); ok { |
| 160 | return x.Shutdown(ctx) |
| 161 | } |
| 162 | return nil |
| 163 | } |
| 164 | |
| 165 | func (s *Server) effectiveInfercoreAPIKey() string { |
| 166 | if k := strings.TrimSpace(os.Getenv("INFERCORE_API_KEY")); k != "" { |