MCPcopy
hub / github.com/uber/aresdb / AddTableShard

Method AddTableShard

utils/metrics.go:1091–1102  ·  view source on GitHub ↗

AddTableShard adds a reporter for the given table and shards. It should be called when bootstrap the table shards or shard ownership changes.

(tableName string, shardID int)

Source from the content-addressed store, hash-verified

1089// AddTableShard adds a reporter for the given table and shards. It should
1090// be called when bootstrap the table shards or shard ownership changes.
1091func (f *ReporterFactory) AddTableShard(tableName string, shardID int) {
1092 f.Lock()
1093 defer f.Unlock()
1094 key := fmt.Sprintf("%s_%d", tableName, shardID)
1095 _, ok := f.reporters[key]
1096 if !ok {
1097 f.reporters[key] = NewReporter(f.rootReporter.GetRootScope().Tagged(map[string]string{
1098 metricsTagTable: tableName,
1099 metricsTagShard: strconv.Itoa(shardID),
1100 }))
1101 }
1102}
1103
1104// DeleteTableShard deletes the reporter for the given table and shards. It should
1105// be called when the table shard no longer belongs to current node.

Callers

nothing calls this directly

Calls 4

NewReporterFunction · 0.85
GetRootScopeMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected