13 Feb 2026 08:01 AM
I have just started to play around with segments and I hope that someone could help me how to include metrics and traces from entities to be part of segment definition.
I have currently the following variable in place on my segment definition and it picks the SAMPLE_TAG values correctly.
fetch dt.entity.service, from: -10d
| expand tag = tags
| fields tag
| filter startsWith(tag, "SAMPLE_TAG")
| dedup tag
| parse tag, "LD ':' LD:Service"
| fields Service,tag
And I have the following filter definition in place to pick the entities which are containing the SAMPLE_TAG.
But I'm kind of lost that how I could include the metrics and traces from the entities which are having the tag SAMPLE_TAG. Is there some way with segments to include metrics and traces from entities which are containing a certain tag?
Solved! Go to Solution.
13 Feb 2026 12:58 PM
Hi,
Segments don’t automatically “bring metrics and traces along” when you include only entities. You need separate Include blocks for the signals you want (e.g., Spans and Metrics) and scope them to the same entity set.
try subqueries filters:
Spans (traces) for services tagged some_tag
fetch spans, from: -10d
| filter dt.entity.service in [
fetch dt.entity.service, from: -10d
| expand tags
| filter startsWith(tags, "OpenTelemetry")
| fields id
| dedup id
]Metrics for the same services:
timeseries req = sum(dt.service.request.count), by: {dt.entity.service}, from: -10d
| filter dt.entity.service in [
fetch dt.entity.service, from: -10d
| expand tags
| filter startsWith(tags, "OpenTelemetry")
| fields id
| dedup id
]
You must explicitly include metrics/spans in the Segment; selecting entities alone won’t scope those signals automatically
Featured Posts