# Understand Dynatrace Segments vs Management Zones

**URL:** <https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818>\
**Category:** Open Q&A\
**Tags:** management-zones, alerting-profile, segments\
**Created:** [March 20, 2025, 6:20pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818 "2025-03-20T18:20:59Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [June 22, 2025, 11:33am UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/21 "2025-06-22T11:33:56Z")

</div>

Nicolas, please also vote for this:

[https://community.dynatrace.com/t5/Product-ideas/Management-Zone-filter-for-New-style-Dashboard/idi-p/279254](https://community.dynatrace.com/post/279254)

---

<div class="post-metadata">

**Author:** ![jeffrey\_valerio](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@jeffrey\_valerio](https://community.dynatrace.com/u/jeffrey_valerio)\
**Post date:** [July 1, 2025, 5:34pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/22 "2025-07-01T17:34:26Z")

</div>

Hello everyone, this is my solution to display problems based on the management zone.

```markup
export default async function () {
  const baseUrl = "https://{environmentid}.live.dynatrace.com/api/v2/problems";
  const headers = {
    "Authorization": "Api-Token YOUR_API_TOKEN",
    "Content-Type": "application/json"
  };

  async function fetchProblems() {
    const queryParams = new URLSearchParams({
      pageSize: "50",
      from: "now-30d",
      to: "now",
      problemSelector: 'status("OPEN")'
    });

    const response = await fetch(`${baseUrl}?${queryParams.toString()}`, {
      method: "GET",
      headers
    });

    const result = await response.json();
    return result.problems || [];
  }

  try {
    const problems = await fetchProblems();

    const filtered = problems
      .filter(p =>
        (p.managementZones || []).some(zone => zone.name === "YOUR_MANAGEMENT_ZONE")
      )
      .map(p => ({
        Problem: p.displayId,
        Title: p.title,
        ManagementZones: p.managementZones.map(mz => mz.name)
      }));

    return filtered;
  } catch (error) {
    console.error("❌ Error fetching problems:", error);
    return `Error: ${error.message}`;
  }
}

```

---

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [July 2, 2025, 8:25am UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/23 "2025-07-02T08:25:07Z")

</div>

This a useful function. You may consider protecting your token as you do not want to expose it when you save your code somewhere. It may be safer to extract the token from the header after the call or you do encrypt it using a fixed secret which you can extract from a meta fixed environment, use a local simple encrypt function. Let me know if you have a solution other wise I will provide my simple encrypt solution. The best is to extract the token from the header of the AppFunction call but I do not know how to do that at the moment, I can only extract the PayLoad, and I have no way to extract the header i-on its own. Hope this is helpful.

---

<div class="post-metadata">

**Author:** ![jeffrey\_valerio](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@jeffrey\_valerio](https://community.dynatrace.com/u/jeffrey_valerio)\
**Post date:** [July 2, 2025, 1:11pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/24 "2025-07-02T13:11:32Z")

</div>

Yes, first you need to store the token in the&nbsp; **Credential Vault** , and then use it like this in your workflow code:

```markup
import { credentialVaultClient } from "@dynatrace-sdk/client-classic-environment-v2";

export default async function () {
  const credentialId = "ID_CREDENTIALS_VAULT"; 

  const credential = await credentialVaultClient.getCredentialsDetails({
    id: credentialId
  });

  const baseUrl = "https://{environmentid}.live.dynatrace.com/api/v2/problems";
  const headers = {
    "Authorization": credential.token,
    "Content-Type": "application/json"
  };

... rest of code
};

```

---

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [July 2, 2025, 4:36pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/25 "2025-07-02T16:36:52Z")

</div>

![token_code.png](https://global.discourse-cdn.com/dynatrace/original/2X/a/a99382006ba5c7120d1295406c54213d523eba3a.png)  
Thanks for the above. I am not sure how the above is compiling for you? there is no .token you can extract, see above.

---

<div class="post-metadata">

**Author:** ![jeffrey\_valerio](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@jeffrey\_valerio](https://community.dynatrace.com/u/jeffrey_valerio)\
**Post date:** [July 2, 2025, 6:23pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/26 "2025-07-02T18:23:25Z")

</div>

I’m using Workflows and that way it works, however, you could try a&nbsp;.type?.token&nbsp;according to what the documentation says."

> **[Credential vault API - PUT a set of credentials](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/credential-vault/put-credentials)**
>
> Update a stored credentials configuration via the Dynatrace API.

---

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [July 2, 2025, 7:59pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/27 "2025-07-02T19:59:38Z")

</div>

Thanks Jeffrey for sharing that you are workflow, mine is needed as system to system and I need to use platform api call. anyway, here is what I get, maybe someone can resolve this, I see the type but unfortunately nothing after for a token 🙂

 ![last_code.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/6/d6c9a9cd0bd9c4569aebfa7ee7051b497ec44242.png)

---

<div class="post-metadata">

**Author:** ![JMBMinint](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@JMBMinint](https://community.dynatrace.com/u/JMBMinint)\
**Post date:** [July 10, 2025, 9:16am UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/28 "2025-07-10T09:16:43Z")

</div>

Hello,

We are trying to apply segments to a basic dashboard (response time split by service). The segments are configured to split the data by environnement (prod, qual, preprod…). We are using tags on host, process and services.

 ![JMBMinint_0-1752138664694.png](https://global.discourse-cdn.com/dynatrace/original/2X/f/ff97881c18c29a8ce68edea4e6e856f05f332e48.png)

Unfortunately, this configuration doesn’t display anything on the dashboard when it is applied. Do you know what could be missing ?

 ![JMBMinint_1-1752138980443.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/3/13782c05b2e098134019985a2cdd96278b1555d0.png)

---

<div class="post-metadata">

**Author:** ![sinisa\_zubic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sinisa_zubic/32/32498_2.png) [@sinisa\_zubic](https://community.dynatrace.com/u/sinisa_zubic)\
**Post date:** [July 14, 2025, 12:51pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/29 "2025-07-14T12:51:52Z")

</div>

hi&nbsp;[@JMBMinint](https://community.dynatrace.com/user/91590)

You’re assuming that filtering on entities would imply that the filter is also applied to the data that is linked to entities, as it is the case with management zones. With data stored in Grail, this is not the case. You have to include in the segment definition also the “data”.

We just released a set of best practices on how to transition from management zones to segments. Please have a look at it to get some inspiration on what this can look like for you:&nbsp;[https://docs.dynatrace.com/docs/shortlink/transition-guide-segments](https://docs.dynatrace.com/docs/shortlink/transition-guide-segments)

Best,  
Sini

---

<div class="post-metadata">

**Author:** ![JMBMinint](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@JMBMinint](https://community.dynatrace.com/u/JMBMinint)\
**Post date:** [July 15, 2025, 2:23pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/30 "2025-07-15T14:23:42Z")

</div>

Hi Sini,

Thanks for your reply, the application we are monitoring is in app only mode and run in a Heroku base environment. Is it a cloud-native scenario? If yes, which environment variables I have to set? Here is the one already setted =\> DT\_CUSTOM\_PROP\_HEROKU\_APP=“app=CPERFRONT env=PROD”

Best regards,

JM

---

<div class="post-metadata">

**Author:** ![sinisa\_zubic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sinisa_zubic/32/32498_2.png) [@sinisa\_zubic](https://community.dynatrace.com/u/sinisa_zubic)\
**Post date:** [July 15, 2025, 3:27pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/31 "2025-07-15T15:27:13Z")

</div>

Hi JM,

Yes, your scenario is a cloud native one.

I am not sure where you found the DT\_CUSTOM\_PROP\_HEROKU\_APP environment variable; what [we have in our documentation](https://docs.dynatrace.com/docs/observe/infrastructure-monitoring/process-groups/configuration/define-your-own-process-group-metadata#variables) is DT\_CUSTOM\_PROP without the suffix. Having DT\_CUSTOM\_PROP or `DT_TAGS` environment variables causes host and process-level metrics sent by the particular OneAgent to have the defined key value combinations available in the environment variable as metric dimensions and values in Grail.

Unfortunately, the environment variables don’t enrich spans. But the OneAgent is picking up for spans the environment variable `OTEL_RESOURCE_ATTRIBUTES`.  
If you are using the traces on grail capability and want the span data to be enriched in grail with your custom fields then you can do this like follows.

```auto
OTEL_RESOURCE_ATTRIBUTES="app=CPERFRONT,env=PROD"

```

The semantic is a bit different, comma instead of space.

We are currently working to streamline OneAgent side enrichment when using environment variables so in future setting one environment variable will be sufficient.

Best  
Sini

---

<div class="post-metadata">

**Author:** ![JMBMinint](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@JMBMinint](https://community.dynatrace.com/u/JMBMinint)\
**Post date:** [July 16, 2025, 8:52am UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/32 "2025-07-16T08:52:18Z")

</div>

Hi Sini,

I got this environnement variable from the DT support.

So if I put these two variables, I should be good ?

DT\_CUSTOM\_PROP=“app=CPERFRONT,env=PROD”

OTEL\_RESOURCE\_ATTRIBUTES=“app=CPERFRONT,env=PROD”

Best regards,

JM

---

<div class="post-metadata">

**Author:** ![sinisa\_zubic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sinisa_zubic/32/32498_2.png) [@sinisa\_zubic](https://community.dynatrace.com/u/sinisa_zubic)\
**Post date:** [July 16, 2025, 3:08pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/33 "2025-07-16T15:08:42Z")

</div>

Yes if you add those two environment variables, you should be good.

Please let me know the outcome.

Best,  
Sini

---

<div class="post-metadata">

**Author:** ![JMBMinint](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@JMBMinint](https://community.dynatrace.com/u/JMBMinint)\
**Post date:** [July 23, 2025, 8:34am UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/34 "2025-07-23T08:34:43Z")

</div>

Hi Sini,

We implemented the two variables, but I still don’t know how to configure the data fields in the segment configuration. Nothing changes overthere. Do I need a variable?

Best regards,

JM

---

<div class="post-metadata">

**Author:** ![sinisa\_zubic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sinisa_zubic/32/32498_2.png) [@sinisa\_zubic](https://community.dynatrace.com/u/sinisa_zubic)\
**Post date:** [August 4, 2025, 8:34am UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/35 "2025-08-04T08:34:10Z")

</div>

Hi JM,

Yes, you need a variable. This would be the definition of the segment variable

```markup
fetch metric.series
| filter isNotNull(app)
| fields app , metadata = concat("[ENVIRONMENT]app:",app)

```

And this is how the segment definition could look like

 ![sinisa_zubic_0-1754296265774.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/d/1daade746a8cc7807b2635a365398a81ee5d6834.png)

You have also to propagate your variables (app & env) to Davis problems. In settings, you need to configure your tag to be propagated to Davis problems.

1. Go to&nbsp; **Settings** &nbsp;\>&nbsp; **Analyze and alert** &nbsp;\>&nbsp; **Root cause analysis** &nbsp;\>&nbsp; **Problem fields**.
2. Select&nbsp;&nbsp; **New field**. (app & env)

Best,  
Sini

---

<div class="post-metadata">

**Author:** ![JMBMinint](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@JMBMinint](https://community.dynatrace.com/u/JMBMinint)\
**Post date:** [August 4, 2025, 3:04pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/36 "2025-08-04T15:04:19Z")

</div>

Hi Sini,

Thanks for your reply ! The DQL request return nothing. Is there something I have to do to so that the environment variable are available in Grail ?

Regards

JM

Regards,

Jean-Michel

---

<div class="post-metadata">

**Author:** ![sinisa\_zubic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sinisa_zubic/32/32498_2.png) [@sinisa\_zubic](https://community.dynatrace.com/u/sinisa_zubic)\
**Post date:** [August 4, 2025, 3:46pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/37 "2025-08-04T15:46:47Z")

</div>

Can you try to set the environment variables without double quotes for the OTEL\_RESOURCE\_ATTRIBUES env var? In some deployment environments, double quotes might cause problems.

OTEL\_RESOURCE\_ATTRIBUTES=app=CPERFRONT,env=PROD

For the DT\_CUSTOM\_PROP one, you have to use “blank” as a field separator.

DT\_CUSTOM\_PROP=“app=CPERFRONT env=PROD”

Currently, we’re working on improving documentation about how to set these environment variables. Just looked up the first draft of this documentation.

Best,  
Sini

---

<div class="post-metadata">

**Author:** ![KylerNelson](https://avatars.discourse-cdn.com/v4/letter/k/439d5e/32.png) [@KylerNelson](https://community.dynatrace.com/u/KylerNelson)\
**Post date:** [September 11, 2025, 9:06pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/38 "2025-09-11T21:06:03Z")

</div>

Updated link is&nbsp;[Upgrade from management zones to segments — Dynatrace Docs](https://docs.dynatrace.com/docs/manage/segments/upgrade-guide-segments)&nbsp;for those who need it since the shortlink doesn’t work anymore.

---

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [October 8, 2025, 11:29am UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/39 "2025-10-08T11:29:43Z")

</div>

Hi,

What would you suggest for a new customer to use to separate dev and prod environments by aws account id. He also wants to have access control - e.g. one group of people to access dev and other prod. - Management zones + Segments (for Notebooks and Dashbords), Segments + some specific configuration in Account Management, … ?

Regards, Deni

---

<div class="post-metadata">

**Author:** ![tarjei\_statkraf](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@tarjei\_statkraf](https://community.dynatrace.com/u/tarjei_statkraf)\
**Post date:** [November 17, 2025, 2:31pm UTC](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818/40 "2025-11-17T14:31:15Z")

</div>

Any plans on improving the documentation for how to migrate from MZ =\> Segments for dashboards?  
The existing documentation is quite lacking.

[Previous page](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818.md?page=1)

[Next page](https://community.dynatrace.com/t/understand-dynatrace-segments-vs-management-zones/50818.md?page=3)
