-
Notifications
You must be signed in to change notification settings - Fork 12
metric name tenant #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: db_main
Are you sure you want to change the base?
metric name tenant #213
Conversation
fac201a to
916a2ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for starting the first V2 PR. There are still some implementation decisions to make and we need to meet and discuss.
At the high level, let's separate the write path and read path in different PRs.
| cmd.Flag("receive.metric-name-shards", "When set and greater than 0, enables metric name sharding. In RouterOnly mode, modifies tenant header to {hashring-name}-{hash(metric_name) % shards}. In IngestorOnly/RouterIngestor mode, optimizes query fan-out by only querying TSDBs matching the metric's shard. Disables cuckoo filter when enabled."). | ||
| Default("0").IntVar(&rc.metricNameShards) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use a configmap for the sharding schema instead of a command flag. Thanos Router needs to support the schema defined in the V2 design doc. It has special metric groups besides the number of shards for each metric scope.
scopeName: "az-eastus2",
shards: 20,
// The metrics that are heavily used by alert rules or have super high cardinality
// can be in special groups to avoid skewed data partitions.
specialMetricGroups: [
{
name: "kube-metrics",
metrics: [
"container_cpu_usage_seconds_total",
"container_memory_working_set_bytes"
]
},
{
name: "rpc-metrics",
metrics: ["rpc_client_requests_total"]
}
]
}
=== shard name calculation ===
if metric_name in any special metric group then
shard_name = the speical metric group name
else
shard_name = hash(metric_name) % shards
| hash := hasher.Sum64() | ||
|
|
||
| shard := hash % uint64(h.metricNameShards) | ||
| modifiedTenant := fmt.Sprintf("%s-%d", hashringName, shard) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What semantics will hashringName have in our context?
|
let's discuss in meeting. Deleted the screenshot in this public repo |
Added a new flag --receive.metric-name-shards that creates tenant sharding based on metric names.
How it works:
Benefits:
Note that routing is not changed at all. It is more complicated and we will have another PR to address it.