Skip to content

Commit

Permalink
YSQL: Rename SingleShardTransaction metric name
Browse files Browse the repository at this point in the history
Summary:
Today, the platform team relabels the name of metrics published.
The relabel [[ https://github.com/yugabyte/yugabyte-db/blob/master/managed/devops/replicated.yml#L266 | rule ]] can't parse the "_"s in existing names correctly
and it caused that the Prometheus server didn't group ysqlserver metrics properly.

Fix this by removing the unnecessary "_"s from the metric names.

Test Plan:
Jenkins: build-only

Run `curl 127.0.0.1:13000/prometheus-metrics`

```
handler_latency_yb_ysqlserver_SQLProcessor_SingleShardTransactions_count{metric_id="yb.ysqlserver",metric_type="server",exported_instance="Steves-MacBook-Pro.local:9000"} 0 1644528212230
handler_latency_yb_ysqlserver_SQLProcessor_SingleShardTransactions_sum{metric_id="yb.ysqlserver",metric_type="server",exported_instance="Steves-MacBook-Pro.local:9000"} 0 1644528212230
```

Started a local prometheus server and verified with query
`rpc_latency_count{server_type="yb_ysqlserver"}`

Reviewers: amalyshev, fizaa

Reviewed By: fizaa

Subscribers: fizaa, smishra, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D15392
  • Loading branch information
SteveXiSong committed Feb 11, 2022
1 parent 41f559e commit 1749bd1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/postgres/contrib/yb_pg_metrics/yb_pg_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ set_metric_names(void)
strcpy(ybpgm_table[Commit].name, YSQL_METRIC_PREFIX "CommitStmt");
strcpy(ybpgm_table[Rollback].name, YSQL_METRIC_PREFIX "RollbackStmt");
strcpy(ybpgm_table[Other].name, YSQL_METRIC_PREFIX "OtherStmts");
strcpy(ybpgm_table[Single_Shard_Transaction].name,
YSQL_METRIC_PREFIX "Single_Shard_Transactions");
strcpy(ybpgm_table[Single_Shard_Transaction].name, YSQL_METRIC_PREFIX "SingleShardTransactions");
strcpy(ybpgm_table[Transaction].name, YSQL_METRIC_PREFIX "Transactions");
strcpy(ybpgm_table[AggregatePushdown].name, YSQL_METRIC_PREFIX "AggregatePushdowns");
strcpy(ybpgm_table[CatCacheMisses].name, YSQL_METRIC_PREFIX "CatalogCacheMisses");
Expand Down

0 comments on commit 1749bd1

Please sign in to comment.