From 68820116e99fa45329a944a6d0ce86daf9b8171a Mon Sep 17 00:00:00 2001 From: Erik Baranowski <39704712+erikbaranowski@users.noreply.github.com> Date: Wed, 3 Apr 2024 19:21:38 -0400 Subject: [PATCH] Added support for static configuration conversion of the traces subsystem (#6820) Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com> --- CHANGELOG.md | 2 ++ docs/sources/flow/tasks/migrate/from-static.md | 2 +- .../staticconvert/internal/build/builder_traces.go | 9 +++++++++ .../internal/staticconvert/testdata/traces.yaml | 2 -- .../internal/staticconvert/testdata/unsupported.diags | 1 + .../internal/staticconvert/testdata/unsupported.yaml | 2 ++ 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55c75ad9fdf7..b54c0b1d69ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,8 @@ Main (unreleased) - Added support for `otelcol` configuration conversion in `grafana-agent convert` and `grafana-agent run` commands. (@rfratto, @erikbaranowski, @tpaschalis, @hainenber) +- Added support for `static` configuration conversion of the `traces` subsystem. (@erikbaranowski, @wildum) + - Add automatic conversion for `legacy_positions_file` in component `loki.source.file`. (@mattdurham) ### Features diff --git a/docs/sources/flow/tasks/migrate/from-static.md b/docs/sources/flow/tasks/migrate/from-static.md index 5d1b73626f60..eb035223ce80 100644 --- a/docs/sources/flow/tasks/migrate/from-static.md +++ b/docs/sources/flow/tasks/migrate/from-static.md @@ -339,7 +339,7 @@ After the configuration is converted, review the {{< param "PRODUCT_NAME" >}} co The following list is specific to the convert command and not {{< param "PRODUCT_NAME" >}}: -* The [Traces][] and [Agent Management][] configuration options can't be automatically converted to {{< param "PRODUCT_NAME" >}}. However, traces are fully supported in {{< param "PRODUCT_NAME" >}} and you can build your configuration manually. +* The [Agent Management][] configuration options can't be automatically converted to {{< param "PRODUCT_NAME" >}}. Any additional unsupported features are returned as errors during conversion. * There is no gRPC server to configure for {{< param "PRODUCT_NAME" >}}, as any non-default configuration will show as unsupported during the conversion. * Check if you are using any extra command line arguments with Static that aren't present in your configuration file. For example, `-server.http.address`. diff --git a/internal/converter/internal/staticconvert/internal/build/builder_traces.go b/internal/converter/internal/staticconvert/internal/build/builder_traces.go index 1122ae9cec1b..d13a06e27ae0 100644 --- a/internal/converter/internal/staticconvert/internal/build/builder_traces.go +++ b/internal/converter/internal/staticconvert/internal/build/builder_traces.go @@ -39,6 +39,15 @@ func (b *ConfigBuilder) appendTraces() { // Remove the push receiver which is an implementation detail for static mode and unnecessary for the otel config. removeReceiver(otelCfg, "traces", "push_receiver") + // Remove the service_graphs processor which is an implementation detail for static mode and unnecessary for the otel config. + if _, ok := otelCfg.Processors[otel_component.NewID("service_graphs")]; ok { + removeProcessor(otelCfg, "traces", "service_graphs") + b.diags.Add(diag.SeverityLevelError, "The service_graphs processor for traces has no direct flow equivalent. "+ + "This configuration appends metrics to the /metrics endpoint of the agent which is not possible in flow. "+ + "Alternatively, you can use the otelcol.connector.servicegraph component to build a pipeline which generates "+ + "and forwards service graph metrics.") + } + b.translateAutomaticLogging(otelCfg, cfg) b.translateSpanMetrics(otelCfg, cfg) diff --git a/internal/converter/internal/staticconvert/testdata/traces.yaml b/internal/converter/internal/staticconvert/testdata/traces.yaml index a97262722fc5..c6e295294130 100644 --- a/internal/converter/internal/staticconvert/testdata/traces.yaml +++ b/internal/converter/internal/staticconvert/testdata/traces.yaml @@ -60,8 +60,6 @@ traces: hostnames: - tempo1.example.com - tempo2.example.com - # service_graphs: - # enabled: true jaeger_remote_sampling: - source: reload_interval: 30s diff --git a/internal/converter/internal/staticconvert/testdata/unsupported.diags b/internal/converter/internal/staticconvert/testdata/unsupported.diags index c2b745cc05a2..5687193a097d 100644 --- a/internal/converter/internal/staticconvert/testdata/unsupported.diags +++ b/internal/converter/internal/staticconvert/testdata/unsupported.diags @@ -1,5 +1,6 @@ (Error) The converter does not support handling integrations which are not being scraped: mssql. (Error) mapping_config is not supported in statsd_exporter integrations config +(Error) The service_graphs processor for traces has no direct flow equivalent. This configuration appends metrics to the /metrics endpoint of the agent which is not possible in flow. Alternatively, you can use the otelcol.connector.servicegraph component to build a pipeline which generates and forwards service graph metrics. (Error) automatic_logging for traces has no direct flow equivalent. A best effort translation can be made which only outputs to stdout and not directly to loki by bypassing errors. (Error) Cannot convert using configuration including spanmetrics handler_endpoint. No equivalent exists for exposing a known /metrics endpoint. You can use metrics_instance instead to enabled conversion. (Warning) Please review your agent command line flags and ensure they are set in your Flow mode config file where necessary. diff --git a/internal/converter/internal/staticconvert/testdata/unsupported.yaml b/internal/converter/internal/staticconvert/testdata/unsupported.yaml index d43a369fadfc..bb34aaac4c8a 100644 --- a/internal/converter/internal/staticconvert/testdata/unsupported.yaml +++ b/internal/converter/internal/staticconvert/testdata/unsupported.yaml @@ -66,6 +66,8 @@ traces: backend: "something else" spanmetrics: handler_endpoint: http://localhost:1234/write + service_graphs: + enabled: true agent_management: host: host_name