Skip to content

Commit

Permalink
chore: tidy up the api
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Csati <[email protected]>
  • Loading branch information
csatib02 committed Dec 6, 2024
1 parent ad5568c commit 8783be0
Show file tree
Hide file tree
Showing 7 changed files with 1,286 additions and 1,512 deletions.
2 changes: 2 additions & 0 deletions api/telemetry/v1alpha1/bridge_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ type BridgeSpec struct {
// The target tenant to which telemetry will be forwarded.
TargetTenant string `json:"targetTenant"`

// +kubebuilder:validation:Required

// The condition which must be satisfied in order to forward telemetry
// from the source tenant to the target tenant.
Condition string `json:"condition"`
Expand Down
6 changes: 5 additions & 1 deletion api/telemetry/v1alpha1/collector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ type MemoryLimiter struct {

// CollectorSpec defines the desired state of Collector
type CollectorSpec struct {
// +kubebuilder:validation:Required

// TenantSelector is used to select tenants for which the collector should collect data.
TenantSelector metav1.LabelSelector `json:"tenantSelector,omitempty"`
TenantSelector metav1.LabelSelector `json:"tenantSelector"`

// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable, please recreate the resource"
Expand All @@ -60,8 +62,10 @@ type CollectorSpec struct {

// Enables debug logging for the collector.
Debug bool `json:"debug,omitempty"`

// Setting memory limits for the Collector using the memory limiter processor.
MemoryLimiter *MemoryLimiter `json:"memoryLimiter,omitempty"`

// OtelcommonFields is used to override the default DaemonSet's common fields.
OtelCommonFields *otelv1beta1.OpenTelemetryCommonFields `json:"otelCommonFields,omitempty"`
}
Expand Down
11 changes: 11 additions & 0 deletions api/telemetry/v1alpha1/otlp_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ type TimeoutSettings struct {
type QueueSettings struct {
// Enabled indicates whether to not enqueue batches before sending to the consumerSender.
Enabled bool `json:"enabled,omitempty"`

// NumConsumers is the number of consumers from the queue.
NumConsumers int `json:"num_consumers,omitempty"`

// QueueSize is the maximum number of batches allowed in queue at a given time.
QueueSize int `json:"queue_size,omitempty"`

// StorageID if not empty, enables the persistent storage and uses the component specified
// as a storage extension for the persistent queue
StorageID string `json:"storage,omitempty"` //TODO this is *component.ID at Otel
Expand All @@ -45,16 +48,21 @@ type QueueSettings struct {
type BackOffConfig struct {
// Enabled indicates whether to not retry sending batches in case of export failure.
Enabled bool `json:"enabled,omitempty"`

// InitialInterval the time to wait after the first failure before retrying.
InitialInterval time.Duration `json:"initial_interval,omitempty"`

// RandomizationFactor is a random factor used to calculate next backoffs
// Randomized interval = RetryInterval * (1 ± RandomizationFactor)
RandomizationFactor string `json:"randomization_factor,omitempty"`

// Multiplier is the value multiplied by the backoff interval bounds
Multiplier string `json:"multiplier,omitempty"`

// MaxInterval is the upper bound on backoff interval. Once this value is reached the delay between
// consecutive retries will always be `MaxInterval`.
MaxInterval time.Duration `json:"max_interval,omitempty"`

// MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a request/batch.
// Once this value is reached, the data is discarded. If set to 0, the retries are never stopped.
MaxElapsedTime time.Duration `json:"max_elapsed_time,omitempty"`
Expand Down Expand Up @@ -129,8 +137,10 @@ type TLSClientSetting struct {
// https://godoc.org/crypto/tls#Config for more information.
// (optional, default false)
Insecure bool `json:"insecure,omitempty"`

// InsecureSkipVerify will enable TLS but not verify the certificate.
InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"`

// ServerName requested by client for virtual hosting.
// This sets the ServerName in the TLSConfig. Please refer to
// https://godoc.org/crypto/tls#Config for more information. (optional)
Expand Down Expand Up @@ -241,6 +251,7 @@ type HTTPClientConfig struct {
// HTTP2ReadIdleTimeout if the connection has been idle for the configured value send a ping frame for health check
// 0s means no health check will be performed.
HTTP2ReadIdleTimeout *time.Duration `json:"http2_read_idle_timeout,omitempty"`

// HTTP2PingTimeout if there's no response to the ping within the configured value, the connection will be closed.
// If not set or set to 0, it defaults to 15s.
HTTP2PingTimeout *time.Duration `json:"http2_ping_timeout,omitempty"`
Expand Down
7 changes: 3 additions & 4 deletions api/telemetry/v1alpha1/output_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,9 @@ type Fluentforward struct {
// DefaultLabelsEnabled is a map of default attributes to be added to each log record.
DefaultLabelsEnabled *map[string]bool `json:"default_labels_enabled,omitempty"`

QueueConfig *QueueSettings `json:"sending_queue,omitempty"`
RetryConfig *BackOffConfig `json:"retry_on_failure,omitempty"`

Kubernetes *KubernetesMetadata `json:"kubernetes_metadata,omitempty"`
QueueConfig *QueueSettings `json:"sending_queue,omitempty"`
RetryConfig *BackOffConfig `json:"retry_on_failure,omitempty"`
Kubernetes *KubernetesMetadata `json:"kubernetes_metadata,omitempty"`
}

type KubernetesMetadata struct {
Expand Down
Loading

0 comments on commit 8783be0

Please sign in to comment.