-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathconfig.go
More file actions
32 lines (25 loc) · 1.18 KB
/
config.go
File metadata and controls
32 lines (25 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package healthcheckextension // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension"
import (
"errors"
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/healthcheck"
)
// Config wraps the shared healthcheck.Config to add extension-specific validation.
type Config struct {
healthcheck.Config `mapstructure:",squash"`
}
// Validate checks if the extension configuration is valid, including feature gate checks.
func (c *Config) Validate() error {
if !metadata.ExtensionHealthcheckUseComponentStatusFeatureGate.IsEnabled() && (c.HTTPConfig != nil || c.GRPCConfig != nil) {
return errors.New(
"v2 healthcheck configuration (http/grpc fields) detected but feature gate is disabled. " +
"Either remove the v2 config fields or enable the feature gate with: " +
"--feature-gates=+extension.healthcheck.useComponentStatus",
)
}
return nil
}
// Type alias for backward compatibility
type ResponseBodySettings = healthcheck.ResponseBodyConfig