Skip to content

Commit

Permalink
naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
yvardhineni committed Jun 18, 2024
1 parent e5cc080 commit 5fd9914
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,36 +95,36 @@ func (mockDriverConn) QueryContext(ctx context.Context, query string, args []dri

var _ = Describe("PrometheusMetrics", func() {
const help = `
# HELP transaction_sql_stmts_total The number of sql stmts called in a transaction by statement type per grpc service and method
# TYPE transaction_sql_stmts_total summary
# HELP transaction_sql_stmts The number of sql stmts called in a transaction by statement type per grpc service and method
# TYPE transaction_sql_stmts summary
`

var service1Metrics = `
transaction_sql_stmts_total_sum{grpc_method="method_1",grpc_service="service_1",stmt="exec"} 3
transaction_sql_stmts_total_count{grpc_method="method_1",grpc_service="service_1",stmt="exec"} 1
transaction_sql_stmts_total_sum{grpc_method="method_1",grpc_service="service_1",stmt="query"} 3
transaction_sql_stmts_total_count{grpc_method="method_1",grpc_service="service_1",stmt="query"} 1
transaction_sql_stmts_sum{grpc_method="method_1",grpc_service="service_1",stmt="exec"} 3
transaction_sql_stmts_count{grpc_method="method_1",grpc_service="service_1",stmt="exec"} 1
transaction_sql_stmts_sum{grpc_method="method_1",grpc_service="service_1",stmt="query"} 3
transaction_sql_stmts_count{grpc_method="method_1",grpc_service="service_1",stmt="query"} 1
`

var service2Metrics = `
transaction_sql_stmts_total_sum{grpc_method="method_2",grpc_service="service_2",stmt="exec"} 4
transaction_sql_stmts_total_count{grpc_method="method_2",grpc_service="service_2",stmt="exec"} 1
transaction_sql_stmts_total_sum{grpc_method="method_2",grpc_service="service_2",stmt="query"} 4
transaction_sql_stmts_total_count{grpc_method="method_2",grpc_service="service_2",stmt="query"} 1
transaction_sql_stmts_sum{grpc_method="method_2",grpc_service="service_2",stmt="exec"} 4
transaction_sql_stmts_count{grpc_method="method_2",grpc_service="service_2",stmt="exec"} 1
transaction_sql_stmts_sum{grpc_method="method_2",grpc_service="service_2",stmt="query"} 4
transaction_sql_stmts_count{grpc_method="method_2",grpc_service="service_2",stmt="query"} 1
`

var service1RerunMetrics = `
transaction_sql_stmts_total_sum{grpc_method="method_1",grpc_service="service_1",stmt="exec"} 4
transaction_sql_stmts_total_count{grpc_method="method_1",grpc_service="service_1",stmt="exec"} 2
transaction_sql_stmts_total_sum{grpc_method="method_1",grpc_service="service_1",stmt="query"} 4
transaction_sql_stmts_total_count{grpc_method="method_1",grpc_service="service_1",stmt="query"} 2
transaction_sql_stmts_sum{grpc_method="method_1",grpc_service="service_1",stmt="exec"} 4
transaction_sql_stmts_count{grpc_method="method_1",grpc_service="service_1",stmt="exec"} 2
transaction_sql_stmts_sum{grpc_method="method_1",grpc_service="service_1",stmt="query"} 4
transaction_sql_stmts_count{grpc_method="method_1",grpc_service="service_1",stmt="query"} 2
`

var noMethodMetrics = `
transaction_sql_stmts_total_sum{grpc_method="",grpc_service="",stmt="exec"} 1
transaction_sql_stmts_total_count{grpc_method="",grpc_service="",stmt="exec"} 1
transaction_sql_stmts_total_sum{grpc_method="",grpc_service="",stmt="query"} 1
transaction_sql_stmts_total_count{grpc_method="",grpc_service="",stmt="query"} 1
transaction_sql_stmts_sum{grpc_method="",grpc_service="",stmt="exec"} 1
transaction_sql_stmts_count{grpc_method="",grpc_service="",stmt="exec"} 1
transaction_sql_stmts_sum{grpc_method="",grpc_service="",stmt="query"} 1
transaction_sql_stmts_count{grpc_method="",grpc_service="",stmt="query"} 1
`

It("Should emit the correct metrics", func() {
Expand Down
2 changes: 1 addition & 1 deletion prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
// sqlStmtsSummary is a prometheus metric to keep track of the number of times
// a sql statement is called in a transaction by statement type per grpc service
var sqlStmtsSummary = prometheus.NewSummaryVec(prometheus.SummaryOpts{
Name: "transaction_sql_stmts_total",
Name: "transaction_sql_stmts",
Help: "The number of sql stmts called in a transaction by statement type per grpc service and method",
}, []string{GRPCServiceKey, GRPCMethodKey, StatementKey})

Expand Down

0 comments on commit 5fd9914

Please sign in to comment.