mononoke/mysql: group ODS counters by shardmap

Summary:
Grouping stats by the shardmap can help to detect and root-cause issues.
This diffs adds a label to the `MysqlConnection` and Mononoke now will log counters by shardmap.

Reviewed By: StanislavGlebik

Differential Revision: D26994369

fbshipit-source-id: 0708a4b0dc3762f5f9152b83200173cd8b241abc
This commit is contained in:
Aida Getoeva 2021-03-23 11:03:19 -07:00 committed by Facebook GitHub Bot
parent fdbaeb23ab
commit 5f67b9dde7
3 changed files with 9 additions and 2 deletions

View File

@ -112,6 +112,7 @@ impl MetadataSqlFactory {
self.fb,
global_connection_pool.clone(),
pool_config.clone(),
label,
config.primary.db_address.clone(),
self.mysql_options.read_connection_type(),
self.readonly.0,

View File

@ -66,6 +66,8 @@ const SQLITE_SHARD_NUM: NonZeroUsize = nonzero!(2_usize);
const SINGLE_SHARD_NUM: NonZeroUsize = nonzero!(1_usize);
const GC_GENERATION_PATH: &str = "scm/mononoke/xdb_gc/default";
const SQLBLOB_LABEL: &str = "blobstore";
// Test setup data
const UPDATE_FREQUENCY: Duration = Duration::from_millis(1);
const INITIAL_VERSION: u64 = 0;
@ -117,7 +119,7 @@ impl Sqlblob {
port,
read_con_type,
PoolSizeConfig::for_sharded_connection(),
"blobstore".into(),
SQLBLOB_LABEL.into(),
readonly,
))
.into_future()
@ -153,7 +155,7 @@ impl Sqlblob {
port,
read_con_type,
PoolSizeConfig::for_sharded_connection(),
"blobstore".into(),
SQLBLOB_LABEL.into(),
readonly,
))
.into_future()
@ -186,6 +188,7 @@ impl Sqlblob {
fb,
global_connection_pool,
pool_config,
SQLBLOB_LABEL.into(),
shardmap.clone(),
0..shard_count,
read_con_type,
@ -254,6 +257,7 @@ impl Sqlblob {
fb,
global_connection_pool.clone(),
pool_config,
SQLBLOB_LABEL.into(),
db_address.clone(),
read_con_type,
readonly,

View File

@ -76,6 +76,7 @@ pub fn create_mysql_connections_unsharded(
_fb: FacebookInit,
_connection_pool: SharedConnectionPool,
_pool_config: PoolConfig,
_label: String,
_tier: String,
_read_con_type: ReadConnectionType,
_readonly: bool,
@ -97,6 +98,7 @@ pub fn create_mysql_connections_sharded<S>(
_fb: FacebookInit,
_connection_pool: SharedConnectionPool,
_pool_config: PoolConfig,
_label: String,
_shardmap: String,
_shards: S,
_read_con_type: ReadConnectionType,