diff --git a/internal/converter/internal/otelcolconvert/converter.go b/internal/converter/internal/otelcolconvert/converter.go index 77d74f61c208..dda3262a4a01 100644 --- a/internal/converter/internal/otelcolconvert/converter.go +++ b/internal/converter/internal/otelcolconvert/converter.go @@ -11,9 +11,9 @@ import ( "go.opentelemetry.io/collector/otelcol" ) -// componentConverter represents a converter which converts an OpenTelemetry +// ComponentConverter represents a converter which converts an OpenTelemetry // Collector component into a Flow component. -type componentConverter interface { +type ComponentConverter interface { // Factory should return the factory for the OpenTelemetry Collector // component. Factory() component.Factory @@ -39,25 +39,25 @@ type componentConverter interface { // ConvertAndAppend may be called more than once with the same component used // in different pipelines. Use [state.FlowComponentLabel] to get a guaranteed // unique Flow component label for the current state. - ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics + ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics } // List of component converters. This slice is appended to by init functions in // other files. -var converters []componentConverter +var converters []ComponentConverter -// state represents the state of the conversion. The state tracks: +// State represents the State of the conversion. The State tracks: // // - The OpenTelemetry Collector config being converted. // - The current OpenTelemetry Collector pipelines being converted. // - The current OpenTelemetry Collector component being converted. -type state struct { +type State struct { cfg *otelcol.Config // Input config. file *builder.File // Output file. group *pipelineGroup // Current pipeline group being converted. // converterLookup maps a converter key to the associated converter instance. - converterLookup map[converterKey]componentConverter + converterLookup map[converterKey]ComponentConverter // extensionLookup maps OTel extensions to Flow component IDs. extensionLookup map[component.ID]componentID @@ -74,18 +74,18 @@ type converterKey struct { // Body returns the body of the file being generated. Implementations of // [componentConverter] should use this to append components. -func (state *state) Body() *builder.Body { return state.file.Body() } +func (state *State) Body() *builder.Body { return state.file.Body() } // FlowComponentLabel returns the unique Flow label for the OpenTelemetry // Component component being converted. It is safe to use this label to create // multiple Flow components in a chain. -func (state *state) FlowComponentLabel() string { +func (state *State) FlowComponentLabel() string { return state.flowLabelForComponent(state.componentID) } // flowLabelForComponent returns the unique Flow label for the given // OpenTelemetry Collector component. -func (state *state) flowLabelForComponent(c component.InstanceID) string { +func (state *State) flowLabelForComponent(c component.InstanceID) string { const defaultLabel = "default" // We need to prove that it's possible to statelessly compute the label for a @@ -144,7 +144,7 @@ func (state *state) flowLabelForComponent(c component.InstanceID) string { // Next returns the set of Flow component IDs for a given data type that the // current component being converted should forward data to. -func (state *state) Next(c component.InstanceID, dataType component.DataType) []componentID { +func (state *State) Next(c component.InstanceID, dataType component.DataType) []componentID { instances := state.nextInstances(c, dataType) var ids []componentID @@ -177,7 +177,7 @@ func (state *state) Next(c component.InstanceID, dataType component.DataType) [] return ids } -func (state *state) nextInstances(c component.InstanceID, dataType component.DataType) []component.InstanceID { +func (state *State) nextInstances(c component.InstanceID, dataType component.DataType) []component.InstanceID { switch dataType { case component.DataTypeMetrics: return state.group.NextMetrics(c) @@ -191,7 +191,7 @@ func (state *state) nextInstances(c component.InstanceID, dataType component.Dat } } -func (state *state) LookupExtension(id component.ID) componentID { +func (state *State) LookupExtension(id component.ID) componentID { cid, ok := state.extensionLookup[id] if !ok { panic(fmt.Sprintf("no component name found for extension %q", id.Name())) diff --git a/internal/converter/internal/otelcolconvert/converter_attributesprocessor.go b/internal/converter/internal/otelcolconvert/converter_attributesprocessor.go index c9b9486b26ed..ac37c70e2458 100644 --- a/internal/converter/internal/otelcolconvert/converter_attributesprocessor.go +++ b/internal/converter/internal/otelcolconvert/converter_attributesprocessor.go @@ -25,7 +25,7 @@ func (attributesProcessorConverter) InputComponentName() string { return "otelcol.processor.attributes" } -func (attributesProcessorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (attributesProcessorConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -35,14 +35,14 @@ func (attributesProcessorConverter) ConvertAndAppend(state *state, id component. diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toAttributesProcessor(state *state, id component.InstanceID, cfg *attributesprocessor.Config) *attributes.Arguments { +func toAttributesProcessor(state *State, id component.InstanceID, cfg *attributesprocessor.Config) *attributes.Arguments { var ( nextMetrics = state.Next(id, component.DataTypeMetrics) nextTraces = state.Next(id, component.DataTypeTraces) @@ -53,9 +53,9 @@ func toAttributesProcessor(state *state, id component.InstanceID, cfg *attribute Match: toMatchConfig(cfg), Actions: toAttrActionKeyValue(encodeMapslice(cfg.Actions)), Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), - Logs: toTokenizedConsumers(nextLogs), - Traces: toTokenizedConsumers(nextTraces)}, + Metrics: ToTokenizedConsumers(nextMetrics), + Logs: ToTokenizedConsumers(nextLogs), + Traces: ToTokenizedConsumers(nextTraces)}, } } diff --git a/internal/converter/internal/otelcolconvert/converter_basicauthextension.go b/internal/converter/internal/otelcolconvert/converter_basicauthextension.go index ac07fc6566b6..8f741e84013a 100644 --- a/internal/converter/internal/otelcolconvert/converter_basicauthextension.go +++ b/internal/converter/internal/otelcolconvert/converter_basicauthextension.go @@ -23,7 +23,7 @@ func (basicAuthConverterConverter) Factory() component.Factory { func (basicAuthConverterConverter) InputComponentName() string { return "otelcol.auth.basic" } -func (basicAuthConverterConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (basicAuthConverterConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -33,7 +33,7 @@ func (basicAuthConverterConverter) ConvertAndAppend(state *state, id component.I diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) diff --git a/internal/converter/internal/otelcolconvert/converter_batchprocessor.go b/internal/converter/internal/otelcolconvert/converter_batchprocessor.go index df234aee2f7f..f6a6b2cabaf2 100644 --- a/internal/converter/internal/otelcolconvert/converter_batchprocessor.go +++ b/internal/converter/internal/otelcolconvert/converter_batchprocessor.go @@ -25,7 +25,7 @@ func (batchProcessorConverter) InputComponentName() string { return "otelcol.processor.batch" } -func (batchProcessorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (batchProcessorConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -35,14 +35,14 @@ func (batchProcessorConverter) ConvertAndAppend(state *state, id component.Insta diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toBatchProcessor(state *state, id component.InstanceID, cfg *batchprocessor.Config) *batch.Arguments { +func toBatchProcessor(state *State, id component.InstanceID, cfg *batchprocessor.Config) *batch.Arguments { var ( nextMetrics = state.Next(id, component.DataTypeMetrics) nextLogs = state.Next(id, component.DataTypeLogs) @@ -56,9 +56,9 @@ func toBatchProcessor(state *state, id component.InstanceID, cfg *batchprocessor MetadataKeys: cfg.MetadataKeys, MetadataCardinalityLimit: cfg.MetadataCardinalityLimit, Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), - Logs: toTokenizedConsumers(nextLogs), - Traces: toTokenizedConsumers(nextTraces), + Metrics: ToTokenizedConsumers(nextMetrics), + Logs: ToTokenizedConsumers(nextLogs), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_bearertokenauthextension.go b/internal/converter/internal/otelcolconvert/converter_bearertokenauthextension.go index 63f134ec8abd..8801a682d71b 100644 --- a/internal/converter/internal/otelcolconvert/converter_bearertokenauthextension.go +++ b/internal/converter/internal/otelcolconvert/converter_bearertokenauthextension.go @@ -26,7 +26,7 @@ func (bearerTokenAuthExtensionConverter) Factory() component.Factory { func (bearerTokenAuthExtensionConverter) InputComponentName() string { return "otelcol.auth.bearer" } -func (bearerTokenAuthExtensionConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (bearerTokenAuthExtensionConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -52,7 +52,7 @@ func (bearerTokenAuthExtensionConverter) ConvertAndAppend(state *state, id compo diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) @@ -65,7 +65,7 @@ func toBearerTokenAuthExtension(cfg *bearertokenauthextension.Config) *bearer.Ar Token: rivertypes.Secret(string(cfg.BearerToken)), } } -func toBearerTokenAuthExtensionWithFilename(state *state, cfg *bearertokenauthextension.Config) (*bearer.Arguments, string) { +func toBearerTokenAuthExtensionWithFilename(state *State, cfg *bearertokenauthextension.Config) (*bearer.Arguments, string) { label := state.FlowComponentLabel() args := &file.Arguments{ Filename: cfg.Filename, @@ -78,5 +78,5 @@ func toBearerTokenAuthExtensionWithFilename(state *state, cfg *bearertokenauthex return &bearer.Arguments{ Scheme: cfg.Scheme, - }, fmt.Sprintf("%s.content", stringifyBlock(block)) + }, fmt.Sprintf("%s.content", StringifyBlock(block)) } diff --git a/internal/converter/internal/otelcolconvert/converter_filterprocessor.go b/internal/converter/internal/otelcolconvert/converter_filterprocessor.go index 71cb6749d35e..406d39345020 100644 --- a/internal/converter/internal/otelcolconvert/converter_filterprocessor.go +++ b/internal/converter/internal/otelcolconvert/converter_filterprocessor.go @@ -25,7 +25,7 @@ func (filterProcessorConverter) InputComponentName() string { return "otelcol.processor.filter" } -func (filterProcessorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (filterProcessorConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -35,14 +35,14 @@ func (filterProcessorConverter) ConvertAndAppend(state *state, id component.Inst diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toFilterProcessor(state *state, id component.InstanceID, cfg *filterprocessor.Config) *filter.Arguments { +func toFilterProcessor(state *State, id component.InstanceID, cfg *filterprocessor.Config) *filter.Arguments { var ( nextMetrics = state.Next(id, component.DataTypeMetrics) nextLogs = state.Next(id, component.DataTypeLogs) @@ -63,9 +63,9 @@ func toFilterProcessor(state *state, id component.InstanceID, cfg *filterprocess LogRecord: cfg.Logs.LogConditions, }, Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), - Logs: toTokenizedConsumers(nextLogs), - Traces: toTokenizedConsumers(nextTraces), + Metrics: ToTokenizedConsumers(nextMetrics), + Logs: ToTokenizedConsumers(nextLogs), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_headerssetterextension.go b/internal/converter/internal/otelcolconvert/converter_headerssetterextension.go index 799bc96042a2..b66288fab6c8 100644 --- a/internal/converter/internal/otelcolconvert/converter_headerssetterextension.go +++ b/internal/converter/internal/otelcolconvert/converter_headerssetterextension.go @@ -23,7 +23,7 @@ func (headersSetterExtensionConverter) Factory() component.Factory { func (headersSetterExtensionConverter) InputComponentName() string { return "otelcol.auth.headers" } -func (headersSetterExtensionConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (headersSetterExtensionConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -33,7 +33,7 @@ func (headersSetterExtensionConverter) ConvertAndAppend(state *state, id compone diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) diff --git a/internal/converter/internal/otelcolconvert/converter_helpers.go b/internal/converter/internal/otelcolconvert/converter_helpers.go index dbef1c481af5..cb2343e650a8 100644 --- a/internal/converter/internal/otelcolconvert/converter_helpers.go +++ b/internal/converter/internal/otelcolconvert/converter_helpers.go @@ -30,7 +30,7 @@ func (tc tokenizedConsumer) RiverTokenize() []builder.Token { }} } -func toTokenizedConsumers(components []componentID) []otelcol.Consumer { +func ToTokenizedConsumers(components []componentID) []otelcol.Consumer { res := make([]otelcol.Consumer, 0, len(components)) for _, component := range components { diff --git a/internal/converter/internal/otelcolconvert/converter_jaegerreceiver.go b/internal/converter/internal/otelcolconvert/converter_jaegerreceiver.go index 360520b94847..75b3261170ce 100644 --- a/internal/converter/internal/otelcolconvert/converter_jaegerreceiver.go +++ b/internal/converter/internal/otelcolconvert/converter_jaegerreceiver.go @@ -24,7 +24,7 @@ func (jaegerReceiverConverter) Factory() component.Factory { return jaegerreceiv func (jaegerReceiverConverter) InputComponentName() string { return "" } -func (jaegerReceiverConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (jaegerReceiverConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -34,14 +34,14 @@ func (jaegerReceiverConverter) ConvertAndAppend(state *state, id component.Insta diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toJaegerReceiver(state *state, id component.InstanceID, cfg *jaegerreceiver.Config) *jaeger.Arguments { +func toJaegerReceiver(state *State, id component.InstanceID, cfg *jaegerreceiver.Config) *jaeger.Arguments { var ( nextTraces = state.Next(id, component.DataTypeTraces) ) @@ -57,7 +57,7 @@ func toJaegerReceiver(state *state, id component.InstanceID, cfg *jaegerreceiver DebugMetrics: common.DefaultValue[jaeger.Arguments]().DebugMetrics, Output: &otelcol.ConsumerArguments{ - Traces: toTokenizedConsumers(nextTraces), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_jaegerremotesamplingextension.go b/internal/converter/internal/otelcolconvert/converter_jaegerremotesamplingextension.go index df1cda709fca..dcf17bc2352d 100644 --- a/internal/converter/internal/otelcolconvert/converter_jaegerremotesamplingextension.go +++ b/internal/converter/internal/otelcolconvert/converter_jaegerremotesamplingextension.go @@ -24,7 +24,7 @@ func (jaegerRemoteSamplingExtensionConverter) InputComponentName() string { return "otelcol.extension.jaeger_remote_sampling" } -func (jaegerRemoteSamplingExtensionConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (jaegerRemoteSamplingExtensionConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -34,7 +34,7 @@ func (jaegerRemoteSamplingExtensionConverter) ConvertAndAppend(state *state, id diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) diff --git a/internal/converter/internal/otelcolconvert/converter_k8sattributesprocessor.go b/internal/converter/internal/otelcolconvert/converter_k8sattributesprocessor.go index abd109bbd954..045fbed5b80f 100644 --- a/internal/converter/internal/otelcolconvert/converter_k8sattributesprocessor.go +++ b/internal/converter/internal/otelcolconvert/converter_k8sattributesprocessor.go @@ -25,7 +25,7 @@ func (k8sAttributesProcessorConverter) InputComponentName() string { return "otelcol.processor.k8sattributes" } -func (k8sAttributesProcessorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (k8sAttributesProcessorConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -35,14 +35,14 @@ func (k8sAttributesProcessorConverter) ConvertAndAppend(state *state, id compone diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toK8SAttributesProcessor(state *state, id component.InstanceID, cfg *k8sattributesprocessor.Config) *k8sattributes.Arguments { +func toK8SAttributesProcessor(state *State, id component.InstanceID, cfg *k8sattributesprocessor.Config) *k8sattributes.Arguments { var ( nextMetrics = state.Next(id, component.DataTypeMetrics) nextLogs = state.Next(id, component.DataTypeLogs) @@ -67,9 +67,9 @@ func toK8SAttributesProcessor(state *state, id component.InstanceID, cfg *k8satt Exclude: toExclude(cfg.Exclude), Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), - Logs: toTokenizedConsumers(nextLogs), - Traces: toTokenizedConsumers(nextTraces), + Metrics: ToTokenizedConsumers(nextMetrics), + Logs: ToTokenizedConsumers(nextLogs), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_kafkareceiver.go b/internal/converter/internal/otelcolconvert/converter_kafkareceiver.go index 2dbc84db0c3e..7f46b5157b4b 100644 --- a/internal/converter/internal/otelcolconvert/converter_kafkareceiver.go +++ b/internal/converter/internal/otelcolconvert/converter_kafkareceiver.go @@ -26,7 +26,7 @@ func (kafkaReceiverConverter) Factory() component.Factory { return kafkareceiver func (kafkaReceiverConverter) InputComponentName() string { return "" } -func (kafkaReceiverConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (kafkaReceiverConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -36,14 +36,14 @@ func (kafkaReceiverConverter) ConvertAndAppend(state *state, id component.Instan diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toKafkaReceiver(state *state, id component.InstanceID, cfg *kafkareceiver.Config) *kafka.Arguments { +func toKafkaReceiver(state *State, id component.InstanceID, cfg *kafkareceiver.Config) *kafka.Arguments { var ( nextMetrics = state.Next(id, component.DataTypeMetrics) nextLogs = state.Next(id, component.DataTypeLogs) @@ -70,9 +70,9 @@ func toKafkaReceiver(state *state, id component.InstanceID, cfg *kafkareceiver.C DebugMetrics: common.DefaultValue[kafka.Arguments]().DebugMetrics, Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), - Logs: toTokenizedConsumers(nextLogs), - Traces: toTokenizedConsumers(nextTraces), + Metrics: ToTokenizedConsumers(nextMetrics), + Logs: ToTokenizedConsumers(nextLogs), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_loadbalancingexporter.go b/internal/converter/internal/otelcolconvert/converter_loadbalancingexporter.go index 9f73d5935940..4475badd27e3 100644 --- a/internal/converter/internal/otelcolconvert/converter_loadbalancingexporter.go +++ b/internal/converter/internal/otelcolconvert/converter_loadbalancingexporter.go @@ -28,7 +28,7 @@ func (loadbalancingExporterConverter) InputComponentName() string { return "otelcol.exporter.loadbalancing" } -func (loadbalancingExporterConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (loadbalancingExporterConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -46,7 +46,7 @@ func (loadbalancingExporterConverter) ConvertAndAppend(state *state, id componen diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) diff --git a/internal/converter/internal/otelcolconvert/converter_loggingexporter.go b/internal/converter/internal/otelcolconvert/converter_loggingexporter.go index 76d85cd2f06e..131ec2584715 100644 --- a/internal/converter/internal/otelcolconvert/converter_loggingexporter.go +++ b/internal/converter/internal/otelcolconvert/converter_loggingexporter.go @@ -25,7 +25,7 @@ func (loggingExporterConverter) InputComponentName() string { return "otelcol.exporter.logging" } -func (loggingExporterConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (loggingExporterConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -34,7 +34,7 @@ func (loggingExporterConverter) ConvertAndAppend(state *state, id component.Inst diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) diags.AddAll(common.ValidateSupported(common.NotEquals, diff --git a/internal/converter/internal/otelcolconvert/converter_memorylimiterprocessor.go b/internal/converter/internal/otelcolconvert/converter_memorylimiterprocessor.go index f870cf484855..c370fbd28293 100644 --- a/internal/converter/internal/otelcolconvert/converter_memorylimiterprocessor.go +++ b/internal/converter/internal/otelcolconvert/converter_memorylimiterprocessor.go @@ -25,7 +25,7 @@ func (memoryLimiterProcessorConverter) Factory() component.Factory { func (memoryLimiterProcessorConverter) InputComponentName() string { return "otelcol.processor.memory_limiter" } -func (memoryLimiterProcessorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (memoryLimiterProcessorConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -35,7 +35,7 @@ func (memoryLimiterProcessorConverter) ConvertAndAppend(state *state, id compone diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) @@ -43,7 +43,7 @@ func (memoryLimiterProcessorConverter) ConvertAndAppend(state *state, id compone return diags } -func toMemoryLimiterProcessor(state *state, id component.InstanceID, cfg *memorylimiterprocessor.Config) *memorylimiter.Arguments { +func toMemoryLimiterProcessor(state *State, id component.InstanceID, cfg *memorylimiterprocessor.Config) *memorylimiter.Arguments { var ( nextMetrics = state.Next(id, component.DataTypeMetrics) nextLogs = state.Next(id, component.DataTypeLogs) @@ -57,9 +57,9 @@ func toMemoryLimiterProcessor(state *state, id component.InstanceID, cfg *memory MemoryLimitPercentage: cfg.MemoryLimitPercentage, MemorySpikePercentage: cfg.MemorySpikePercentage, Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), - Logs: toTokenizedConsumers(nextLogs), - Traces: toTokenizedConsumers(nextTraces), + Metrics: ToTokenizedConsumers(nextMetrics), + Logs: ToTokenizedConsumers(nextLogs), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_oauth2clientauthextension.go b/internal/converter/internal/otelcolconvert/converter_oauth2clientauthextension.go index 14ba01ea91c9..f23d47b49ded 100644 --- a/internal/converter/internal/otelcolconvert/converter_oauth2clientauthextension.go +++ b/internal/converter/internal/otelcolconvert/converter_oauth2clientauthextension.go @@ -23,7 +23,7 @@ func (oauth2ClientAuthExtensionConverter) Factory() component.Factory { func (oauth2ClientAuthExtensionConverter) InputComponentName() string { return "otelcol.auth.oauth2" } -func (oauth2ClientAuthExtensionConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (oauth2ClientAuthExtensionConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -33,7 +33,7 @@ func (oauth2ClientAuthExtensionConverter) ConvertAndAppend(state *state, id comp diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) diff --git a/internal/converter/internal/otelcolconvert/converter_opencensusreceiver.go b/internal/converter/internal/otelcolconvert/converter_opencensusreceiver.go index cbc49366ad5a..4e88a0d273ae 100644 --- a/internal/converter/internal/otelcolconvert/converter_opencensusreceiver.go +++ b/internal/converter/internal/otelcolconvert/converter_opencensusreceiver.go @@ -23,7 +23,7 @@ func (opencensusReceiverConverter) Factory() component.Factory { func (opencensusReceiverConverter) InputComponentName() string { return "" } -func (opencensusReceiverConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (opencensusReceiverConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -33,14 +33,14 @@ func (opencensusReceiverConverter) ConvertAndAppend(state *state, id component.I diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toOpencensusReceiver(state *state, id component.InstanceID, cfg *opencensusreceiver.Config) *opencensus.Arguments { +func toOpencensusReceiver(state *State, id component.InstanceID, cfg *opencensusreceiver.Config) *opencensus.Arguments { var ( nextMetrics = state.Next(id, component.DataTypeMetrics) nextTraces = state.Next(id, component.DataTypeTraces) @@ -53,8 +53,8 @@ func toOpencensusReceiver(state *state, id component.InstanceID, cfg *opencensus DebugMetrics: common.DefaultValue[opencensus.Arguments]().DebugMetrics, Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), - Traces: toTokenizedConsumers(nextTraces), + Metrics: ToTokenizedConsumers(nextMetrics), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_otlpexporter.go b/internal/converter/internal/otelcolconvert/converter_otlpexporter.go index c13e550f6158..7f6881b489b6 100644 --- a/internal/converter/internal/otelcolconvert/converter_otlpexporter.go +++ b/internal/converter/internal/otelcolconvert/converter_otlpexporter.go @@ -31,7 +31,7 @@ func (otlpExporterConverter) Factory() component.Factory { func (otlpExporterConverter) InputComponentName() string { return "otelcol.exporter.otlp" } -func (otlpExporterConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (otlpExporterConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -49,7 +49,7 @@ func (otlpExporterConverter) ConvertAndAppend(state *state, id component.Instanc diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) diff --git a/internal/converter/internal/otelcolconvert/converter_otlphttpexporter.go b/internal/converter/internal/otelcolconvert/converter_otlphttpexporter.go index 64f1ff69e13d..b24813e351fa 100644 --- a/internal/converter/internal/otelcolconvert/converter_otlphttpexporter.go +++ b/internal/converter/internal/otelcolconvert/converter_otlphttpexporter.go @@ -30,7 +30,7 @@ func (otlpHTTPExporterConverter) InputComponentName() string { return "otelcol.exporter.otlphttp" } -func (otlpHTTPExporterConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (otlpHTTPExporterConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -48,7 +48,7 @@ func (otlpHTTPExporterConverter) ConvertAndAppend(state *state, id component.Ins diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) diff --git a/internal/converter/internal/otelcolconvert/converter_otlpreceiver.go b/internal/converter/internal/otelcolconvert/converter_otlpreceiver.go index d649210ec952..90384ba64d6e 100644 --- a/internal/converter/internal/otelcolconvert/converter_otlpreceiver.go +++ b/internal/converter/internal/otelcolconvert/converter_otlpreceiver.go @@ -26,7 +26,7 @@ func (otlpReceiverConverter) Factory() component.Factory { return otlpreceiver.N func (otlpReceiverConverter) InputComponentName() string { return "" } -func (otlpReceiverConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (otlpReceiverConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -36,14 +36,14 @@ func (otlpReceiverConverter) ConvertAndAppend(state *state, id component.Instanc diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toOtelcolReceiverOTLP(state *state, id component.InstanceID, cfg *otlpreceiver.Config) *otlp.Arguments { +func toOtelcolReceiverOTLP(state *State, id component.InstanceID, cfg *otlpreceiver.Config) *otlp.Arguments { var ( nextMetrics = state.Next(id, component.DataTypeMetrics) nextLogs = state.Next(id, component.DataTypeLogs) @@ -57,9 +57,9 @@ func toOtelcolReceiverOTLP(state *state, id component.InstanceID, cfg *otlprecei DebugMetrics: common.DefaultValue[otlp.Arguments]().DebugMetrics, Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), - Logs: toTokenizedConsumers(nextLogs), - Traces: toTokenizedConsumers(nextTraces), + Metrics: ToTokenizedConsumers(nextMetrics), + Logs: ToTokenizedConsumers(nextLogs), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_probabilisticsamplerprocessor.go b/internal/converter/internal/otelcolconvert/converter_probabilisticsamplerprocessor.go index de800410ae3e..ac4a0db4c895 100644 --- a/internal/converter/internal/otelcolconvert/converter_probabilisticsamplerprocessor.go +++ b/internal/converter/internal/otelcolconvert/converter_probabilisticsamplerprocessor.go @@ -25,7 +25,7 @@ func (probabilisticSamplerProcessorConverter) InputComponentName() string { return "otelcol.processor.probabilistic_sampler" } -func (probabilisticSamplerProcessorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (probabilisticSamplerProcessorConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -35,14 +35,14 @@ func (probabilisticSamplerProcessorConverter) ConvertAndAppend(state *state, id diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toProbabilisticSamplerProcessor(state *state, id component.InstanceID, cfg *probabilisticsamplerprocessor.Config) *probabilistic_sampler.Arguments { +func toProbabilisticSamplerProcessor(state *State, id component.InstanceID, cfg *probabilisticsamplerprocessor.Config) *probabilistic_sampler.Arguments { var ( nextTraces = state.Next(id, component.DataTypeTraces) nextLogs = state.Next(id, component.DataTypeLogs) @@ -55,8 +55,8 @@ func toProbabilisticSamplerProcessor(state *state, id component.InstanceID, cfg FromAttribute: cfg.FromAttribute, SamplingPriority: cfg.SamplingPriority, Output: &otelcol.ConsumerArguments{ - Logs: toTokenizedConsumers(nextLogs), - Traces: toTokenizedConsumers(nextTraces), + Logs: ToTokenizedConsumers(nextLogs), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_sigv4authextension.go b/internal/converter/internal/otelcolconvert/converter_sigv4authextension.go index de22285cdb9b..bd68d4ec202b 100644 --- a/internal/converter/internal/otelcolconvert/converter_sigv4authextension.go +++ b/internal/converter/internal/otelcolconvert/converter_sigv4authextension.go @@ -24,7 +24,7 @@ func (sigV4AuthExtensionConverter) InputComponentName() string { return "otelcol.auth.sigv4" } -func (sigV4AuthExtensionConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (sigV4AuthExtensionConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -34,7 +34,7 @@ func (sigV4AuthExtensionConverter) ConvertAndAppend(state *state, id component.I diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) diff --git a/internal/converter/internal/otelcolconvert/converter_spanmetricsconnector.go b/internal/converter/internal/otelcolconvert/converter_spanmetricsconnector.go index e38f016f9ac6..0b6a8f6528e2 100644 --- a/internal/converter/internal/otelcolconvert/converter_spanmetricsconnector.go +++ b/internal/converter/internal/otelcolconvert/converter_spanmetricsconnector.go @@ -26,7 +26,7 @@ func (spanmetricsConnectorConverter) InputComponentName() string { return "otelcol.connector.spanmetrics" } -func (spanmetricsConnectorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (spanmetricsConnectorConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -36,14 +36,14 @@ func (spanmetricsConnectorConverter) ConvertAndAppend(state *state, id component diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toSpanmetricsConnector(state *state, id component.InstanceID, cfg *spanmetricsconnector.Config) *spanmetrics.Arguments { +func toSpanmetricsConnector(state *State, id component.InstanceID, cfg *spanmetricsconnector.Config) *spanmetrics.Arguments { if cfg == nil { return nil } @@ -112,7 +112,7 @@ func toSpanmetricsConnector(state *state, id component.InstanceID, cfg *spanmetr }, Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), + Metrics: ToTokenizedConsumers(nextMetrics), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_spanprocessor.go b/internal/converter/internal/otelcolconvert/converter_spanprocessor.go index 6604fc960199..f46a24b266de 100644 --- a/internal/converter/internal/otelcolconvert/converter_spanprocessor.go +++ b/internal/converter/internal/otelcolconvert/converter_spanprocessor.go @@ -22,7 +22,7 @@ func (spanProcessorConverter) Factory() component.Factory { return spanprocessor func (spanProcessorConverter) InputComponentName() string { return "otelcol.processor.span" } -func (spanProcessorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (spanProcessorConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -32,14 +32,14 @@ func (spanProcessorConverter) ConvertAndAppend(state *state, id component.Instan diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toSpanProcessor(state *state, id component.InstanceID, cfg *spanprocessor.Config) *span.Arguments { +func toSpanProcessor(state *State, id component.InstanceID, cfg *spanprocessor.Config) *span.Arguments { var ( nextTraces = state.Next(id, component.DataTypeTraces) ) @@ -72,7 +72,7 @@ func toSpanProcessor(state *state, id component.InstanceID, cfg *spanprocessor.C }, SetStatus: setStatus, Output: &otelcol.ConsumerArguments{ - Traces: toTokenizedConsumers(nextTraces), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_tailsamplingprocessor.go b/internal/converter/internal/otelcolconvert/converter_tailsamplingprocessor.go index 18e7ab4a26f2..439a84f8572a 100644 --- a/internal/converter/internal/otelcolconvert/converter_tailsamplingprocessor.go +++ b/internal/converter/internal/otelcolconvert/converter_tailsamplingprocessor.go @@ -26,7 +26,7 @@ func (tailSamplingProcessorConverter) InputComponentName() string { return "otelcol.processor.tail_sampling" } -func (tailSamplingProcessorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (tailSamplingProcessorConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -36,14 +36,14 @@ func (tailSamplingProcessorConverter) ConvertAndAppend(state *state, id componen diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toTailSamplingProcessor(state *state, id component.InstanceID, cfg *tailsamplingprocessor.Config) *tail_sampling.Arguments { +func toTailSamplingProcessor(state *State, id component.InstanceID, cfg *tailsamplingprocessor.Config) *tail_sampling.Arguments { var ( nextTraces = state.Next(id, component.DataTypeTraces) ) @@ -57,7 +57,7 @@ func toTailSamplingProcessor(state *state, id component.InstanceID, cfg *tailsam NumTraces: cfg.NumTraces, ExpectedNewTracesPerSec: cfg.ExpectedNewTracesPerSec, Output: &otelcol.ConsumerArguments{ - Traces: toTokenizedConsumers(nextTraces), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_transformprocessor.go b/internal/converter/internal/otelcolconvert/converter_transformprocessor.go index 694046bb21e9..aa3160ca29c2 100644 --- a/internal/converter/internal/otelcolconvert/converter_transformprocessor.go +++ b/internal/converter/internal/otelcolconvert/converter_transformprocessor.go @@ -25,7 +25,7 @@ func (transformProcessorConverter) InputComponentName() string { return "otelcol.processor.transform" } -func (transformProcessorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (transformProcessorConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -35,14 +35,14 @@ func (transformProcessorConverter) ConvertAndAppend(state *state, id component.I diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toTransformProcessor(state *state, id component.InstanceID, cfg *transformprocessor.Config) *transform.Arguments { +func toTransformProcessor(state *State, id component.InstanceID, cfg *transformprocessor.Config) *transform.Arguments { var ( nextMetrics = state.Next(id, component.DataTypeMetrics) nextLogs = state.Next(id, component.DataTypeLogs) @@ -55,9 +55,9 @@ func toTransformProcessor(state *state, id component.InstanceID, cfg *transformp MetricStatements: toContextStatements(encodeMapslice(cfg.MetricStatements)), LogStatements: toContextStatements(encodeMapslice(cfg.LogStatements)), Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), - Logs: toTokenizedConsumers(nextLogs), - Traces: toTokenizedConsumers(nextTraces), + Metrics: ToTokenizedConsumers(nextMetrics), + Logs: ToTokenizedConsumers(nextLogs), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_vcenterreceiver.go b/internal/converter/internal/otelcolconvert/converter_vcenterreceiver.go index b4b791d8ffbb..76855e48bfc9 100644 --- a/internal/converter/internal/otelcolconvert/converter_vcenterreceiver.go +++ b/internal/converter/internal/otelcolconvert/converter_vcenterreceiver.go @@ -22,7 +22,7 @@ func (vcenterReceiverConverter) Factory() component.Factory { return vcenterrece func (vcenterReceiverConverter) InputComponentName() string { return "" } -func (vcenterReceiverConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (vcenterReceiverConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -32,14 +32,14 @@ func (vcenterReceiverConverter) ConvertAndAppend(state *state, id component.Inst diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toVcenterReceiver(state *state, id component.InstanceID, cfg *vcenterreceiver.Config) *vcenter.Arguments { +func toVcenterReceiver(state *State, id component.InstanceID, cfg *vcenterreceiver.Config) *vcenter.Arguments { var ( nextMetrics = state.Next(id, component.DataTypeMetrics) nextTraces = state.Next(id, component.DataTypeTraces) @@ -63,8 +63,8 @@ func toVcenterReceiver(state *state, id component.InstanceID, cfg *vcenterreceiv TLS: toTLSClientArguments(cfg.TLSClientSetting), Output: &otelcol.ConsumerArguments{ - Metrics: toTokenizedConsumers(nextMetrics), - Traces: toTokenizedConsumers(nextTraces), + Metrics: ToTokenizedConsumers(nextMetrics), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/converter_zipkinreceiver.go b/internal/converter/internal/otelcolconvert/converter_zipkinreceiver.go index f2c3cc82cf66..0096300de62a 100644 --- a/internal/converter/internal/otelcolconvert/converter_zipkinreceiver.go +++ b/internal/converter/internal/otelcolconvert/converter_zipkinreceiver.go @@ -21,7 +21,7 @@ func (zipkinReceiverConverter) Factory() component.Factory { return zipkinreceiv func (zipkinReceiverConverter) InputComponentName() string { return "" } -func (zipkinReceiverConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { +func (zipkinReceiverConverter) ConvertAndAppend(state *State, id component.InstanceID, cfg component.Config) diag.Diagnostics { var diags diag.Diagnostics label := state.FlowComponentLabel() @@ -31,14 +31,14 @@ func (zipkinReceiverConverter) ConvertAndAppend(state *state, id component.Insta diags.Add( diag.SeverityLevelInfo, - fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + fmt.Sprintf("Converted %s into %s", StringifyInstanceID(id), StringifyBlock(block)), ) state.Body().AppendBlock(block) return diags } -func toZipkinReceiver(state *state, id component.InstanceID, cfg *zipkinreceiver.Config) *zipkin.Arguments { +func toZipkinReceiver(state *State, id component.InstanceID, cfg *zipkinreceiver.Config) *zipkin.Arguments { var ( nextTraces = state.Next(id, component.DataTypeTraces) ) @@ -50,7 +50,7 @@ func toZipkinReceiver(state *state, id component.InstanceID, cfg *zipkinreceiver DebugMetrics: common.DefaultValue[zipkin.Arguments]().DebugMetrics, Output: &otelcol.ConsumerArguments{ - Traces: toTokenizedConsumers(nextTraces), + Traces: ToTokenizedConsumers(nextTraces), }, } } diff --git a/internal/converter/internal/otelcolconvert/otelcolconvert.go b/internal/converter/internal/otelcolconvert/otelcolconvert.go index 7c10b23acc2f..d24e072b94f1 100644 --- a/internal/converter/internal/otelcolconvert/otelcolconvert.go +++ b/internal/converter/internal/otelcolconvert/otelcolconvert.go @@ -65,7 +65,7 @@ func Convert(in []byte, extraArgs []string) ([]byte, diag.Diagnostics) { f := builder.NewFile() - diags.AddAll(AppendConfig(f, cfg, "")) + diags.AddAll(AppendConfig(f, cfg, "", nil)) diags.AddAll(common.ValidateNodes(f)) var buf bytes.Buffer @@ -143,7 +143,7 @@ func getFactories() otelcol.Factories { // AppendConfig converts the provided OpenTelemetry config into an equivalent // Flow config and appends the result to the provided file. -func AppendConfig(file *builder.File, cfg *otelcol.Config, labelPrefix string) diag.Diagnostics { +func AppendConfig(file *builder.File, cfg *otelcol.Config, labelPrefix string, extraConverters []ComponentConverter) diag.Diagnostics { var diags diag.Diagnostics groups, err := createPipelineGroups(cfg.Service.Pipelines) @@ -153,7 +153,7 @@ func AppendConfig(file *builder.File, cfg *otelcol.Config, labelPrefix string) d } // TODO(rfratto): should this be deduplicated to avoid creating factories // twice? - converterTable := buildConverterTable() + converterTable := buildConverterTable(extraConverters) // Connector components are defined on the top level of the OpenTelemetry // config, but inside of the pipeline definitions they act like regular @@ -188,7 +188,7 @@ func AppendConfig(file *builder.File, cfg *otelcol.Config, labelPrefix string) d for _, ext := range cfg.Service.Extensions { cid := component.InstanceID{Kind: component.KindExtension, ID: ext} - state := &state{ + state := &State{ cfg: cfg, file: file, // We pass an empty pipelineGroup to make calls to @@ -237,7 +237,7 @@ func AppendConfig(file *builder.File, cfg *otelcol.Config, labelPrefix string) d for _, id := range componentSet.ids { componentID := component.InstanceID{Kind: componentSet.kind, ID: id} - state := &state{ + state := &State{ cfg: cfg, file: file, group: &group, @@ -289,10 +289,11 @@ func validateNoDuplicateReceivers(groups []pipelineGroup, connectorIDs []compone return diags } -func buildConverterTable() map[converterKey]componentConverter { - table := make(map[converterKey]componentConverter) +func buildConverterTable(extraConverters []ComponentConverter) map[converterKey]ComponentConverter { + table := make(map[converterKey]ComponentConverter) + allConverters := append(converters, extraConverters...) - for _, conv := range converters { + for _, conv := range allConverters { fact := conv.Factory() switch fact.(type) { diff --git a/internal/converter/internal/otelcolconvert/utils.go b/internal/converter/internal/otelcolconvert/utils.go index 176a5a420aa6..59563f46778a 100644 --- a/internal/converter/internal/otelcolconvert/utils.go +++ b/internal/converter/internal/otelcolconvert/utils.go @@ -11,11 +11,11 @@ import ( "go.opentelemetry.io/collector/component" ) -func stringifyInstanceID(id component.InstanceID) string { - return fmt.Sprintf("%s/%s", stringifyKind(id.Kind), id.ID) +func StringifyInstanceID(id component.InstanceID) string { + return fmt.Sprintf("%s/%s", StringifyKind(id.Kind), id.ID) } -func stringifyKind(k component.Kind) string { +func StringifyKind(k component.Kind) string { switch k { case component.KindReceiver: return "receiver" @@ -32,7 +32,7 @@ func stringifyKind(k component.Kind) string { } } -func stringifyBlock(block *builder.Block) string { +func StringifyBlock(block *builder.Block) string { return fmt.Sprintf("%s.%s", strings.Join(block.Name, "."), block.Label) } @@ -57,7 +57,7 @@ func ConvertWithoutValidation(in []byte, extraArgs []string) ([]byte, diag.Diagn f := builder.NewFile() - diags.AddAll(AppendConfig(f, cfg, "")) + diags.AddAll(AppendConfig(f, cfg, "", nil)) diags.AddAll(common.ValidateNodes(f)) var buf bytes.Buffer diff --git a/internal/converter/internal/prometheusconvert/build/prometheus_blocks.go b/internal/converter/internal/prometheusconvert/build/prometheus_blocks.go index adbe26077f48..eafeecdeb94c 100644 --- a/internal/converter/internal/prometheusconvert/build/prometheus_blocks.go +++ b/internal/converter/internal/prometheusconvert/build/prometheus_blocks.go @@ -29,7 +29,7 @@ func NewPrometheusBlocks() *PrometheusBlocks { } } -// AppendToFile attaches prometheus blocks in a specific order. +// AppendToBody attaches prometheus blocks in a specific order. // // Order of blocks: // 1. Discovery component(s) @@ -37,25 +37,25 @@ func NewPrometheusBlocks() *PrometheusBlocks { // 3. Prometheus scrape component(s) // 4. Prometheus relabel component(s) (if any) // 5. Prometheus remote_write -func (pb *PrometheusBlocks) AppendToFile(f *builder.File) { +func (pb *PrometheusBlocks) AppendToBody(body *builder.Body) { for _, promBlock := range pb.DiscoveryBlocks { - f.Body().AppendBlock(promBlock.block) + body.AppendBlock(promBlock.block) } for _, promBlock := range pb.DiscoveryRelabelBlocks { - f.Body().AppendBlock(promBlock.block) + body.AppendBlock(promBlock.block) } for _, promBlock := range pb.PrometheusScrapeBlocks { - f.Body().AppendBlock(promBlock.block) + body.AppendBlock(promBlock.block) } for _, promBlock := range pb.PrometheusRelabelBlocks { - f.Body().AppendBlock(promBlock.block) + body.AppendBlock(promBlock.block) } for _, promBlock := range pb.PrometheusRemoteWriteBlocks { - f.Body().AppendBlock(promBlock.block) + body.AppendBlock(promBlock.block) } } diff --git a/internal/converter/internal/prometheusconvert/prometheusconvert.go b/internal/converter/internal/prometheusconvert/prometheusconvert.go index e5cdd84b4e0f..c38400b4c56a 100644 --- a/internal/converter/internal/prometheusconvert/prometheusconvert.go +++ b/internal/converter/internal/prometheusconvert/prometheusconvert.go @@ -111,7 +111,7 @@ func AppendAllNested(f *builder.File, promConfig *prom_config.Config, jobNameToC diags := validate(promConfig) diags.AddAll(pb.GetScrapeInfo()) - pb.AppendToFile(f) + pb.AppendToBody(f.Body()) return diags } diff --git a/internal/converter/internal/promtailconvert/internal/build/service_discovery.go b/internal/converter/internal/promtailconvert/internal/build/service_discovery.go index 533f5c8c2b69..dba4fff5ac61 100644 --- a/internal/converter/internal/promtailconvert/internal/build/service_discovery.go +++ b/internal/converter/internal/promtailconvert/internal/build/service_discovery.go @@ -22,7 +22,7 @@ func (s *ScrapeConfigBuilder) AppendSDs() { pb := build.NewPrometheusBlocks() targets := prometheusconvert.AppendServiceDiscoveryConfigs(pb, sdConfigs, common.LabelForParts(s.globalCtx.LabelPrefix, s.cfg.JobName)) - pb.AppendToFile(s.f) + pb.AppendToBody(s.f.Body()) targetLiterals := make([]discovery.Target, 0) for _, target := range targets { diff --git a/internal/converter/internal/staticconvert/internal/build/builder_traces.go b/internal/converter/internal/staticconvert/internal/build/builder_traces.go index b37b65892456..6762d8e580f2 100644 --- a/internal/converter/internal/staticconvert/internal/build/builder_traces.go +++ b/internal/converter/internal/staticconvert/internal/build/builder_traces.go @@ -12,6 +12,10 @@ import ( "go.opentelemetry.io/collector/otelcol" ) +// List of component converters. This slice is appended to by init functions in +// other files. +var converters []otelcolconvert.ComponentConverter + func (b *ConfigBuilder) appendTraces() { if reflect.DeepEqual(b.cfg.Traces, traces.Config{}) { return @@ -24,17 +28,18 @@ func (b *ConfigBuilder) appendTraces() { continue } - // Remove the push receiver which is an implementation detail for static mode and unnecessary for the otel config. - removeReceiver(otelCfg, "traces", "push_receiver") - - b.translateAutomaticLogging(otelCfg, cfg) - // Only prefix component labels if we are doing more than 1 trace config. labelPrefix := "" if len(b.cfg.Traces.Configs) > 1 { labelPrefix = cfg.Name } - b.diags.AddAll(otelcolconvert.AppendConfig(b.f, otelCfg, labelPrefix)) + + // Remove the push receiver which is an implementation detail for static mode and unnecessary for the otel config. + removeReceiver(otelCfg, "traces", "push_receiver") + + b.translateAutomaticLogging(otelCfg, cfg) + + b.diags.AddAll(otelcolconvert.AppendConfig(b.f, otelCfg, labelPrefix, converters)) } } diff --git a/internal/converter/internal/staticconvert/internal/build/converter_discoveryprocessor.go b/internal/converter/internal/staticconvert/internal/build/converter_discoveryprocessor.go new file mode 100644 index 000000000000..42142dc610e6 --- /dev/null +++ b/internal/converter/internal/staticconvert/internal/build/converter_discoveryprocessor.go @@ -0,0 +1,104 @@ +package build + +import ( + "fmt" + + "github.com/grafana/agent/internal/component/discovery" + "github.com/grafana/agent/internal/component/otelcol" + otelcol_discovery "github.com/grafana/agent/internal/component/otelcol/processor/discovery" + "github.com/grafana/agent/internal/converter/diag" + "github.com/grafana/agent/internal/converter/internal/common" + "github.com/grafana/agent/internal/converter/internal/otelcolconvert" + "github.com/grafana/agent/internal/converter/internal/prometheusconvert" + "github.com/grafana/agent/internal/converter/internal/prometheusconvert/build" + prometheus_component "github.com/grafana/agent/internal/converter/internal/prometheusconvert/component" + "github.com/grafana/agent/internal/static/traces/promsdprocessor" + "github.com/grafana/river/scanner" + prom_config "github.com/prometheus/prometheus/config" + "go.opentelemetry.io/collector/component" + "gopkg.in/yaml.v3" +) + +func init() { + converters = append(converters, discoveryProcessorConverter{}) +} + +type discoveryProcessorConverter struct{} + +func (discoveryProcessorConverter) Factory() component.Factory { + return promsdprocessor.NewFactory() +} + +func (discoveryProcessorConverter) InputComponentName() string { + return "otelcol.processor.discovery" +} + +func (discoveryProcessorConverter) ConvertAndAppend(state *otelcolconvert.State, id component.InstanceID, cfg component.Config) diag.Diagnostics { + label := state.FlowComponentLabel() + + args, diags := toDiscoveryProcessor(state, id, cfg.(*promsdprocessor.Config), label) + block := common.NewBlockWithOverride([]string{"otelcol", "processor", "discovery"}, label, args) + + diags.Add( + diag.SeverityLevelInfo, + fmt.Sprintf("Converted %s into %s", otelcolconvert.StringifyInstanceID(id), otelcolconvert.StringifyBlock(block)), + ) + + state.Body().AppendBlock(block) + return diags +} + +func toDiscoveryProcessor(state *otelcolconvert.State, id component.InstanceID, cfg *promsdprocessor.Config, label string) (*otelcol_discovery.Arguments, diag.Diagnostics) { + var ( + diags diag.Diagnostics + nextMetrics = state.Next(id, component.DataTypeMetrics) + nextLogs = state.Next(id, component.DataTypeLogs) + nextTraces = state.Next(id, component.DataTypeTraces) + ) + + // We need to Marshal/Unmarshal the scrape configs to translate them + // into their actual types for the conversion. + out, err := yaml.Marshal(cfg.ScrapeConfigs) + if err != nil { + diags.Add(diag.SeverityLevelCritical, fmt.Sprintf("unable to marshal scrapeConfigs interface{} to yaml: %s", err)) + return nil, diags + } + scrapeConfigs := make([]*prom_config.ScrapeConfig, 0) + err = yaml.Unmarshal(out, &scrapeConfigs) + if err != nil { + diags.Add(diag.SeverityLevelCritical, fmt.Sprintf("unable to unmarshal bytes to []*config.ScrapeConfig: %s", err)) + return nil, diags + } + + // Append the prometheus blocks to the file. prom_sd_processor makes use of + // only the ServiceDiscoveryConfigs and RelabelConfigs from its ScrapeConfigs. + // Other fields are ignored which is poorly designed Static mode config structure + // but correct for the conversion. + targets := []discovery.Target{} + pb := build.NewPrometheusBlocks() + for _, scrapeConfig := range scrapeConfigs { + labelConcat := scrapeConfig.JobName + if label != "" { + labelConcat = label + "_" + scrapeConfig.JobName + } + label, _ := scanner.SanitizeIdentifier(labelConcat) + scrapeTargets := prometheusconvert.AppendServiceDiscoveryConfigs(pb, scrapeConfig.ServiceDiscoveryConfigs, label) + promDiscoveryRelabelExports := prometheus_component.AppendDiscoveryRelabel(pb, scrapeConfig.RelabelConfigs, scrapeTargets, label) + if promDiscoveryRelabelExports != nil { + scrapeTargets = promDiscoveryRelabelExports.Output + } + targets = append(targets, scrapeTargets...) + } + pb.AppendToBody(state.Body()) + + return &otelcol_discovery.Arguments{ + Targets: targets, + OperationType: cfg.OperationType, + PodAssociations: cfg.PodAssociations, + Output: &otelcol.ConsumerArguments{ + Metrics: otelcolconvert.ToTokenizedConsumers(nextMetrics), + Logs: otelcolconvert.ToTokenizedConsumers(nextLogs), + Traces: otelcolconvert.ToTokenizedConsumers(nextTraces), + }, + }, diags +} diff --git a/internal/converter/internal/staticconvert/testdata/traces.river b/internal/converter/internal/staticconvert/testdata/traces.river index 750e89cd5540..716aefad0e3b 100644 --- a/internal/converter/internal/staticconvert/testdata/traces.river +++ b/internal/converter/internal/staticconvert/testdata/traces.river @@ -10,48 +10,63 @@ otelcol.receiver.otlp "default" { output { metrics = [] logs = [] - traces = [otelcol.processor.attributes.default.input] + traces = [otelcol.processor.discovery.default.input] } } -otelcol.processor.attributes "default" { - action { - key = "db.table" - action = "delete" - } +discovery.azure "default_prometheus1" { + subscription_id = "subscription1" - action { - key = "redacted_span" - value = true - action = "upsert" + oauth { + client_id = "client1" + tenant_id = "tenant1" + client_secret = "secret1" } - action { - key = "copy_key" - from_attribute = "key_original" - action = "update" + managed_identity { + client_id = "client1" } +} - action { - key = "account_id" - value = 2245 - action = "insert" +discovery.lightsail "default_prometheus1" { + region = "us-east-1" + access_key = "YOUR_ACCESS_KEY" + secret_key = "YOUR_SECRET_KEY" + port = 8080 +} + +discovery.relabel "default_prometheus1" { + targets = concat( + discovery.azure.default_prometheus1.targets, + discovery.lightsail.default_prometheus1.targets, + ) + + rule { + source_labels = ["__address1__"] + target_label = "__param_target1" } - action { - key = "account_password" - action = "delete" + rule { + source_labels = ["__address2__"] + target_label = "__param_target2" } +} - action { - key = "account_email" - action = "hash" +otelcol.processor.discovery "default" { + targets = discovery.relabel.default_prometheus1.output + pod_associations = [] + + output { + metrics = [] + logs = [] + traces = [otelcol.processor.attributes.default.input] } +} +otelcol.processor.attributes "default" { action { - key = "http.status_code" - converted_type = "int" - action = "convert" + key = "db.table" + action = "delete" } output { @@ -66,202 +81,6 @@ otelcol.processor.tail_sampling "default" { name = "test-policy-1" type = "always_sample" } - - policy { - name = "test-policy-2" - type = "latency" - - latency { - threshold_ms = 5000 - } - } - - policy { - name = "test-policy-3" - type = "numeric_attribute" - - numeric_attribute { - key = "key1" - min_value = 50 - max_value = 100 - } - } - - policy { - name = "test-policy-4" - type = "probabilistic" - - probabilistic { - sampling_percentage = 10 - } - } - - policy { - name = "test-policy-5" - type = "status_code" - - status_code { - status_codes = ["ERROR", "UNSET"] - } - } - - policy { - name = "test-policy-6" - type = "string_attribute" - - string_attribute { - key = "key2" - values = ["value1", "value2"] - } - } - - policy { - name = "test-policy-7" - type = "string_attribute" - - string_attribute { - key = "key2" - values = ["value1", "val*"] - enabled_regex_matching = true - cache_max_size = 10 - } - } - - policy { - name = "test-policy-8" - type = "rate_limiting" - - rate_limiting { - spans_per_second = 35 - } - } - - policy { - name = "test-policy-9" - type = "string_attribute" - - string_attribute { - key = "http.url" - values = ["\\/health", "\\/metrics"] - enabled_regex_matching = true - invert_match = true - } - } - - policy { - name = "test-policy-10" - type = "span_count" - - span_count { - min_spans = 2 - max_spans = 20 - } - } - - policy { - name = "test-policy-11" - type = "trace_state" - - trace_state { - key = "key3" - values = ["value1", "value2"] - } - } - - policy { - name = "test-policy-12" - type = "boolean_attribute" - - boolean_attribute { - key = "key4" - value = true - } - } - - policy { - name = "test-policy-11" - type = "ottl_condition" - - ottl_condition { - error_mode = "ignore" - span = ["attributes[\"test_attr_key_1\"] == \"test_attr_val_1\"", "attributes[\"test_attr_key_2\"] != \"test_attr_val_1\""] - spanevent = ["name != \"test_span_event_name\"", "attributes[\"test_event_attr_key_2\"] != \"test_event_attr_val_1\""] - } - } - - policy { - name = "and-policy-1" - type = "and" - - and { - and_sub_policy { - name = "test-and-policy-1" - type = "numeric_attribute" - - numeric_attribute { - key = "key1" - min_value = 50 - max_value = 100 - } - } - - and_sub_policy { - name = "test-and-policy-2" - type = "string_attribute" - - string_attribute { - key = "key2" - values = ["value1", "value2"] - } - } - } - } - - policy { - name = "composite-policy-1" - type = "composite" - - composite { - max_total_spans_per_second = 1000 - policy_order = ["test-composite-policy-1", "test-composite-policy-2", "test-composite-policy-3"] - - composite_sub_policy { - name = "test-composite-policy-1" - type = "numeric_attribute" - - numeric_attribute { - key = "key1" - min_value = 50 - max_value = 100 - } - } - - composite_sub_policy { - name = "test-composite-policy-2" - type = "string_attribute" - - string_attribute { - key = "key2" - values = ["value1", "value2"] - } - } - - composite_sub_policy { - name = "test-composite-policy-3" - type = "always_sample" - } - - rate_allocation { - policy = "test-composite-policy-1" - percent = 50 - } - - rate_allocation { - policy = "test-composite-policy-2" - percent = 25 - } - } - } decision_wait = "5s" output { diff --git a/internal/converter/internal/staticconvert/testdata/traces.yaml b/internal/converter/internal/staticconvert/testdata/traces.yaml index f5e2fffec4fe..2553da25200a 100644 --- a/internal/converter/internal/staticconvert/testdata/traces.yaml +++ b/internal/converter/internal/staticconvert/testdata/traces.yaml @@ -10,6 +10,23 @@ traces: - endpoint: http://localhost:1234/write automatic_logging: backend: "stdout" + scrape_configs: + - job_name: "prometheus1" + azure_sd_configs: + - subscription_id: "subscription1" + tenant_id: "tenant1" + client_id: "client1" + client_secret: "secret1" + lightsail_sd_configs: + - region: 'us-east-1' + access_key: 'YOUR_ACCESS_KEY' + secret_key: 'YOUR_SECRET_KEY' + port: 8080 + relabel_configs: + - source_labels: [__address1__] + target_label: __param_target1 + - source_labels: [__address2__] + target_label: __param_target2 tail_sampling: policies: [ @@ -17,150 +34,8 @@ traces: name: test-policy-1, type: always_sample }, - { - name: test-policy-2, - type: latency, - latency: {threshold_ms: 5000} - }, - { - name: test-policy-3, - type: numeric_attribute, - numeric_attribute: {key: key1, min_value: 50, max_value: 100} - }, - { - name: test-policy-4, - type: probabilistic, - probabilistic: {sampling_percentage: 10} - }, - { - name: test-policy-5, - type: status_code, - status_code: {status_codes: [ERROR, UNSET]} - }, - { - name: test-policy-6, - type: string_attribute, - string_attribute: {key: key2, values: [value1, value2]} - }, - { - name: test-policy-7, - type: string_attribute, - string_attribute: {key: key2, values: [value1, val*], enabled_regex_matching: true, cache_max_size: 10} - }, - { - name: test-policy-8, - type: rate_limiting, - rate_limiting: {spans_per_second: 35} - }, - { - name: test-policy-9, - type: string_attribute, - string_attribute: {key: http.url, values: [\/health, \/metrics], enabled_regex_matching: true, invert_match: true} - }, - { - name: test-policy-10, - type: span_count, - span_count: {min_spans: 2, max_spans: 20} - }, - { - name: test-policy-11, - type: trace_state, - trace_state: { key: key3, values: [value1, value2] } - }, - { - name: test-policy-12, - type: boolean_attribute, - boolean_attribute: {key: key4, value: true} - }, - { - name: test-policy-11, - type: ottl_condition, - ottl_condition: { - error_mode: ignore, - span: [ - "attributes[\"test_attr_key_1\"] == \"test_attr_val_1\"", - "attributes[\"test_attr_key_2\"] != \"test_attr_val_1\"", - ], - spanevent: [ - "name != \"test_span_event_name\"", - "attributes[\"test_event_attr_key_2\"] != \"test_event_attr_val_1\"", - ] - } - }, - { - name: and-policy-1, - type: and, - and: { - and_sub_policy: - [ - { - name: test-and-policy-1, - type: numeric_attribute, - numeric_attribute: { key: key1, min_value: 50, max_value: 100 } - }, - { - name: test-and-policy-2, - type: string_attribute, - string_attribute: { key: key2, values: [ value1, value2 ] } - }, - ] - } - }, - { - name: composite-policy-1, - type: composite, - composite: - { - max_total_spans_per_second: 1000, - policy_order: [test-composite-policy-1, test-composite-policy-2, test-composite-policy-3], - composite_sub_policy: - [ - { - name: test-composite-policy-1, - type: numeric_attribute, - numeric_attribute: {key: key1, min_value: 50, max_value: 100} - }, - { - name: test-composite-policy-2, - type: string_attribute, - string_attribute: {key: key2, values: [value1, value2]} - }, - { - name: test-composite-policy-3, - type: always_sample - } - ], - rate_allocation: - [ - { - policy: test-composite-policy-1, - percent: 50 - }, - { - policy: test-composite-policy-2, - percent: 25 - } - ] - } - }, - ] + ] attributes: actions: - key: db.table - action: delete - - key: redacted_span - value: true - action: upsert - - key: copy_key - from_attribute: key_original - action: update - - key: account_id - value: 2245 - action: insert - - key: account_password - action: delete - - key: account_email - action: hash - - key: http.status_code - action: convert - converted_type: int \ No newline at end of file + action: delete \ No newline at end of file