# Is it possible to split a service?

**URL:** <https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326>\
**Category:** Open Q&A\
**Tags:** services-classic\
**Created:** [January 26, 2021, 3:51pm UTC](https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326 "2021-01-26T15:51:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [January 26, 2021, 3:51pm UTC](https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326/1 "2021-01-26T15:51:29Z")

</div>

I have a Service that supports two different sites: /pt/… for Portugal and /es/… for Spain.

Is it possible to split a service, so that I have two services, say a ServicePt and a ServiceEs ?

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [January 26, 2021, 3:55pm UTC](https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326/2 "2021-01-26T15:55:07Z")

</div>

Yes, you can use service detection rules to modify this behavior. What you likely want to do is set it so that a separate context root is detected for each value.

This blog post explains it: [New Dynatrace API enhances automatic service detection](https://www.dynatrace.com/news/blog/new-dynatrace-api-enhances-automatic-service-detection/)  
And here is the documentation: [Service detection API — Dynatrace Docs](https://www.dynatrace.com/support/help/dynatrace-api/configuration-api/service-api/detection-rules/)

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [January 26, 2021, 3:59pm UTC](https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326/3 "2021-01-26T15:59:07Z")

</div>

Sure! By using service detection rules, you can split or join services.  
At the time of writing , rules can be defined using API only:

> **[Service detection API](https://docs.dynatrace.com/docs/dynatrace-api/configuration-api/service-api/detection-rules)**
>
> Learn what the Dynatrace service detection rules config API offers.

Blog posts with some examples:

- [https://www.dynatrace.com/news/blog/new-dynatrace-api-enhances-automatic-service-detection/](https://www.dynatrace.com/news/blog/new-dynatrace-api-enhances-automatic-service-detection/?_ga=2.195447980.1046237443.1611428209-544063129.1590999186)
- [New Dynatrace API enhances automatic service detection (Part 2)](https://www.dynatrace.com/news/blog/new-dynatrace-api-enhances-automatic-service-detection-part-2/)

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [January 26, 2021, 4:45pm UTC](https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326/4 "2021-01-26T16:45:32Z")

</div>

[@Július L.](https://answers.dynatrace.com/users/16467/view.html) & [@James K.](https://answers.dynatrace.com/users/3513/view.html)

Thanks for your very fast reply. I did a deep dive in the APIs, and they seem really the way to go. I do have one doubt though

I’m using the example provided in the “Separate fully monitored web request services based on URL” section of

> **[Separate fully monitored web request services based on URL or superimposed... -...](https://www.dynatrace.com/news/blog/new-dynatrace-api-enhances-automatic-service-detection/?_ga=2.195447980.1046237443.1611428209-544063129.1590999186#fully-monitored-url)**
>
> Dynatrace automatically detects all deployed applications that are monitored by OneAgent. It does so by analyzing the running processes, identifying which application each process supports, and subsequently mapping the processes to what we call a...

It does seem that the example would be generic for all process groups. Is it possible to limit the splitting to a specific process group, so it doesn’t grab “URLs” from other processes?

Also, any suggestions that should be looked at, as it seems a “dangerous” API?

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [January 26, 2021, 4:58pm UTC](https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326/5 "2021-01-26T16:58:54Z")

</div>

Well, it’s not mentioned in the examples, but you can use process group tags in the conditions! (This is a hidden gem).  
You can define the scope for management zone only.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [January 28, 2021, 2:44pm UTC](https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326/6 "2021-01-28T14:44:03Z")

</div>

[@Július L.,](https://answers.dynatrace.com/users/16467/view.html)

At the moment, I’m splitting with hostname, and it’s working as expected. But I may have to add several rules.

I’m wondering on the impact of overhead at the OneAgent level. If I define it at the hostname level, I imagine that the rule has to be deployed across all OneAgents of the environment. But if I define it at the PG level (PG\_TAG ), would you say it’s more efficient? I would imagine that in this scenario the rules would be interpreted wherever this PG is working, not deploying it environment wide?

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [January 28, 2021, 3:02pm UTC](https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326/7 "2021-01-28T15:02:10Z")

</div>

This type of processing is going to typically happen on the Dynatrace cluster side. The OnenAgents are just sending the data over, it’s the server’s job to stitch things together and detect services.

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [January 28, 2021, 9:06pm UTC](https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326/8 "2021-01-28T21:06:04Z")

</div>

Sometimes it’s really needed to limit the scope of the rule. Tags are ideal for such purpose. Definitions of hostname can be problematic during any changes.

For the performance effect of the rule, I agree with the answer provided by James.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [January 28, 2021, 10:20pm UTC](https://community.dynatrace.com/t/is-it-possible-to-split-a-service/21326/9 "2021-01-28T22:20:28Z")

</div>

Yes, good point. I was confusing here with another problem that I’ve got and that is related to server side request attributes…
