Skip to content

Commit

Permalink
Revise "About tenant IDs" (#1158)
Browse files Browse the repository at this point in the history
* Revise "About tenant IDs"

Signed-off-by: Jack Baldry <[email protected]>

* Correct the supported length of tenant IDs

Signed-off-by: Jack Baldry <[email protected]>
Co-authored-by: replay <[email protected]>

* Fix references to tenant ID limitations

Signed-off-by: Jack Baldry <[email protected]>
  • Loading branch information
jdbaldry authored Feb 12, 2022
1 parent b93e345 commit e8751a2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
20 changes: 8 additions & 12 deletions docs/sources/about-tenant-ids.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
---
title: "About tenant IDs"
description: ""
weight: 100
weight: 10
---

# About tenant IDs

The tenant ID (also called "user ID" or "org ID") is the unique identifier of a tenant within a Grafana Mimir cluster. The tenant ID is an opaque information to Grafana Mimir, which doesn't make any assumption on its format/content, but its naming has two limitations:
The tenant ID is the unique identifier of a tenant within a Grafana Mimir cluster.
For information about how Grafana Mimir components use tenant IDs, refer to [About authentication and authorization]({{<relref "./about-authentication-and-authorization.md" >}}).

1. Supported characters
2. Length
## Restrictions

## Supported characters

The following character sets are generally **safe for use in the tenant ID**:
Tenant IDs must be less-than or equal-to 150 bytes/characters in length and must comprise only supported characters:

- Alphanumeric characters
- `0-9`
Expand All @@ -23,14 +21,12 @@ The following character sets are generally **safe for use in the tenant ID**:
- Exclamation point (`!`)
- Hyphen (`-`)
- Underscore (`_`)
- Single Period (`.`), but the tenant IDs `.` and `..` are considered invalid
- Single Period (`.`)
- Asterisk (`*`)
- Single quote (`'`)
- Open parenthesis (`(`)
- Close parenthesis (`)`)

All other characters are not safe to use. In particular, slashes `/` and whitespaces (` `) are **not supported**.

## Length
> **Note:** For security reasons, `.` and `..` aren't valid tenant IDs.
The tenant ID length should not exceed 150 bytes/characters.
All other characters, including slashes and whitespace, aren't supported.
2 changes: 0 additions & 2 deletions docs/sources/configuration/about-versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ Grafana Mimir strives to be 100% API compatible with Prometheus (under `/prometh
- Additional API around pushing metrics (under `/prometheus/api/push`).
- Additional API endpoints for management of Grafana Mimir itself, such as the ring. These APIs are not part of the any compatibility guarantees.

_For more information, please refer to the [limitations](../guides/limitations.md) doc._

## Experimental features

Grafana Mimir is an actively developed project and we want to encourage the introduction of new features and capabilities. As such, not everything in each release of Grafana Mimir is considered "production-ready". Features not considered "production-ready" and the flags used to enable and/or configure these features will be marked "Experimental". There are no backwards compatibility guarantees on anything marked experimental. Configuration and flags are subject to change.
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ A tenant (also called "user" or "org") is the owner of a set of series written t
For more information, please refer to:

- [HTTP API authentication](../api/_index.md#authentication)
- [Tenant ID limitations](./limitations.md#tenant-id-naming)
- [About tenant IDs]({{<relref "./about-tenant-ids.md" >}})

### Time series

Expand Down
2 changes: 1 addition & 1 deletion pkg/tenant/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ type MultiResolver struct {
// NewMultiResolver creates a tenant resolver, which allows request to have
// multiple tenant ids submitted separated by a '|' character. This enforces
// further limits on the character set allowed within tenants as detailed here:
// https://github.com/grafana/mimir/blob/main/docs/sources/guides/limitations.md)
// https://github.com/grafana/mimir/blob/main/docs/sources/about-tenant-ids.md
func NewMultiResolver() *MultiResolver {
return &MultiResolver{}
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/tenant/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ func JoinTenantIDs(tenantIDs []string) string {
return strings.Join(tenantIDs, tenantIDsLabelSeparator)
}

// this checks if a rune is supported in tenant IDs (according to
// https://github.com/grafana/mimir/blob/main/docs/sources/guides/limitations.md)
// This checks if a rune is supported in tenant IDs according to the rules
// documented in "About tenant IDs":
// https://github.com/grafana/mimir/blob/main/docs/sources/about-tenant-ids.md
func isSupported(c rune) bool {
// characters
if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') {
Expand Down

0 comments on commit e8751a2

Please sign in to comment.