Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apis/v1alpha1/targetallocator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,10 @@ type TargetAllocatorSpec struct {
// ReadinessProbe defines the readiness probe configuration for the Target Allocator container.
// +optional
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty"`
// Telemetry defines the self-telemetry configuration for the TargetAllocator.
// When set, the TargetAllocator exports its own metrics via OTLP in addition
// to the Prometheus /metrics endpoint.
//
// +optional
Telemetry v1beta1.TargetAllocatorTelemetry `json:"telemetry,omitempty"`
}
1 change: 1 addition & 0 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions apis/v1beta1/opentelemetrycollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ type TargetAllocatorEmbedded struct {
// +kubebuilder:default:="30s"
// +kubebuilder:validation:Format:=duration
CollectorTargetReloadInterval *metav1.Duration `json:"collectorTargetReloadInterval,omitempty"`
// Telemetry defines the self-telemetry configuration for the TargetAllocator.
// When set, the TargetAllocator exports its own metrics via OTLP in addition
// to the Prometheus /metrics endpoint.
//
// +optional
Telemetry TargetAllocatorTelemetry `json:"telemetry,omitempty"`
}

// Probe defines the OpenTelemetry's pod probe config.
Expand Down Expand Up @@ -315,6 +321,55 @@ type MetricsConfigSpec struct {
DisablePrometheusAnnotations bool `json:"disablePrometheusAnnotations,omitempty"`
}

// TargetAllocatorTelemetry defines the self-telemetry configuration for the TargetAllocator.
type TargetAllocatorTelemetry struct {
// Metrics defines the metrics export settings for the TargetAllocator's own telemetry.
// +optional
Metrics TargetAllocatorMetricsConfig `json:"metrics,omitempty"`
}

// TargetAllocatorMetricsConfig holds metric-export settings for the TargetAllocator's own telemetry.
type TargetAllocatorMetricsConfig struct {
// OTLP configures an optional OTLP metric exporter for the TargetAllocator's self-telemetry.
// When set, metrics are exported via OTLP in addition to the existing Prometheus /metrics endpoint.
// +optional
OTLP *TargetAllocatorOTLPConfig `json:"otlp,omitempty"`
}

// TargetAllocatorOTLPConfig holds connection settings for the TargetAllocator's OTLP self-telemetry exporter.
type TargetAllocatorOTLPConfig struct {
// Endpoint is the OTLP receiver address (e.g. "https://example.com:4318" for HTTP,
// "example.com:4317" for gRPC).
// +kubebuilder:validation:Required
Endpoint string `json:"endpoint"`
// Protocol selects the transport: "grpc" (default) or "http".
// +optional
// +kubebuilder:validation:Enum=grpc;http
Protocol string `json:"protocol,omitempty"`
// Headers are additional key/value pairs sent with every export request,
// e.g. for authentication.
// +optional
Headers map[string]string `json:"headers,omitempty"`
// Insecure disables TLS. Only suitable for local development.
// +optional
Insecure bool `json:"insecure,omitempty"`
// Temporality sets the aggregation temporality for exported metrics.
// Valid values are "cumulative" (default), "delta", and "lowmemory".
// "delta" exports all instruments as delta; "lowmemory" uses delta for
// counters and histograms and cumulative for gauges.
// +optional
// +kubebuilder:validation:Enum=cumulative;delta;lowmemory
Temporality string `json:"temporality,omitempty"`
// ExportInterval is the time between two consecutive exports.
// Defaults to 60s.
// +optional
ExportInterval *metav1.Duration `json:"exportInterval,omitempty"`
// Timeout is the max duration for a single export attempt.
// Defaults to 10s.
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`
}

// ScaleSubresourceStatus defines the observed state of the OpenTelemetryCollector's
// scale subresource.
type ScaleSubresourceStatus struct {
Expand Down
69 changes: 69 additions & 0 deletions apis/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8653,6 +8653,40 @@ spec:
type: object
serviceAccount:
type: string
telemetry:
properties:
metrics:
properties:
otlp:
properties:
endpoint:
type: string
exportInterval:
type: string
headers:
additionalProperties:
type: string
type: object
insecure:
type: boolean
protocol:
enum:
- grpc
- http
type: string
temporality:
enum:
- cumulative
- delta
- lowmemory
type: string
timeout:
type: string
required:
- endpoint
type: object
type: object
type: object
tolerations:
items:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2921,6 +2921,40 @@ spec:
type: string
shareProcessNamespace:
type: boolean
telemetry:
properties:
metrics:
properties:
otlp:
properties:
endpoint:
type: string
exportInterval:
type: string
headers:
additionalProperties:
type: string
type: object
insecure:
type: boolean
protocol:
enum:
- grpc
- http
type: string
temporality:
enum:
- cumulative
- delta
- lowmemory
type: string
timeout:
type: string
required:
- endpoint
type: object
type: object
type: object
terminationGracePeriodSeconds:
format: int64
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8652,6 +8652,40 @@ spec:
type: object
serviceAccount:
type: string
telemetry:
properties:
metrics:
properties:
otlp:
properties:
endpoint:
type: string
exportInterval:
type: string
headers:
additionalProperties:
type: string
type: object
insecure:
type: boolean
protocol:
enum:
- grpc
- http
type: string
temporality:
enum:
- cumulative
- delta
- lowmemory
type: string
timeout:
type: string
required:
- endpoint
type: object
type: object
type: object
tolerations:
items:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2921,6 +2921,40 @@ spec:
type: string
shareProcessNamespace:
type: boolean
telemetry:
properties:
metrics:
properties:
otlp:
properties:
endpoint:
type: string
exportInterval:
type: string
headers:
additionalProperties:
type: string
type: object
insecure:
type: boolean
protocol:
enum:
- grpc
- http
type: string
temporality:
enum:
- cumulative
- delta
- lowmemory
type: string
timeout:
type: string
required:
- endpoint
type: object
type: object
type: object
terminationGracePeriodSeconds:
format: int64
type: integer
Expand Down
36 changes: 36 additions & 0 deletions cmd/otel-allocator/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type Config struct {
FilterStrategy string `yaml:"filter_strategy,omitempty"`
PrometheusCR PrometheusCRConfig `yaml:"prometheus_cr,omitempty"`
HTTPS HTTPSServerConfig `yaml:"https,omitempty"`
Telemetry TelemetryConfig `yaml:"telemetry,omitempty"`
CollectorNotReadyGracePeriod time.Duration `yaml:"collector_not_ready_grace_period,omitempty"`
}

Expand Down Expand Up @@ -101,6 +102,41 @@ type HTTPSServerConfig struct {
TLSKeyFilePath string `yaml:"tls_key_file_path,omitempty"`
}

// TelemetryConfig mirrors the collector's service.telemetry structure for the Target Allocator.
type TelemetryConfig struct {
Metrics MetricsConfig `yaml:"metrics,omitempty"`
}

// MetricsConfig holds metric-export settings for the Target Allocator's own telemetry.
type MetricsConfig struct {
// OTLP configures an optional OTLP metric exporter. When set, metrics are
// exported via OTLP in addition to the existing Prometheus /metrics endpoint.
OTLP *OTLPExporterConfig `yaml:"otlp,omitempty"`
}

// OTLPExporterConfig holds connection settings for the OTLP metric exporter.
type OTLPExporterConfig struct {
// Endpoint is the OTLP receiver base URL or address.
// For HTTP, provide the base URL without the signal path
// (e.g. "https://example.com/api/v2/otlp"); /v1/metrics is appended automatically.
// For gRPC, provide host:port (e.g. "example.com:4317").
Endpoint string `yaml:"endpoint"`
// Protocol selects the transport: "grpc" (default) or "http".
Protocol string `yaml:"protocol,omitempty"`
// Headers are additional key/value pairs sent with every export request.
Headers map[string]string `yaml:"headers,omitempty"`
// Insecure disables TLS — only suitable for local development.
Insecure bool `yaml:"insecure,omitempty"`
// Temporality sets the aggregation temporality: "cumulative" (default), "delta", or "lowmemory".
// "delta" exports all instruments as delta; "lowmemory" uses delta for counters and
// histograms and cumulative for gauges.
Temporality string `yaml:"temporality,omitempty"`
// ExportInterval is the time between two consecutive exports (default 60s).
ExportInterval time.Duration `yaml:"export_interval,omitempty"`
// Timeout is the max duration for a single export attempt (default 10s).
Timeout time.Duration `yaml:"timeout,omitempty"`
}

// StringToModelOrTimeDurationHookFunc returns a DecodeHookFuncType
// that converts string to time.Duration, which can also be used
// as model.Duration.
Expand Down
Loading
Loading