Skip to content

Commit

Permalink
fixups
Browse files Browse the repository at this point in the history
Signed-off-by: Szilard Parrag <szilard.parrag@axoflow.com>
  • Loading branch information
OverOrion committed Apr 18, 2024
1 parent 326d217 commit 42ea430
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/telemetry/v1alpha1/oteloutput_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type TCPClientSettings struct {
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`

// Connection Timeout parameter configures `net.Dialer`.
ConnectionTimeout time.Duration `json:"connection_timeout,omitempty" yaml:"connection_timeout, omitempty"`
ConnectionTimeout time.Duration `json:"connection_timeout,omitempty" yaml:"connection_timeout,omitempty"`

// TLSSetting struct exposes TLS client configuration.
TLSSetting TLSClientSetting `json:"tls,omitempty" yaml:"tls,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ exporters:
endpoint: loki.example-tenant-ns.svc.cluster.local:4317
tls:
insecure: true
fluentforwardexporter/collector_fluentforward-test-output:
endpoint: fluentforward.example-tenant-ns.svc.cluster.local:8888
map_metadata: true
tls:
insecure: true
otlp/collector_otlp-test-output:
endpoint: receiver-collector.example-tenant-ns.svc.cluster.local:4317
tls:
Expand Down
27 changes: 27 additions & 0 deletions internal/controller/telemetry/otel_conf_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func (cfgInput *OtelColConfigInput) generateExporters(ctx context.Context) map[s

maps.Copy(exporters, cfgInput.generateOTLPExporters(ctx))
maps.Copy(exporters, cfgInput.generateLokiExporters(ctx))
maps.Copy(exporters, cfgInput.generateFluentforwardExporters(ctx))
exporters["logging/debug"] = map[string]any{
"verbosity": "detailed",
}
Expand Down Expand Up @@ -162,6 +163,32 @@ func (cfgInput *OtelColConfigInput) generateLokiExporters(ctx context.Context) m
return result
}

func (cfgInput *OtelColConfigInput) generateFluentforwardExporters(ctx context.Context) map[string]any {
logger := log.FromContext(ctx)

var result = make(map[string]any)

for _, output := range cfgInput.Outputs {
if output.Spec.Fluentforward != nil {

// TODO: add proper error handling
name := fmt.Sprintf("fluentforwardexporter/%s_%s", output.Namespace, output.Name)
fluetForwardMarshaled, err := yaml.Marshal(output.Spec.Fluentforward)
if err != nil {
logger.Error(errors.New("failed to compile config for output"), "failed to compile config for output %q", output.NamespacedName().String())
}
var fluetForwardValues map[string]any
if err := yaml.Unmarshal(fluetForwardMarshaled, &fluetForwardValues); err != nil {
logger.Error(errors.New("failed to compile config for output"), "failed to compile config for output %q", output.NamespacedName().String())
}

result[name] = fluetForwardValues
}
}

return result
}

func generatePipeline(receivers, processors, exporters []string) Pipeline {
var result = Pipeline{}

Expand Down

0 comments on commit 42ea430

Please sign in to comment.