Skip to content

Commit 35ca6ff

Browse files
chore: refactor metric gateway (#2618)
Co-authored-by: Stanislav Khalash <[email protected]>
1 parent b651475 commit 35ca6ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+502
-3367
lines changed
-38.7 KB
Loading

internal/otelcollector/config/common/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const (
149149
// CONNECTORS
150150
// ================================================================================
151151

152-
ComponentIDForwardConnector = "forward/%s" // dynamically filled with pipeline name
152+
ComponentIDForwardConnector = "forward"
153153
ComponentIDRoutingConnector = "routing/%s" // dynamically filled with pipeline name
154154
ComponentIDEnrichmentRoutingConnector = "routing/enrichment"
155155
ComponentIDRuntimeInputRoutingConnector = "routing/runtime-input"

internal/otelcollector/config/common/processor_builders.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func FilterSpecsToTraceFilterProcessorConfig(specs []telemetryv1alpha1.FilterSpe
237237
return &FilterProcessor{
238238
ErrorMode: defaultFilterProcessorErrorMode,
239239
Traces: FilterProcessorTraces{
240-
// Use span context as it is it is always present even though spanevents is the lowest one
240+
// Use span as context instead of spanevents, because while more granular, spanevents aren't always present
241241
// span event filtering is not supported by user-defined filter until filter processor supports context inference
242242
Span: mergedConditions,
243243
},

internal/otelcollector/config/logagent/config_builder.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ func (b *Builder) Build(ctx context.Context, pipelines []telemetryv1alpha1.LogPi
5050
b.addK8sAttributesProcessor(opts),
5151
b.addInsertClusterAttributesProcessor(opts),
5252
b.addServiceEnrichmentProcessor(),
53+
// Kyma attributes are dropped before user-defined transform and filter processors
54+
// to prevent user access to internal attributes.
5355
b.addDropKymaAttributesProcessor(),
5456
b.addUserDefinedTransformProcessor(),
5557
b.addUserDefinedFilterProcessor(),

internal/otelcollector/config/logagent/config_builder_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func TestBuildConfig(t *testing.T) {
100100
}).
101101
Build(),
102102
},
103-
goldenFileName: "two-pipelines-with-transforms.yaml",
103+
goldenFileName: "user-defined-transforms.yaml",
104104
},
105105
{
106106
name: "two pipelines with user-defined filter",
@@ -122,7 +122,7 @@ func TestBuildConfig(t *testing.T) {
122122
}).
123123
Build(),
124124
},
125-
goldenFileName: "two-pipelines-with-filter.yaml",
125+
goldenFileName: "user-defined-filters.yaml",
126126
},
127127
{
128128
name: "pipeline with user-defined transform and filter",
@@ -140,7 +140,7 @@ func TestBuildConfig(t *testing.T) {
140140
}).
141141
Build(),
142142
},
143-
goldenFileName: "pipeline-with-transform-filter.yaml",
143+
goldenFileName: "user-defined-transform-filter.yaml",
144144
},
145145
}
146146

internal/otelcollector/config/loggateway/config_builder.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ func (b *Builder) Build(ctx context.Context, pipelines []telemetryv1alpha1.LogPi
4848
b.addNamespaceFilterProcessor(),
4949
b.addInsertClusterAttributesProcessor(opts),
5050
b.addServiceEnrichmentProcessor(),
51+
// Kyma attributes are dropped before user-defined transform and filter processors
52+
// to prevent user access to internal attributes.
5153
b.addDropKymaAttributesProcessor(),
5254
b.addIstioAccessLogsEnrichmentProcessor(opts),
5355
b.addUserDefinedTransformProcessor(),

internal/otelcollector/config/loggateway/config_builder_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func TestBuildConfig(t *testing.T) {
107107
}).
108108
Build(),
109109
},
110-
goldenFileName: "two-pipelines-with-transforms.yaml",
110+
goldenFileName: "user-defined-transforms.yaml",
111111
},
112112
{
113113
name: "two pipelines with user-defined filter",
@@ -127,7 +127,7 @@ func TestBuildConfig(t *testing.T) {
127127
}).
128128
Build(),
129129
},
130-
goldenFileName: "two-pipelines-with-filter.yaml",
130+
goldenFileName: "user-defined-filters.yaml",
131131
},
132132
{
133133
name: "pipeline with user-defined transform and filter",
@@ -143,7 +143,7 @@ func TestBuildConfig(t *testing.T) {
143143
Conditions: []string{"IsMatch(log.attributes[\"foo\"], \".*bar.*\")"},
144144
}).Build(),
145145
},
146-
goldenFileName: "pipeline-with-transform-filter.yaml",
146+
goldenFileName: "user-defined-transform-filter.yaml",
147147
},
148148
}
149149

0 commit comments

Comments
 (0)