@@ -572,7 +572,52 @@ hg_metrics_map = std::make_tuple(
572572 " proxysql_connpool_conns_status" ,
573573 " The status of the backend server (1 - ONLINE, 2 - SHUNNED, 3 - OFFLINE_SOFT, 4 - OFFLINE_HARD, 5 - SHUNNED_REPLICATION_LAG)." ,
574574 metric_tags {}
575+ ),
576+ // PMM-Compatibility metrics
577+ // //////////////////////////////////////////////////////////////////////
578+ std::make_tuple (
579+ p_hg_dyn_gauge::runtime_servers_status,
580+ " proxysql_runtime_mysql_servers_status" ,
581+ " The status of the backend server (1 - ONLINE, 2 - SHUNNED, 3 - OFFLINE_SOFT, 4 - OFFLINE_HARD, 5 - SHUNNED_REPLICATION_LAG)." ,
582+ metric_tags {}
583+ ),
584+ std::make_tuple (
585+ p_hg_dyn_gauge::runtime_servers_weight,
586+ " proxysql_runtime_mysql_servers_weight" ,
587+ " Configured 'weight' for the backend server." ,
588+ metric_tags {}
589+ ),
590+ std::make_tuple (
591+ p_hg_dyn_gauge::runtime_servers_compression,
592+ " proxysql_runtime_mysql_servers_compression" ,
593+ " If 'compression' is enabled for the backend server." ,
594+ metric_tags {}
595+ ),
596+ std::make_tuple (
597+ p_hg_dyn_gauge::runtime_servers_max_connections,
598+ " proxysql_runtime_mysql_servers_max_connections" ,
599+ " Configured 'max_connections' for the backend server." ,
600+ metric_tags {}
601+ ),
602+ std::make_tuple (
603+ p_hg_dyn_gauge::runtime_servers_max_replication_lag,
604+ " proxysql_runtime_mysql_servers_max_replication_lag" ,
605+ " Configured 'max_replication_lag' for the backend server." ,
606+ metric_tags {}
607+ ),
608+ std::make_tuple (
609+ p_hg_dyn_gauge::runtime_servers_use_ssl,
610+ " proxysql_runtime_mysql_servers_use_ssl" ,
611+ " If 'ssl' is enabled for the backend server." ,
612+ metric_tags {}
613+ ),
614+ std::make_tuple (
615+ p_hg_dyn_gauge::runtime_servers_max_latency_ms,
616+ " proxysql_runtime_mysql_servers_max_latency_ms" ,
617+ " Configured 'max_latency_ms' for the backend server." ,
618+ metric_tags {}
575619 )
620+ // //////////////////////////////////////////////////////////////////////
576621 }
577622);
578623
@@ -3408,6 +3453,69 @@ void MySQL_HostGroups_Manager::p_update_connection_pool() {
34083453 // proxysql_connection_pool_status metric
34093454 p_update_connection_pool_update_gauge (endpoint_id, common_labels,
34103455 status.p_connection_pool_status_map , ((int )mysrvc->get_status ()) + 1 , p_hg_dyn_gauge::connection_pool_status);
3456+
3457+ // PMM-Compatibility metrics
3458+ // //////////////////////////////////////////////////////////////////
3459+ std::map<std::string, std::string> srvs_common_labels = common_labels;
3460+ srvs_common_labels.insert ({" gtid_port" , std::to_string (mysrvc->gtid_port )});
3461+
3462+ p_update_connection_pool_update_gauge (
3463+ endpoint_id,
3464+ srvs_common_labels,
3465+ status.p_runtime_servers_status_map ,
3466+ ((int )mysrvc->get_status ()) + 1 ,
3467+ p_hg_dyn_gauge::runtime_servers_status
3468+ );
3469+
3470+ p_update_connection_pool_update_gauge (
3471+ endpoint_id,
3472+ srvs_common_labels,
3473+ status.p_runtime_servers_weigth_map ,
3474+ mysrvc->weight ,
3475+ p_hg_dyn_gauge::runtime_servers_weight
3476+ );
3477+
3478+ p_update_connection_pool_update_gauge (
3479+ endpoint_id,
3480+ srvs_common_labels,
3481+ status.p_runtime_servers_compress_map ,
3482+ mysrvc->compression ,
3483+ p_hg_dyn_gauge::runtime_servers_compression
3484+ );
3485+
3486+ p_update_connection_pool_update_gauge (
3487+ endpoint_id,
3488+ srvs_common_labels,
3489+ status.p_runtime_servers_max_conns_map ,
3490+ mysrvc->max_connections ,
3491+ p_hg_dyn_gauge::runtime_servers_max_connections
3492+ );
3493+
3494+ p_update_connection_pool_update_gauge (
3495+ endpoint_id,
3496+ srvs_common_labels,
3497+ status.p_runtime_servers_max_repl_lag_map ,
3498+ mysrvc->max_replication_lag ,
3499+ p_hg_dyn_gauge::runtime_servers_max_replication_lag
3500+ );
3501+
3502+ p_update_connection_pool_update_gauge (
3503+ endpoint_id,
3504+ srvs_common_labels,
3505+ status.p_runtime_servers_use_ssl_map ,
3506+ mysrvc->use_ssl ,
3507+ p_hg_dyn_gauge::runtime_servers_use_ssl
3508+ );
3509+
3510+ p_update_connection_pool_update_gauge (
3511+ endpoint_id,
3512+ srvs_common_labels,
3513+ status.p_runtime_servers_max_lat_map ,
3514+ mysrvc->max_latency_us / 1000 ,
3515+ p_hg_dyn_gauge::runtime_servers_max_latency_ms
3516+ );
3517+
3518+ // //////////////////////////////////////////////////////////////////
34113519 }
34123520 }
34133521
0 commit comments