docs/proposals-accepted/202209-receive-tenant-external-labels.md
https://github.com/thanos-io/thanos/issues/5434
We would like to do cross-tenant activities like grouping tenants' blocks or querying tenants that share the same attributes. Tenant's external labels can help us do those.
Currently, we can only add external labels to Receiver itself, not to each tenant in the Receiver. So we can't do cross-tenant activities like grouping tenants' blocks or querying tenants that share the same attributes.
Users who are admin personas and need to perform admin operations on Thanos for multiple tenants
In the hashring config, there will be new field external_labels. Something like this:
[
{
"hashring": "tenant-a-b",
"endpoints": ["127.0.0.1:10901"],
"tenants": ["tenant-a, tenant-b"]
"external_labels": ["key1=value1", "key2=value2", "key3=value3"]
},
]
In Receivers' MultiTSDB, external labels will be extended to each corresponding tenant's label set when the tenant's TSDB is started.
Next thing we have to do is handling changes for tenants' external labels. That is, whenever users make any changes to tenants' external labels, Receivers' MultiTSDB will update those changes in each corresponding tenant's label set.
We will handle the cases of hard tenancy first. Once tenants' external labels can be handled in those cases, we will move to soft tenancy cases.
Tenants’ external labels will be first implemented in RouterIngestor, since this is the most commonly used mode.
After that, we can implement tenants’ external labels in RouterOnly and IngestorOnly modes. As stated above, the best-case scenario would be logically splitting RouterOnly and IngestorOnl (Issue #5643) before implement tenants’ external labels in each.
For the tests, the foremost ones are testing defining one or multiple tenants’ external labels correctly, handling changes in tenants’ external labels correctly, backward compatibility with Receiver’s external labels, and shipper detecting and uploading tenants’ external labels correctly to block storage. We may add more tests in the future but currently these are the most important ones to do first.
external_labels field in the hashring config(Both of these are Ben's ideas expressed here.)