From 3c618bf2d070dc34bcb5828db1153b5c7400012a Mon Sep 17 00:00:00 2001 From: Dan Jaglowski Date: Fri, 1 Nov 2024 19:00:18 -0400 Subject: [PATCH] [chore][connector/routing] Add ability to route metrics and traces by request context --- .chloggen/routing-connector-by-request.yaml | 2 +- connector/routingconnector/README.md | 1 - connector/routingconnector/metrics.go | 5 + connector/routingconnector/metrics_test.go | 18 +- .../config.yaml | 13 + .../request.yaml | 2 + .../sink_0.yaml | 195 +++++++++ .../sink_1.yaml | 195 +++++++++ .../config.yaml | 13 + .../request.yaml | 2 + .../sink_0.yaml | 195 +++++++++ .../sink_1.yaml | 195 +++++++++ .../match_any_value/config.yaml | 9 + .../match_any_value/request.yaml | 4 + .../match_any_value/sink_0.yaml | 389 ++++++++++++++++++ .../match_grpc_value/config.yaml | 9 + .../match_grpc_value/request.yaml | 2 + .../match_grpc_value/sink_0.yaml | 389 ++++++++++++++++++ .../match_http_value/config.yaml | 9 + .../match_http_value/request.yaml | 2 + .../match_http_value/sink_0.yaml | 389 ++++++++++++++++++ .../match_http_value2/config.yaml | 9 + .../match_http_value2/request.yaml | 2 + .../match_http_value2/sink_0.yaml | 389 ++++++++++++++++++ .../match_no_grpc_value/config.yaml | 9 + .../match_no_grpc_value/request.yaml | 2 + .../match_no_grpc_value/sink_default.yaml | 389 ++++++++++++++++++ .../match_no_http_value/config.yaml | 9 + .../match_no_http_value/request.yaml | 2 + .../match_no_http_value/sink_default.yaml | 389 ++++++++++++++++++ .../no_request_values/config.yaml | 9 + .../no_request_values/sink_default.yaml | 389 ++++++++++++++++++ .../config.yaml | 13 + .../input.yaml | 117 ++++++ .../request.yaml | 2 + .../sink_0.yaml | 59 +++ .../sink_1.yaml | 59 +++ .../config.yaml | 13 + .../input.yaml | 117 ++++++ .../request.yaml | 2 + .../sink_0.yaml | 59 +++ .../sink_1.yaml | 59 +++ .../match_any_value/config.yaml | 9 + .../match_any_value/input.yaml | 117 ++++++ .../match_any_value/request.yaml | 4 + .../match_any_value/sink_0.yaml | 117 ++++++ .../match_grpc_value/config.yaml | 9 + .../match_grpc_value/input.yaml | 117 ++++++ .../match_grpc_value/request.yaml | 2 + .../match_grpc_value/sink_0.yaml | 117 ++++++ .../match_http_value/config.yaml | 9 + .../match_http_value/input.yaml | 117 ++++++ .../match_http_value/request.yaml | 2 + .../match_http_value/sink_0.yaml | 117 ++++++ .../match_http_value2/config.yaml | 9 + .../match_http_value2/input.yaml | 117 ++++++ .../match_http_value2/request.yaml | 2 + .../match_http_value2/sink_0.yaml | 117 ++++++ .../match_no_grpc_value/config.yaml | 9 + .../match_no_grpc_value/input.yaml | 117 ++++++ .../match_no_grpc_value/request.yaml | 2 + .../match_no_grpc_value/sink_default.yaml | 117 ++++++ .../match_no_http_value/config.yaml | 9 + .../match_no_http_value/input.yaml | 117 ++++++ .../match_no_http_value/request.yaml | 2 + .../match_no_http_value/sink_default.yaml | 117 ++++++ .../no_request_values/config.yaml | 9 + .../no_request_values/input.yaml | 117 ++++++ .../no_request_values/sink_default.yaml | 117 ++++++ connector/routingconnector/traces.go | 5 + connector/routingconnector/traces_test.go | 9 + 71 files changed, 5862 insertions(+), 3 deletions(-) create mode 100644 connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/config.yaml create mode 100644 connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/request.yaml create mode 100644 connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/sink_0.yaml create mode 100644 connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/sink_1.yaml create mode 100644 connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/config.yaml create mode 100644 connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/request.yaml create mode 100644 connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/sink_0.yaml create mode 100644 connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/sink_1.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_any_value/config.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_any_value/request.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_any_value/sink_0.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_grpc_value/config.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_grpc_value/request.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_grpc_value/sink_0.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_http_value/config.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_http_value/request.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_http_value/sink_0.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_http_value2/config.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_http_value2/request.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_http_value2/sink_0.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/config.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/request.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/sink_default.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_no_http_value/config.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_no_http_value/request.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/match_no_http_value/sink_default.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/no_request_values/config.yaml create mode 100644 connector/routingconnector/testdata/metrics/request_context/no_request_values/sink_default.yaml create mode 100644 connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/config.yaml create mode 100644 connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/input.yaml create mode 100644 connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/request.yaml create mode 100644 connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/sink_0.yaml create mode 100644 connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/sink_1.yaml create mode 100644 connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/config.yaml create mode 100644 connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/input.yaml create mode 100644 connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/request.yaml create mode 100644 connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/sink_0.yaml create mode 100644 connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/sink_1.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_any_value/config.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_any_value/input.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_any_value/request.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_any_value/sink_0.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_grpc_value/config.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_grpc_value/input.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_grpc_value/request.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_grpc_value/sink_0.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_http_value/config.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_http_value/input.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_http_value/request.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_http_value/sink_0.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_http_value2/config.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_http_value2/input.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_http_value2/request.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_http_value2/sink_0.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/config.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/input.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/request.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/sink_default.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_no_http_value/config.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_no_http_value/input.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_no_http_value/request.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/match_no_http_value/sink_default.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/no_request_values/config.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/no_request_values/input.yaml create mode 100644 connector/routingconnector/testdata/traces/request_context/no_request_values/sink_default.yaml diff --git a/.chloggen/routing-connector-by-request.yaml b/.chloggen/routing-connector-by-request.yaml index 77cdfec98d48..0ef130b131ec 100644 --- a/.chloggen/routing-connector-by-request.yaml +++ b/.chloggen/routing-connector-by-request.yaml @@ -7,7 +7,7 @@ change_type: enhancement component: routingconnector # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add ability to route logs by request metadata. +note: Add ability to route by request metadata. # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. issues: [19738] diff --git a/connector/routingconnector/README.md b/connector/routingconnector/README.md index e22814c4c7dd..b4f06f607a6b 100644 --- a/connector/routingconnector/README.md +++ b/connector/routingconnector/README.md @@ -44,7 +44,6 @@ The following settings are available: ### Limitations - The `match_once` setting is only supported when using the `resource` context. If any routes use `log` or `request` context, `match_once` must be set to `true`. -- The `request` context is only supported for logs at this time. - The `request` context requires use of the `condition` setting, and relies on a very limited grammar. Conditions must be in the form of `request["key"] == "value"` or `request["key"] != "value"`. (In the future, this grammar may be expanded to support more complex conditions.) ### Supported [OTTL] functions diff --git a/connector/routingconnector/metrics.go b/connector/routingconnector/metrics.go index 025a5bc95bb5..8f25c586bf71 100644 --- a/connector/routingconnector/metrics.go +++ b/connector/routingconnector/metrics.go @@ -74,6 +74,11 @@ func (c *metricsConnector) switchMetrics(ctx context.Context, md pmetric.Metrics route := c.router.routeSlice[i] matchedMetrics := pmetric.NewMetrics() switch route.statementContext { + case "request": + if route.requestCondition.matchRequest(ctx) { + groupAllMetrics(groups, route.consumer, md) + md = pmetric.NewMetrics() // all metrics have been routed + } case "", "resource": pmetricutil.MoveResourcesIf(md, matchedMetrics, func(rs pmetric.ResourceMetrics) bool { diff --git a/connector/routingconnector/metrics_test.go b/connector/routingconnector/metrics_test.go index 47e7631f3337..2aab88d4bb01 100644 --- a/connector/routingconnector/metrics_test.go +++ b/connector/routingconnector/metrics_test.go @@ -504,12 +504,21 @@ func TestMetricsConnectorCapabilities(t *testing.T) { func TestMetricsConnectorDetailed(t *testing.T) { testCases := []string{ + filepath.Join("testdata", "metrics", "request_context", "match_any_value"), + filepath.Join("testdata", "metrics", "request_context", "match_grpc_value"), + filepath.Join("testdata", "metrics", "request_context", "match_http_value"), + filepath.Join("testdata", "metrics", "request_context", "match_http_value2"), + filepath.Join("testdata", "metrics", "request_context", "match_no_grpc_value"), + filepath.Join("testdata", "metrics", "request_context", "match_no_http_value"), + filepath.Join("testdata", "metrics", "request_context", "no_request_values"), filepath.Join("testdata", "metrics", "resource_context", "all_match_first_only"), filepath.Join("testdata", "metrics", "resource_context", "all_match_last_only"), filepath.Join("testdata", "metrics", "resource_context", "all_match_once"), filepath.Join("testdata", "metrics", "resource_context", "each_matches_one"), filepath.Join("testdata", "metrics", "resource_context", "match_none_with_default"), filepath.Join("testdata", "metrics", "resource_context", "match_none_without_default"), + filepath.Join("testdata", "metrics", "mixed_context", "match_resource_then_grpc_request"), + filepath.Join("testdata", "metrics", "mixed_context", "match_resource_then_http_request"), } for _, tt := range testCases { @@ -539,10 +548,17 @@ func TestMetricsConnectorDetailed(t *testing.T) { ) require.NoError(t, err) + ctx := context.Background() + if ctxFromFile, readErr := createContextFromFile(t, filepath.Join(tt, "request.yaml")); readErr == nil { + ctx = ctxFromFile + } else if !os.IsNotExist(readErr) { + t.Fatalf("Error reading request.yaml: %v", readErr) + } + input, readErr := golden.ReadMetrics(filepath.Join("testdata", "metrics", "input.yaml")) require.NoError(t, readErr) - require.NoError(t, conn.ConsumeMetrics(context.Background(), input)) + require.NoError(t, conn.ConsumeMetrics(ctx, input)) assertExpected := func(actual []pmetric.Metrics, filePath string) { expected, err := golden.ReadMetrics(filePath) diff --git a/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/config.yaml b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/config.yaml new file mode 100644 index 000000000000..671dcdd86292 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/config.yaml @@ -0,0 +1,13 @@ +routing: + match_once: true + default_pipelines: + - metrics/default + table: + - context: resource + condition: attributes["resourceName"] == "resourceA" + pipelines: + - metrics/0 + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - metrics/1 diff --git a/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/request.yaml b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/request.yaml new file mode 100644 index 000000000000..748e7f0766bb --- /dev/null +++ b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/request.yaml @@ -0,0 +1,2 @@ +grpc: + X-Tenant: acme \ No newline at end of file diff --git a/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/sink_0.yaml b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/sink_0.yaml new file mode 100644 index 000000000000..705311b4fd43 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/sink_0.yaml @@ -0,0 +1,195 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/sink_1.yaml b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/sink_1.yaml new file mode 100644 index 000000000000..b83427450811 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_grpc_request/sink_1.yaml @@ -0,0 +1,195 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/config.yaml b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/config.yaml new file mode 100644 index 000000000000..671dcdd86292 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/config.yaml @@ -0,0 +1,13 @@ +routing: + match_once: true + default_pipelines: + - metrics/default + table: + - context: resource + condition: attributes["resourceName"] == "resourceA" + pipelines: + - metrics/0 + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - metrics/1 diff --git a/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/request.yaml b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/request.yaml new file mode 100644 index 000000000000..a7f3371211d1 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/request.yaml @@ -0,0 +1,2 @@ +http: + X-Tenant: [ acme ] \ No newline at end of file diff --git a/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/sink_0.yaml b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/sink_0.yaml new file mode 100644 index 000000000000..705311b4fd43 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/sink_0.yaml @@ -0,0 +1,195 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/sink_1.yaml b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/sink_1.yaml new file mode 100644 index 000000000000..b83427450811 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/mixed_context/match_resource_then_http_request/sink_1.yaml @@ -0,0 +1,195 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/metrics/request_context/match_any_value/config.yaml b/connector/routingconnector/testdata/metrics/request_context/match_any_value/config.yaml new file mode 100644 index 000000000000..b0ce141852af --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_any_value/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - metrics/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - metrics/0 diff --git a/connector/routingconnector/testdata/metrics/request_context/match_any_value/request.yaml b/connector/routingconnector/testdata/metrics/request_context/match_any_value/request.yaml new file mode 100644 index 000000000000..72641a092459 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_any_value/request.yaml @@ -0,0 +1,4 @@ +grpc: + X-Tenant: notacme +http: + X-Tenant: [ notacme, acme ] \ No newline at end of file diff --git a/connector/routingconnector/testdata/metrics/request_context/match_any_value/sink_0.yaml b/connector/routingconnector/testdata/metrics/request_context/match_any_value/sink_0.yaml new file mode 100644 index 000000000000..68145249e0bd --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_any_value/sink_0.yaml @@ -0,0 +1,389 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/metrics/request_context/match_grpc_value/config.yaml b/connector/routingconnector/testdata/metrics/request_context/match_grpc_value/config.yaml new file mode 100644 index 000000000000..b0ce141852af --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_grpc_value/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - metrics/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - metrics/0 diff --git a/connector/routingconnector/testdata/metrics/request_context/match_grpc_value/request.yaml b/connector/routingconnector/testdata/metrics/request_context/match_grpc_value/request.yaml new file mode 100644 index 000000000000..748e7f0766bb --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_grpc_value/request.yaml @@ -0,0 +1,2 @@ +grpc: + X-Tenant: acme \ No newline at end of file diff --git a/connector/routingconnector/testdata/metrics/request_context/match_grpc_value/sink_0.yaml b/connector/routingconnector/testdata/metrics/request_context/match_grpc_value/sink_0.yaml new file mode 100644 index 000000000000..68145249e0bd --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_grpc_value/sink_0.yaml @@ -0,0 +1,389 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/metrics/request_context/match_http_value/config.yaml b/connector/routingconnector/testdata/metrics/request_context/match_http_value/config.yaml new file mode 100644 index 000000000000..b0ce141852af --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_http_value/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - metrics/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - metrics/0 diff --git a/connector/routingconnector/testdata/metrics/request_context/match_http_value/request.yaml b/connector/routingconnector/testdata/metrics/request_context/match_http_value/request.yaml new file mode 100644 index 000000000000..a7f3371211d1 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_http_value/request.yaml @@ -0,0 +1,2 @@ +http: + X-Tenant: [ acme ] \ No newline at end of file diff --git a/connector/routingconnector/testdata/metrics/request_context/match_http_value/sink_0.yaml b/connector/routingconnector/testdata/metrics/request_context/match_http_value/sink_0.yaml new file mode 100644 index 000000000000..68145249e0bd --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_http_value/sink_0.yaml @@ -0,0 +1,389 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/metrics/request_context/match_http_value2/config.yaml b/connector/routingconnector/testdata/metrics/request_context/match_http_value2/config.yaml new file mode 100644 index 000000000000..b0ce141852af --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_http_value2/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - metrics/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - metrics/0 diff --git a/connector/routingconnector/testdata/metrics/request_context/match_http_value2/request.yaml b/connector/routingconnector/testdata/metrics/request_context/match_http_value2/request.yaml new file mode 100644 index 000000000000..2ba6e4fe638a --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_http_value2/request.yaml @@ -0,0 +1,2 @@ +http: + X-Tenant: [ notacme, acme ] \ No newline at end of file diff --git a/connector/routingconnector/testdata/metrics/request_context/match_http_value2/sink_0.yaml b/connector/routingconnector/testdata/metrics/request_context/match_http_value2/sink_0.yaml new file mode 100644 index 000000000000..68145249e0bd --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_http_value2/sink_0.yaml @@ -0,0 +1,389 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/config.yaml b/connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/config.yaml new file mode 100644 index 000000000000..b0ce141852af --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - metrics/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - metrics/0 diff --git a/connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/request.yaml b/connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/request.yaml new file mode 100644 index 000000000000..a55ab1e40f90 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/request.yaml @@ -0,0 +1,2 @@ +grpc: + X-Tenant: notacme \ No newline at end of file diff --git a/connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/sink_default.yaml b/connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/sink_default.yaml new file mode 100644 index 000000000000..68145249e0bd --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_no_grpc_value/sink_default.yaml @@ -0,0 +1,389 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/metrics/request_context/match_no_http_value/config.yaml b/connector/routingconnector/testdata/metrics/request_context/match_no_http_value/config.yaml new file mode 100644 index 000000000000..b0ce141852af --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_no_http_value/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - metrics/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - metrics/0 diff --git a/connector/routingconnector/testdata/metrics/request_context/match_no_http_value/request.yaml b/connector/routingconnector/testdata/metrics/request_context/match_no_http_value/request.yaml new file mode 100644 index 000000000000..78ac5d79c4a3 --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_no_http_value/request.yaml @@ -0,0 +1,2 @@ +http: + X-Tenant: [ notacme ] \ No newline at end of file diff --git a/connector/routingconnector/testdata/metrics/request_context/match_no_http_value/sink_default.yaml b/connector/routingconnector/testdata/metrics/request_context/match_no_http_value/sink_default.yaml new file mode 100644 index 000000000000..68145249e0bd --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/match_no_http_value/sink_default.yaml @@ -0,0 +1,389 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/metrics/request_context/no_request_values/config.yaml b/connector/routingconnector/testdata/metrics/request_context/no_request_values/config.yaml new file mode 100644 index 000000000000..b0ce141852af --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/no_request_values/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - metrics/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - metrics/0 diff --git a/connector/routingconnector/testdata/metrics/request_context/no_request_values/sink_default.yaml b/connector/routingconnector/testdata/metrics/request_context/no_request_values/sink_default.yaml new file mode 100644 index 000000000000..68145249e0bd --- /dev/null +++ b/connector/routingconnector/testdata/metrics/request_context/no_request_values/sink_default.yaml @@ -0,0 +1,389 @@ +resourceMetrics: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeMetrics: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + metrics: + - name: sumMonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "101" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "102" + - name: sumNonmonotonicCumulative + sum: + aggregationTemporality: 2 # AGGREGATION_TEMPORALITY_CUMULATIVE + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "102" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "101" + - name: sumMonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: true + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "1" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "2" + - name: sumNonmonotonicDelta + sum: + aggregationTemporality: 1 # AGGREGATION_TEMPORALITY_DELTA + isMonotonic: false + dataPoints: + - attributes: + - key: dataPointName + value: + stringValue: dataPointA + - key: dataPointNameAgain + value: + stringValue: dataPointA + asInt: "2" + - attributes: + - key: dataPointName + value: + stringValue: dataPointB + - key: dataPointNameAgain + value: + stringValue: dataPointB + asInt: "1" diff --git a/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/config.yaml b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/config.yaml new file mode 100644 index 000000000000..8700bf70f218 --- /dev/null +++ b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/config.yaml @@ -0,0 +1,13 @@ +routing: + match_once: true + default_pipelines: + - traces/default + table: + - context: resource + condition: attributes["resourceName"] == "resourceA" + pipelines: + - traces/0 + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - traces/1 diff --git a/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/input.yaml b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/input.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/input.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/request.yaml b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/request.yaml new file mode 100644 index 000000000000..748e7f0766bb --- /dev/null +++ b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/request.yaml @@ -0,0 +1,2 @@ +grpc: + X-Tenant: acme \ No newline at end of file diff --git a/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/sink_0.yaml b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/sink_0.yaml new file mode 100644 index 000000000000..5c862eb1178f --- /dev/null +++ b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/sink_0.yaml @@ -0,0 +1,59 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/sink_1.yaml b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/sink_1.yaml new file mode 100644 index 000000000000..638861efcf92 --- /dev/null +++ b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_grpc_request/sink_1.yaml @@ -0,0 +1,59 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/config.yaml b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/config.yaml new file mode 100644 index 000000000000..8700bf70f218 --- /dev/null +++ b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/config.yaml @@ -0,0 +1,13 @@ +routing: + match_once: true + default_pipelines: + - traces/default + table: + - context: resource + condition: attributes["resourceName"] == "resourceA" + pipelines: + - traces/0 + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - traces/1 diff --git a/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/input.yaml b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/input.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/input.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/request.yaml b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/request.yaml new file mode 100644 index 000000000000..a7f3371211d1 --- /dev/null +++ b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/request.yaml @@ -0,0 +1,2 @@ +http: + X-Tenant: [ acme ] \ No newline at end of file diff --git a/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/sink_0.yaml b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/sink_0.yaml new file mode 100644 index 000000000000..5c862eb1178f --- /dev/null +++ b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/sink_0.yaml @@ -0,0 +1,59 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/sink_1.yaml b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/sink_1.yaml new file mode 100644 index 000000000000..638861efcf92 --- /dev/null +++ b/connector/routingconnector/testdata/traces/mixed_context/match_resource_then_http_request/sink_1.yaml @@ -0,0 +1,59 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_any_value/config.yaml b/connector/routingconnector/testdata/traces/request_context/match_any_value/config.yaml new file mode 100644 index 000000000000..e9604a0f6815 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_any_value/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - traces/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - traces/0 diff --git a/connector/routingconnector/testdata/traces/request_context/match_any_value/input.yaml b/connector/routingconnector/testdata/traces/request_context/match_any_value/input.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_any_value/input.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_any_value/request.yaml b/connector/routingconnector/testdata/traces/request_context/match_any_value/request.yaml new file mode 100644 index 000000000000..72641a092459 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_any_value/request.yaml @@ -0,0 +1,4 @@ +grpc: + X-Tenant: notacme +http: + X-Tenant: [ notacme, acme ] \ No newline at end of file diff --git a/connector/routingconnector/testdata/traces/request_context/match_any_value/sink_0.yaml b/connector/routingconnector/testdata/traces/request_context/match_any_value/sink_0.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_any_value/sink_0.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_grpc_value/config.yaml b/connector/routingconnector/testdata/traces/request_context/match_grpc_value/config.yaml new file mode 100644 index 000000000000..e9604a0f6815 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_grpc_value/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - traces/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - traces/0 diff --git a/connector/routingconnector/testdata/traces/request_context/match_grpc_value/input.yaml b/connector/routingconnector/testdata/traces/request_context/match_grpc_value/input.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_grpc_value/input.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_grpc_value/request.yaml b/connector/routingconnector/testdata/traces/request_context/match_grpc_value/request.yaml new file mode 100644 index 000000000000..748e7f0766bb --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_grpc_value/request.yaml @@ -0,0 +1,2 @@ +grpc: + X-Tenant: acme \ No newline at end of file diff --git a/connector/routingconnector/testdata/traces/request_context/match_grpc_value/sink_0.yaml b/connector/routingconnector/testdata/traces/request_context/match_grpc_value/sink_0.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_grpc_value/sink_0.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_http_value/config.yaml b/connector/routingconnector/testdata/traces/request_context/match_http_value/config.yaml new file mode 100644 index 000000000000..e9604a0f6815 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_http_value/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - traces/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - traces/0 diff --git a/connector/routingconnector/testdata/traces/request_context/match_http_value/input.yaml b/connector/routingconnector/testdata/traces/request_context/match_http_value/input.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_http_value/input.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_http_value/request.yaml b/connector/routingconnector/testdata/traces/request_context/match_http_value/request.yaml new file mode 100644 index 000000000000..a7f3371211d1 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_http_value/request.yaml @@ -0,0 +1,2 @@ +http: + X-Tenant: [ acme ] \ No newline at end of file diff --git a/connector/routingconnector/testdata/traces/request_context/match_http_value/sink_0.yaml b/connector/routingconnector/testdata/traces/request_context/match_http_value/sink_0.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_http_value/sink_0.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_http_value2/config.yaml b/connector/routingconnector/testdata/traces/request_context/match_http_value2/config.yaml new file mode 100644 index 000000000000..e9604a0f6815 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_http_value2/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - traces/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - traces/0 diff --git a/connector/routingconnector/testdata/traces/request_context/match_http_value2/input.yaml b/connector/routingconnector/testdata/traces/request_context/match_http_value2/input.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_http_value2/input.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_http_value2/request.yaml b/connector/routingconnector/testdata/traces/request_context/match_http_value2/request.yaml new file mode 100644 index 000000000000..2ba6e4fe638a --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_http_value2/request.yaml @@ -0,0 +1,2 @@ +http: + X-Tenant: [ notacme, acme ] \ No newline at end of file diff --git a/connector/routingconnector/testdata/traces/request_context/match_http_value2/sink_0.yaml b/connector/routingconnector/testdata/traces/request_context/match_http_value2/sink_0.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_http_value2/sink_0.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/config.yaml b/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/config.yaml new file mode 100644 index 000000000000..e9604a0f6815 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - traces/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - traces/0 diff --git a/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/input.yaml b/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/input.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/input.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/request.yaml b/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/request.yaml new file mode 100644 index 000000000000..a55ab1e40f90 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/request.yaml @@ -0,0 +1,2 @@ +grpc: + X-Tenant: notacme \ No newline at end of file diff --git a/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/sink_default.yaml b/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/sink_default.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_no_grpc_value/sink_default.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_no_http_value/config.yaml b/connector/routingconnector/testdata/traces/request_context/match_no_http_value/config.yaml new file mode 100644 index 000000000000..e9604a0f6815 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_no_http_value/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - traces/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - traces/0 diff --git a/connector/routingconnector/testdata/traces/request_context/match_no_http_value/input.yaml b/connector/routingconnector/testdata/traces/request_context/match_no_http_value/input.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_no_http_value/input.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/match_no_http_value/request.yaml b/connector/routingconnector/testdata/traces/request_context/match_no_http_value/request.yaml new file mode 100644 index 000000000000..78ac5d79c4a3 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_no_http_value/request.yaml @@ -0,0 +1,2 @@ +http: + X-Tenant: [ notacme ] \ No newline at end of file diff --git a/connector/routingconnector/testdata/traces/request_context/match_no_http_value/sink_default.yaml b/connector/routingconnector/testdata/traces/request_context/match_no_http_value/sink_default.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/match_no_http_value/sink_default.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/no_request_values/config.yaml b/connector/routingconnector/testdata/traces/request_context/no_request_values/config.yaml new file mode 100644 index 000000000000..e9604a0f6815 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/no_request_values/config.yaml @@ -0,0 +1,9 @@ +routing: + match_once: true + default_pipelines: + - traces/default + table: + - context: request + condition: request["X-Tenant"] == "acme" + pipelines: + - traces/0 diff --git a/connector/routingconnector/testdata/traces/request_context/no_request_values/input.yaml b/connector/routingconnector/testdata/traces/request_context/no_request_values/input.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/no_request_values/input.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/testdata/traces/request_context/no_request_values/sink_default.yaml b/connector/routingconnector/testdata/traces/request_context/no_request_values/sink_default.yaml new file mode 100644 index 000000000000..914758ed6510 --- /dev/null +++ b/connector/routingconnector/testdata/traces/request_context/no_request_values/sink_default.yaml @@ -0,0 +1,117 @@ +resourceSpans: + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceA + - key: resourceNameAgain + value: + stringValue: resourceA + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - resource: + attributes: + - key: resourceName + value: + stringValue: resourceB + - key: resourceNameAgain + value: + stringValue: resourceB + schemaUrl: https://opentelemetry.io/schemas/1.6.1 + scopeSpans: + - attributes: + - key: scopeName + value: + stringValue: scopeA + - key: scopeNameAgain + value: + stringValue: scopeA + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB + - attributes: + - key: scopeName + value: + stringValue: scopeB + - key: scopeNameAgain + value: + stringValue: scopeB + spans: + - attributes: + - key: spanName + value: + stringValue: spanA + - key: spanNameAgain + value: + stringValue: spanA + name: spanA + - attributes: + - key: spanName + value: + stringValue: spanB + - key: spanNameAgain + value: + stringValue: spanB + name: spanB diff --git a/connector/routingconnector/traces.go b/connector/routingconnector/traces.go index dd5966e6a66d..a82ee85a9973 100644 --- a/connector/routingconnector/traces.go +++ b/connector/routingconnector/traces.go @@ -74,6 +74,11 @@ func (c *tracesConnector) switchTraces(ctx context.Context, td ptrace.Traces) er route := c.router.routeSlice[i] matchedSpans := ptrace.NewTraces() switch route.statementContext { + case "request": + if route.requestCondition.matchRequest(ctx) { + groupAllTraces(groups, route.consumer, td) + td = ptrace.NewTraces() // all traces have been routed + } case "", "resource": ptraceutil.MoveResourcesIf(td, matchedSpans, func(rs ptrace.ResourceSpans) bool { diff --git a/connector/routingconnector/traces_test.go b/connector/routingconnector/traces_test.go index d479334e70a8..88379475b237 100644 --- a/connector/routingconnector/traces_test.go +++ b/connector/routingconnector/traces_test.go @@ -429,12 +429,21 @@ func TestTraceConnectorCapabilities(t *testing.T) { func TestTracesConnectorDetailed(t *testing.T) { testCases := []string{ + filepath.Join("testdata", "traces", "request_context", "match_any_value"), + filepath.Join("testdata", "traces", "request_context", "match_grpc_value"), + filepath.Join("testdata", "traces", "request_context", "match_http_value"), + filepath.Join("testdata", "traces", "request_context", "match_http_value2"), + filepath.Join("testdata", "traces", "request_context", "match_no_grpc_value"), + filepath.Join("testdata", "traces", "request_context", "match_no_http_value"), + filepath.Join("testdata", "traces", "request_context", "no_request_values"), filepath.Join("testdata", "traces", "resource_context", "all_match_first_only"), filepath.Join("testdata", "traces", "resource_context", "all_match_last_only"), filepath.Join("testdata", "traces", "resource_context", "all_match_once"), filepath.Join("testdata", "traces", "resource_context", "each_matches_one"), filepath.Join("testdata", "traces", "resource_context", "match_none_with_default"), filepath.Join("testdata", "traces", "resource_context", "match_none_without_default"), + filepath.Join("testdata", "traces", "mixed_context", "match_resource_then_grpc_request"), + filepath.Join("testdata", "traces", "mixed_context", "match_resource_then_http_request"), } for _, tt := range testCases {