Skip to content

Commit

Permalink
Make -grpc_prometheus work when not using a grpc server
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Robinson <hrobinson@slack-corp.com>
  • Loading branch information
henryr committed Apr 12, 2024
1 parent 9e40015 commit c0d67d0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions go/vt/servenv/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,16 @@ func interceptors() []grpc.ServerOption {
}

func serveGRPC() {
if grpccommon.EnableGRPCPrometheus() {
grpc_prometheus.Register(GRPCServer)
grpc_prometheus.EnableHandlingTimeHistogram()
}
// skip if not registered
if gRPCPort == 0 {
return
}

if grpccommon.EnableGRPCPrometheus {

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / End-to-End Test

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtorc)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (topo_connection_cache)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_gen4)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_general_heavy)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_etcd)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (mysql80)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (schemadiff_vrepl)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_foreign_key_stress)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (22)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_partial_movetables_and_materialize)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_partial_keyspace)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_concurrentdml)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (13)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress_suite) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_multi_tenant)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (12)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtbackup)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_schema)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (21)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vstream)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Local example using etcd on ubuntu-22.04

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (schemadiff_vrepl) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_v2)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_backup) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Local example using zk2 on ubuntu-22.04

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Local example using consul on ubuntu-22.04

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Schema)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_queries)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_reservedconn)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Region Sharding example using etcd on ubuntu-22.04

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_transaction)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Backups - E2E

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr_xtrabackup) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_scheduler)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_backup)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_consul)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_migrate_vdiff2_convert_tz)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Unit Test (mysql80)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / End-to-End Test (Race)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtorc) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_godriver)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_tablet_healthcheck_cache)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_foreignkey_stress)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (ers_prs_newfeatures_heavy)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_recovery)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_revert) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_throttler_topo)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_basic)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (mysql_server_vault)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_suite) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (15)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_vschema)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vttablet_prscomplex)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_tablegc) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress_suite)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_revert)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_unsharded)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_tablegc)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_schema_tracker)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_suite)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_readafterwrite)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_cellalias)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtctlbackup_sharded_clustertest_heavy)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_scheduler) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_consul)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_vindex_heavy)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 10

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 10

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Code Coverage

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (18)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Backups - Manual

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_across_db_versions)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Reparent Old Vtctl

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_recovery) mysql57

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr_xtrabackup)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Reparent Old VTTablet

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Unit Test (mysql57)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Queries)

non-boolean condition in if statement

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

non-boolean condition in if statement) (typecheck)

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

non-boolean condition in if statement) (typecheck)

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

non-boolean condition in if statement) (typecheck)

Check failure on line 281 in go/vt/servenv/grpc_server.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

non-boolean condition in if statement
grpc_prometheus.Register(GRPCServer)
grpc_prometheus.EnableHandlingTimeHistogram()
}

// register reflection to support list calls :)
reflection.Register(GRPCServer)

Expand Down

0 comments on commit c0d67d0

Please sign in to comment.