zero/healthchecks: add reporter

This commit is contained in:
Denis Mishin 2023-12-13 10:50:39 -05:00
parent 228242e43a
commit 111f794969
17 changed files with 414 additions and 200 deletions

View file

@ -12,6 +12,7 @@ type Option func(*config)
type config struct {
clusterAPIEndpoint string
connectAPIEndpoint string
otelEndpoint string
apiToken string
httpClient *http.Client
downloadURLCacheTTL time.Duration
@ -31,6 +32,13 @@ func WithConnectAPIEndpoint(endpoint string) Option {
}
}
// WithOTELEndpoint sets the OTEL API endpoint
func WithOTELEndpoint(endpoint string) Option {
return func(cfg *config) {
cfg.otelEndpoint = endpoint
}
}
// WithAPIToken sets the API token
func WithAPIToken(token string) Option {
return func(cfg *config) {
@ -77,6 +85,9 @@ func (c *config) validate() error {
if c.connectAPIEndpoint == "" {
return fmt.Errorf("connect API endpoint is required")
}
if c.otelEndpoint == "" {
return fmt.Errorf("OTEL API endpoint is required")
}
if c.apiToken == "" {
return fmt.Errorf("API token is required")
}