# Cumulocity microservice instance data management

**URL:** <https://community.cumulocity.com/t/cumulocity-microservice-instance-data-management/7154>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [March 19, 2024, 5:50am UTC](https://community.cumulocity.com/t/cumulocity-microservice-instance-data-management/7154 "2024-03-19T05:50:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexis-sachin](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@alexis-sachin](https://community.cumulocity.com/u/alexis-sachin)\
**Post date:** [March 19, 2024, 5:50am UTC](https://community.cumulocity.com/t/cumulocity-microservice-instance-data-management/7154/1 "2024-03-19T05:50:54Z")

</div>

**Problem** : I am not able to get data related to active instances in a microservice.

- I am working on advance monitoring for my microservices in cumulocity, I am able to fetch basic information using API calls like :

- Need : I want to get data of active instances in a microservice separately.

---

<div class="post-metadata">

**Author:** ![Kai\_Reinhardt](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/kai_reinhardt/32/18493_2.png) [@Kai\_Reinhardt](https://community.cumulocity.com/u/Kai_Reinhardt)\
**Post date:** [March 19, 2024, 5:59am UTC](https://community.cumulocity.com/t/cumulocity-microservice-instance-data-management/7154/2 "2024-03-19T05:59:53Z")

</div>

Hi alexis-sachin

have you checked

> [@Advanced Cumulocity IoT Microservice Monitoring - Part 1](https://community.cumulocity.com/t/advanced-cumulocity-iot-microservice-monitoring-part-1/7825):
>
> Overview In the [other article about basic Microservice Monitoring](https://community.cumulocity.com/t/basic-cumulocity-iot-microservice-monitoring/7640) we demonstrated an easy and low effort way to monitor microservices within a cumulocity tenant. While this is sufficient for small and limited use cases in more advanced use cases, where you have multiple microservices deployed in different tenants, you need a more advanced monitoring solution. In this series of articles of Advanced Cumulocity IoT Microservice Monitoring I will guide you to … [Prepare your microservices for mo…](https://community.cumulocity.com/t/advanced-cumulocity-iot-microservice-monitoring-part-1/7825)

> [@Advanced Cumulocity IoT Microservice Monitoring - Part 2](https://community.cumulocity.com/t/advanced-cumulocity-iot-microservice-monitoring-part-2/2412/3):
>
> I had my tenant configured in an earlier version because I feared that would happen…:smiley: I edited the prometheus.yml example with a comment that it should be added WITHOUT https:// prefix directly in the article

> [@Advanced Cumulocity IoT Microservice Monitoring - Part 3](https://community.cumulocity.com/t/advanced-cumulocity-iot-microservice-monitoring-part-3/7824):
>
> Overview In the [first part](https://community.cumulocity.com/t/advanced-cumulocity-iot-microservice-monitoring-part-1/7825) and [second part](https://community.cumulocity.com/t/advanced-cumulocity-iot-microservice-monitoring-part-2/2412) of this series of articles about Advanced Microservice Monitoring I explained what is needed to prepare your microservice and to setup an independent monitoring environment using prometheus & grafana. In this part I will show you how you can use the capabilities of grafana to build efficient monitoring dashboards for your microservices and configure alerting when something unexpected is happening. Let’s go! Create Micrometer Monitoring Dashboard In…

Regards  
Kai

---

<div class="post-metadata">

**Author:** ![alexis-sachin](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@alexis-sachin](https://community.cumulocity.com/u/alexis-sachin)\
**Post date:** [March 19, 2024, 1:59pm UTC](https://community.cumulocity.com/t/cumulocity-microservice-instance-data-management/7154/3 "2024-03-19T13:59:04Z")

</div>

Hi kai ,  
I am not able to find anything related to my problem.

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [March 19, 2024, 2:40pm UTC](https://community.cumulocity.com/t/cumulocity-microservice-instance-data-management/7154/4 "2024-03-19T14:40:21Z")

</div>

The main problem is that the endpoints are only available once. So `/health` and `/prometheus` endpoints of the same microservice might point to different instances when multiple instances via replica \> 1 or auto scale are configured.

Also it could be that on load you have multiple instances and on idle it will be reduced to just one instance which again, makes it very hard to monitor and compare.

The only option I see might be some additional attributes which are provided on the promtheus endpoint like the hostname or any other attributes which identifies the current instance. So the response of the prometheus request might vary each time you call it.

Still, you cannot control which instance is currently polled. So if you configure your prometheus to poll very 60 seconds it might be that it will query instance1, instance2 … instanceN each 60 seconds with no guarantee that you get them from all available instances. It could also be that you get always instance1.  
I haven’t tried that but this could be a solution to your problem adding this information (if not already present).

Also I would question the main purpose of your approach: Do you really need multiple instances of your microservice? What is the main purpose of the microservice? Would it be sufficient to add additional microservices on request or scale them vertically only?

---

<div class="post-metadata">

**Author:** ![edso](https://avatars.discourse-cdn.com/v4/letter/e/e47774/32.png) [@edso](https://community.cumulocity.com/u/edso)\
**Post date:** [March 19, 2024, 3:31pm UTC](https://community.cumulocity.com/t/cumulocity-microservice-instance-data-management/7154/5 "2024-03-19T15:31:34Z")

</div>

Hi Stefan,

We are trying to do what your backend monitoring was able to do to get those per instance kpi by ourselves instead of getting it from support and R&D team. So there must be away as evident in the plots we got from SwAG. We are trying to isolate a problem with a few microservices.

 ![image0.png](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/1/e/1ee4672a6fca0413eaf2c09b9d642c25d2f75554.png)

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [March 19, 2024, 4:12pm UTC](https://community.cumulocity.com/t/cumulocity-microservice-instance-data-management/7154/6 "2024-03-19T16:12:37Z")

</div>

Hi @edso

the main difference is that Operations + R&D support has direct access to the kubernetes cluster of the whole instance getting much more monitoring insight as you get if you don’t have that and have to rely on the prometheus endpoints only.  
Also it’s not possible to get you access on kubernetes level on shared environments of course.

---

<div class="post-metadata">

**Author:** ![Yishu\_Zhong](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/yishu_zhong/32/31128_2.png) [@Yishu\_Zhong](https://community.cumulocity.com/u/Yishu_Zhong)\
**Post date:** [March 20, 2024, 10:02am UTC](https://community.cumulocity.com/t/cumulocity-microservice-instance-data-management/7154/7 "2024-03-20T10:02:42Z")

</div>

Hi @edso , hi @alexis-sachin ,

I would recommend starting with one instance per microservice to monitor the microservices on C8Y. You can increase the CPU limit or even turn off auto-scaling to ensure that there is only one instance of this microservice. This will allow you to concentrate on monitoring the resource usage of this microservice and then find out why the memory consumption is accumulating. I don’t think monitoring multiple instances can help with this issue. You can see in the graph that the instance that always survives has an increasing memory consumption. The presence of other instances didn’t change its rising trend.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [September 16, 2024, 10:03am UTC](https://community.cumulocity.com/t/cumulocity-microservice-instance-data-management/7154/8 "2024-09-16T10:03:04Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
