Skip to content

Commit

Permalink
Add fine tuning for the collector-agent
Browse files Browse the repository at this point in the history
Signed-off-by: Joao Henri <[email protected]>
  • Loading branch information
jaehnri committed Oct 11, 2023
1 parent 802795a commit 067c2e6
Show file tree
Hide file tree
Showing 9 changed files with 299 additions and 93 deletions.
60 changes: 45 additions & 15 deletions apis/core/v1beta1/collector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,52 @@ const (
)

type CollectorSpec struct {
opnimeta.ImageSpec `json:",inline,omitempty"`
AgentEndpoint string `json:"agentEndpoint,omitempty"`
SystemNamespace string `json:"systemNamespace,omitempty"`
LoggingConfig *corev1.LocalObjectReference `json:"loggingConfig,omitempty"`
MetricsConfig *corev1.LocalObjectReference `json:"metricsConfig,omitempty"`
ConfigReloader *ConfigReloaderSpec `json:"configReloader,omitempty"`
LogLevel string `json:"logLevel,omitempty"`
OTELConfigSpec *OTELConfigSpec `json:"otelCollectorSpec,omitempty"`
opnimeta.ImageSpec `json:",inline,omitempty"`
AgentEndpoint string `json:"agentEndpoint,omitempty"`
SystemNamespace string `json:"systemNamespace,omitempty"`
LoggingConfig *corev1.LocalObjectReference `json:"loggingConfig,omitempty"`
MetricsConfig *corev1.LocalObjectReference `json:"metricsConfig,omitempty"`
ConfigReloader *ConfigReloaderSpec `json:"configReloader,omitempty"`
LogLevel string `json:"logLevel,omitempty"`
AggregatorOTELConfigSpec *AggregatorOTELConfigSpec `json:"aggregatorOtelCollectorSpec,omitempty"`
NodeOTELConfigSpec *NodeOTELConfigSpec `json:"nodeOtelCollectorSpec,omitempty"`
}

type ConfigReloaderSpec struct {
opnimeta.ImageSpec `json:",inline,omitempty"`
}

type OTELConfigSpec struct {
Processors OTELProcessors `json:"processors,omitempty"`
Exporters OTELExporters `json:"exporters,omitempty"`
type AggregatorOTELConfigSpec struct {
Processors AggregatorOTELProcessors `json:"processors,omitempty"`
Exporters AggregatorOTELExporters `json:"exporters,omitempty"`
}

type OTELProcessors struct {
type AggregatorOTELProcessors struct {
Batch BatchProcessorConfig `json:"batch,omitempty"`
MemoryLimiter MemoryLimiterProcessorConfig `json:"memoryLimiter,omitempty"`
}

type OTELExporters struct {
type AggregatorOTELExporters struct {
OTLPHTTP OTLPHTTPExporterConfig `json:"otlphttp,omitempty"`
}

type NodeOTELConfigSpec struct {
Processors NodeOTELProcessors `json:"processors,omitempty"`
Exporters NodeOTELExporters `json:"exporters,omitempty"`
}

type NodeOTELProcessors struct {
MemoryLimiter MemoryLimiterProcessorConfig `json:"memoryLimiter,omitempty"`
}

type NodeOTELExporters struct {
OTLP OTLPExporterConfig `json:"otlp,omitempty"`
}

// MemoryLimiterProcessorConfig has the attributes that we want to make
// available from memorylimiterexporter.Config.
// Also, we extend it with the JSON struct tags needed in order to kubebuilder
// and controller-gen work.
type MemoryLimiterProcessorConfig struct {
// CheckInterval is the time between measurements of memory usage for the
// purposes of avoiding going over the limits. Defaults to zero, so no
Expand Down Expand Up @@ -74,6 +92,10 @@ type MemoryLimiterProcessorConfig struct {
MemorySpikePercentage uint32 `json:"spikeLimitPercentage,omitempty"`
}

// BatchProcessorConfig has the attributes that we want to make
// available from batchprocessor.Config.
// Also, we extend it with the JSON struct tags needed in order to kubebuilder
// and controller-gen work.
type BatchProcessorConfig struct {
// Timeout sets the time after which a batch will be sent regardless of size.
// When this is set to zero, batched data will be sent immediately.
Expand Down Expand Up @@ -110,16 +132,24 @@ type BatchProcessorConfig struct {
MetadataCardinalityLimit uint32 `json:"metadataCardinalityLimit,omitempty"`
}

type OTLPHTTPSendingQueue struct {
// CollectorSendingQueue has the attributes that we want to make
// available from exporterhelper.QueueSettings.
// Also, we extend it with the JSON struct tags needed in order to kubebuilder
// and controller-gen work.
type CollectorSendingQueue 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:"numConsumers,omitempty"`
// QueueSize is the maximum number of batches allowed in queue at a given time.
QueueSize int `json:"queueSize,omitempty"`
}

type OTLPExporterConfig struct {
SendingQueue CollectorSendingQueue `json:"sendingQueue,omitempty"`
}
type OTLPHTTPExporterConfig struct {
SendingQueue OTLPHTTPSendingQueue `json:"sendingQueue,omitempty"`
SendingQueue CollectorSendingQueue `json:"sendingQueue,omitempty"`
}

// CollectorStatus defines the observed state of Collector
Expand Down
122 changes: 96 additions & 26 deletions apis/core/v1beta1/zz_generated.deepcopy.go

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

Loading

0 comments on commit 067c2e6

Please sign in to comment.