go-kratos / kratos

Your ultimate Go microservices framework for the cloud-native era.
https://go-kratos.dev
MIT License
22.59k stars 3.94k forks source link

metrics statistics and usage issues [Question] #3322

Open xuxiaoxia96 opened 1 month ago

xuxiaoxia96 commented 1 month ago

使用kratos的服务后台可能是分布式的,并且随机hash到某一个节点。 但是现在内存收集的metric都是单机的数据,分布式情况会不会统计出现问题呢?

kratos-ci-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The service backend using kratos may be distributed and hashed to a certain node randomly. But now the metrics collected in memory are all single-machine data. Will there be problems with statistics in distributed situations?

Windfarer commented 1 month ago

kratos收集和暴露的是当前实例的数据,通常的实践是用prometheus收集各实例的数据,进行后续的处理

kratos-ci-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Kratos collects and exposes the data of the current instance. The usual practice is to use prometheus to collect the data of each instance for subsequent processing.

harbourlga commented 3 weeks ago

想要采集到所有实例的数据,你可以把你的服务都注册到像consul这种服务注册中心。然后prometheus直接获取注册中心的注册实例去采集这样就不会遗漏数据了

kratos-ci-bot commented 3 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


If you want to collect data from all instances, you can register your services to a service registration center like consul. Then prometheus directly obtains the registration instance of the registration center to collect so that no data is missed.