pingcap / tidb-operator

TiDB operator creates and manages TiDB clusters running in Kubernetes.
https://docs.pingcap.com/tidb-in-kubernetes/
Apache License 2.0
1.22k stars 496 forks source link

TiFlash没有暴露proxy的metrics #5675

Closed giant-panda666 closed 2 months ago

giant-panda666 commented 3 months ago

Question

Before asking a question, make sure you have:

csuzhangxc commented 3 months ago

We added different annotations for TiFlash and TiFlashProxy, https://github.com/pingcap/tidb-operator/blob/v1.6.0/pkg/manager/member/tiflash_member_manager.go#L525-L526

And added different scrape jobs for them, https://github.com/pingcap/tidb-operator/blob/v1.6.0/pkg/monitor/monitor/template.go#L102-L103

Did this not work in your environment? which version of TiDB Operator are you using?

giant-panda666 commented 3 months ago

Yes, TiFlash and TiFlashProxy port added in source code and service, but where is it in Pod?

TiDB Operator version is v1.5.3, and the service created by operator: image but the pod created by operator(or statefulset) has no TiFlashProxy metric port: image

csuzhangxc commented 2 months ago

there is no need to add the proxy metrics port (20292) to the container.

have you tried to query some metrics for TiFlash-proxy via our TidbMonitor? Are there any metrics that can't be retrieved?

image

giant-panda666 commented 2 months ago

TidbMonitor is not deployed in our cluster, because we use Prometheus to collect all metrics in our cluster as a cloud native standard. Well, thank you for the information that TidbMonitor provides TiFlash-proxy metrics, i can use the relabel_configs of Promethreus to scrape TiFlash-proxy metrics from 20292. But why not add the proxy metrics port (20292) to the container ports of Pod definition as you indeed listen 20292 in the TiFlash process?

csuzhangxc commented 2 months ago

from the code comment of Kubernetes

    // List of ports to expose from the container. Not specifying a port here
    // DOES NOT prevent that port from being exposed. Any port which is
    // listening on the default "0.0.0.0" address inside a container will be
    // accessible from the network.
    // Modifying this array with strategic merge patch may corrupt the data.
    // For more information See https://github.com/kubernetes/kubernetes/issues/108255.
    // Cannot be updated.

add port into container spec is not necessary. and If we add it to container, all existing Pods will be recreated if we upgrade TiDB Operator.

giant-panda666 commented 2 months ago

Well, upgrade is truly a thorny problem. Thank you again and last question that why TiFlash uses two ports to expose metrics ?

csuzhangxc commented 2 months ago

Well, upgrade is truly a thorny problem. Thank you again and last question that why TiFlash uses two ports to expose metrics ?

TiFlash itself includes two components, both of which use different config and metrics port

giant-panda666 commented 2 months ago

Got it. Thank you for explaining patiently and i will close this issue.