You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docker-compose/monitor/TAG_FILTERING.md
+10-74Lines changed: 10 additions & 74 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,49 +32,22 @@ and API, just like they can filter traces.
32
32
connectors:
33
33
spanmetrics:
34
34
dimensions:
35
-
# Regular dimensions
36
35
- name: operation
37
36
default: unknown-operation
38
-
# Tag dimensions
39
-
- name: tag1
40
-
default: ""
41
-
- name: tag2
37
+
# Add tag dimensions for filtering
38
+
- name: env
42
39
default: ""
43
40
44
41
# Use the attributes processor to propagate tags
45
42
processors:
46
43
attributes:
47
44
actions:
48
-
- key: tag1
45
+
# Copy resource attributes to span attributes for metrics filtering
46
+
- key: env
49
47
action: insert
50
-
value: "value1"# In production, use dynamic values if supported
48
+
from_attribute: env
51
49
```
52
50
53
-
### Version Compatibility
54
-
55
-
The configuration may need adjustments based on your OpenTelemetry Collector version:
56
-
57
-
- **Older versions**: Use the approach shown here with the attributes processor
58
-
- **Newer versions (0.83.0+)**: May support direct resource attribute propagation with options like
59
-
`resource_metrics_strategy` and `resource_attributes`
60
-
61
-
Note: Even though your go.mod file may show a newer version of the collector, the Docker image used might
62
-
have an older version of the spanmetrics connector that doesn't support these newer features.
63
-
64
-
## Implementation Hack
65
-
66
-
The current implementation uses a workaround to enable tag filtering in metrics:
67
-
68
-
1. **Fixed Tag Values**: Since older collector versions can't dynamically propagate resource attributes to span metrics dimensions, we use the attributes processor to insert fixed tag values (e.g., "value1", "value2").
69
-
70
-
2. **Manual Configuration**: For each tag you want to filter by, you need to:
71
-
- Add it as a dimension in the spanmetrics connector
72
-
- Create an attributes processor action to insert it as a span attribute
73
-
74
-
3. **Limited Tag Values**: This approach only works with known, pre-configured tag values. If you need to support arbitrary tag values, you'll need to upgrade to a newer collector version that supports resource attribute propagation.
75
-
76
-
4. **Testing Workflow**: When testing, send traces with the exact tag values configured in the attributes processor, as these are the only values that will work with the filtering.
The key to this hack is ensuring that the fixed values in your configuration (`value1`, `value2`) match the values in your resource attributes when generating traces.
120
-
121
74
## Debugging Tips
122
75
123
76
If tag filtering isn't working as expected:
124
77
125
-
1. **Check Prometheus metrics**: Verify that metrics include the tag labels
78
+
1. Metrics might take some time to appear, ~1min
79
+
2.**Check Prometheus metrics**: Verify that metrics include the tag labels
2. **Verify collector configuration**: Ensure the spanmetrics connector is correctly configured with `resource_metrics_strategy` and the appropriate `resource_attributes`
131
-
132
-
3. **Inspect resource attributes**: Use the Jaeger UI to check if spans have the expected resource attributes
133
-
134
-
4. **Common issues**:
135
-
- Missing resource attributes in the `resource_attributes` list
136
-
- Incorrect pipeline configuration
137
-
- Resource attributes not properly set when generating traces
138
-
139
-
## Limitations
140
-
141
-
This approach has several limitations:
142
-
143
-
1. **Fixed values only**: Only works with predefined tag values; can't handle arbitrary user-defined tag values
144
-
2. **Manual configuration**: Requires manual updates to add new tags or tag values
145
-
3. **Resource overhead**: Less efficient than native resource attribute propagation
146
-
4. **Maintenance complexity**: Configuration becomes more complex as you add more tags
0 commit comments