Skip to content

Commit a8c583d

Browse files
authored
add otel to pipeline builder (#672)
1 parent 959d918 commit a8c583d

File tree

3 files changed

+48
-9
lines changed

3 files changed

+48
-9
lines changed

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,16 @@ Usage:
4949
flowlogs-pipeline [flags]
5050

5151
Flags:
52-
--config string config file (default is $HOME/.flowlogs-pipeline)
53-
--health.address string Health server address (default "0.0.0.0")
54-
--health.port string Health server port (default "8080")
55-
-h, --help help for flowlogs-pipeline
56-
--log-level string Log level: debug, info, warning, error (default "error")
57-
--metricsSettings string json for global metrics settings
58-
--parameters string json of config file parameters field
59-
--pipeline string json of config file pipeline field
60-
--profile.port int Go pprof tool port (default: disabled)
52+
--config string config file (default is $HOME/.flowlogs-pipeline)
53+
--dynamicParameters string json of configmap location for dynamic parameters
54+
--health.address string Health server address (default "0.0.0.0")
55+
--health.port string Health server port (default "8080")
56+
-h, --help help for flowlogs-pipeline
57+
--log-level string Log level: debug, info, warning, error (default "error")
58+
--metricsSettings string json for global metrics settings
59+
--parameters string json of config file parameters field
60+
--pipeline string json of config file pipeline field
61+
--profile.port int Go pprof tool port (default: disabled)
6162
```
6263
<!---END-AUTO-flowlogs-pipeline_help--->
6364

@@ -927,6 +928,8 @@ Develop
927928
docs Update flowlogs-pipeline documentation
928929
clean Clean
929930
tests-unit Unit tests
931+
coverage-report Generate coverage report
932+
coverage-report-html Generate HTML coverage report
930933
tests-fast Fast unit tests (no race tests / coverage)
931934
tests-e2e End-to-end tests
932935
tests-all All tests

pkg/config/pipeline_builder.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,27 @@ func (b *PipelineBuilderStage) EncodeS3(name string, s3 api.EncodeS3) PipelineBu
165165
return b.next(name, NewEncodeS3Params(name, s3))
166166
}
167167

168+
// EncodeOtelLogs chains the current stage with an EncodeOtelLogs stage (writing logs to open telemetry) and returns that new stage
169+
//
170+
//nolint:golint,gocritic
171+
func (b *PipelineBuilderStage) EncodeOtelLogs(name string, logs api.EncodeOtlpLogs) PipelineBuilderStage {
172+
return b.next(name, NewEncodeOtelLogsParams(name, logs))
173+
}
174+
175+
// EncodeOtelMetrics chains the current stage with an EncodeOtelMetrics stage (writing metrics to open telemetry) and returns that new stage
176+
//
177+
//nolint:golint,gocritic
178+
func (b *PipelineBuilderStage) EncodeOtelMetrics(name string, metrics api.EncodeOtlpMetrics) PipelineBuilderStage {
179+
return b.next(name, NewEncodeOtelMetricsParams(name, metrics))
180+
}
181+
182+
// EncodeOtelTraces chains the current stage with an EncodeOtelTraces stage (writing traces to open telemetry) and returns that new stage
183+
//
184+
//nolint:golint,gocritic
185+
func (b *PipelineBuilderStage) EncodeOtelTraces(name string, traces api.EncodeOtlpTraces) PipelineBuilderStage {
186+
return b.next(name, NewEncodeOtelTracesParams(name, traces))
187+
}
188+
168189
// WriteStdout chains the current stage with a WriteStdout stage and returns that new stage
169190
func (b *PipelineBuilderStage) WriteStdout(name string, stdout api.WriteStdout) PipelineBuilderStage {
170191
return b.next(name, NewWriteStdoutParams(name, stdout))

pkg/config/stage_params.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,21 @@ func NewEncodeS3Params(name string, s3 api.EncodeS3) StageParam {
7474
return StageParam{Name: name, Encode: &Encode{Type: api.S3Type, S3: &s3}}
7575
}
7676

77+
//nolint:golint,gocritic
78+
func NewEncodeOtelLogsParams(name string, otelLogs api.EncodeOtlpLogs) StageParam {
79+
return StageParam{Name: name, Encode: &Encode{Type: api.OtlpLogsType, OtlpLogs: &otelLogs}}
80+
}
81+
82+
//nolint:golint,gocritic
83+
func NewEncodeOtelMetricsParams(name string, otelMetrics api.EncodeOtlpMetrics) StageParam {
84+
return StageParam{Name: name, Encode: &Encode{Type: api.OtlpMetricsType, OtlpMetrics: &otelMetrics}}
85+
}
86+
87+
//nolint:golint,gocritic
88+
func NewEncodeOtelTracesParams(name string, otelTraces api.EncodeOtlpTraces) StageParam {
89+
return StageParam{Name: name, Encode: &Encode{Type: api.OtlpTracesType, OtlpTraces: &otelTraces}}
90+
}
91+
7792
func NewWriteStdoutParams(name string, stdout api.WriteStdout) StageParam {
7893
return StageParam{Name: name, Write: &Write{Type: api.StdoutType, Stdout: &stdout}}
7994
}

0 commit comments

Comments
 (0)