Skip to content

Commit 8566086

Browse files
committed
Add jq query for security trace #357
1 parent 24052c3 commit 8566086

File tree

1 file changed

+16
-3
lines changed
  • content/en/ninja-workshops/3-opentelemetry-collector-workshops/2-advanced-collector/8-routing-data

1 file changed

+16
-3
lines changed

content/en/ninja-workshops/3-opentelemetry-collector-workshops/2-advanced-collector/8-routing-data/8-3-test-routing.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,22 @@ If you check `gateway-traces-standard.out`, it will contain the `span` sent by `
4141
Again, both the `agent` and `gateway` should display debug information, including the span you just sent. This time, the `gateway` will write a line to the `gateway-traces-security.out` file, which is designated for spans where the `deployment.environment` resource attribute matches `"security-applications"`.
4242
The `gateway-traces-standard.out` should be unchanged.
4343

44-
{{% notice title="Tip" style="primary" icon="lightbulb" %}}
45-
If you verify the `./gateway-traces-security.out` it should only contain the spans from the `"security-applications"` deployment.environment.
46-
{{% /notice %}}
44+
{{% tabs %}}
45+
{{% tab title="Validate resource attribute matches" %}}
46+
47+
```bash
48+
jq -c '.resourceSpans[] as $resource | $resource.scopeSpans[].spans[] | {spanId: .spanId, deploymentEnvironment: ($resource.resource.attributes[] | select(.key == "deployment.environment") | .value.stringValue)}' gateway-traces-security.out
49+
```
50+
51+
{{% /tabs %}}
52+
{{% tab title="Output" %}}
53+
54+
```json
55+
{"spanId":"cb799e92e26d5782","deploymentEnvironment":"security-applications"}
56+
```
57+
58+
{{% /tab %}}
59+
{{% /tabs %}}
4760

4861
You can repeat this scenario multiple times, and each trace will be written to its corresponding output file.
4962

0 commit comments

Comments
 (0)