# Segments: include entities and related metrics/traces

**URL:** <https://community.dynatrace.com/t/segments-include-entities-and-related-metrics-traces/54993>\
**Category:** DQL\
**Tags:** dql, segments\
**Created:** [February 13, 2026, 8:01am UTC](https://community.dynatrace.com/t/segments-include-entities-and-related-metrics-traces/54993 "2026-02-13T08:01:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![janne-olkoniemi](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@janne-olkoniemi](https://community.dynatrace.com/u/janne-olkoniemi)\
**Post date:** [February 13, 2026, 8:01am UTC](https://community.dynatrace.com/t/segments-include-entities-and-related-metrics-traces/54993/1 "2026-02-13T08:01:09Z")

</div>

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.

 ![janneolkoniemi_1-1770969469694.png](https://global.discourse-cdn.com/dynatrace/original/3X/5/a/5ac2e2376b00e0e0252425d180d6a71d7462c756.png)

But I’m kind of lost that how I could include the metrics and traces from the entities which are having the tag&nbsp; **SAMPLE\_TAG**. Is there some way with segments to include metrics and traces from entities which are containing a certain tag?

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [February 13, 2026, 12:58pm UTC](https://community.dynatrace.com/t/segments-include-entities-and-related-metrics-traces/54993/2 "2026-02-13T12:58:58Z")

</div>

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

```markup
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
  ]

```

 ![t_pawlak_0-1770987448082.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/2/e2020edd063534910edf2bad2fa11e010437aee4.png)

Metrics for the same services:

```markup
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
  ]

```

 ![t_pawlak_1-1770987507567.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/8/d85fd2a190d8f7b4ab2aec196c0892ef9e512ba7.png)

You must explicitly include **metrics/spans** in the Segment; selecting entities alone won’t scope those signals automatically
