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
7 changes: 4 additions & 3 deletions confgenerator/confgenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ func (uc *UnifiedConfig) GenerateOtelConfig(ctx context.Context, outDir, stateDi
agentSelfMetrics := AgentSelfMetrics{
MetricsVersionLabel: metricVersionLabel,
LoggingVersionLabel: loggingVersionLabel,
FluentBitPort: fluentbit.MetricsPort,
OtelPort: otel.MetricsPort,
FluentBitPort: uc.Global.GetFluentBitMetricsPort(),
OtelPort: uc.Global.GetOtelMetricsPort(),
OtelRuntimeDir: outDir,
}
agentSelfMetrics.AddSelfMetricsPipelines(receiverPipelines, pipelines, ctx)
Expand All @@ -236,6 +236,7 @@ func (uc *UnifiedConfig) GenerateOtelConfig(ctx context.Context, outDir, stateDi

otelConfig, err := otel.ModularConfig{
LogLevel: uc.getOTelLogLevel(),
MetricsPort: uc.Global.GetOtelMetricsPort(),
ReceiverPipelines: receiverPipelines,
Pipelines: pipelines,
Exporters: map[otel.ExporterType]otel.ExporterComponents{
Expand Down Expand Up @@ -608,7 +609,7 @@ func (uc *UnifiedConfig) generateFluentbitComponents(ctx context.Context, userAg
out = append(out, addGceMetadataAttributesProcessor(ctx).Components(ctx, "*", "*.default-data-proc.gce_metadata")...)
}
out = append(out, uc.generateSelfLogsComponents(ctx, userAgent)...)
out = append(out, fluentbit.MetricsOutputComponent())
out = append(out, fluentbit.MetricsOutputComponent(uc.Global.GetFluentBitMetricsPort()))

return out, nil
}
Expand Down
18 changes: 18 additions & 0 deletions confgenerator/config_global.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package confgenerator
type Global struct {
DefaultSelfLogFileCollection *bool `yaml:"default_self_log_file_collection,omitempty"`
DefaultLogFileRotation *LogFileRotation `yaml:"default_self_log_file_rotation,omitempty"`
FluentBitMetricsPort *int `yaml:"fluent_bit_metrics_port,omitempty" validate:"omitempty,gte=1,lte=65535"`
OtelMetricsPort *int `yaml:"otel_metrics_port,omitempty" validate:"omitempty,gte=1,lte=65535"`
}

// Get whether self log collection should be enabled. Defaults to true if unset.
Expand All @@ -27,6 +29,22 @@ func (g *Global) GetDefaultSelfLogFileCollection() bool {
return true
}

// Get the port for Fluent Bit metrics. Defaults to 20202 if unset.
func (g *Global) GetFluentBitMetricsPort() int {
if g != nil && g.FluentBitMetricsPort != nil {
return *g.FluentBitMetricsPort
}
return 20202
}

// Get the port for OTel metrics. Defaults to 20201 if unset.
func (g *Global) GetOtelMetricsPort() int {
if g != nil && g.OtelMetricsPort != nil {
return *g.OtelMetricsPort
}
return 20201
}

type LogFileRotation struct {
Enabled *bool `yaml:"enabled"`
MaxFileSize *int `yaml:"max_file_size_megabytes" validate:"omitempty,gte=1"`
Expand Down
Loading
Loading