Labels in Nobl9
Labels are key-value pairs that can be attached to SLOs, services, projects, and alert policies in the Nobl9 platform. Labels allow you to define attributes of resources and use them to filter and group SLOs across services and projects in the SLO Grid view, Service Health Dashboard, and reports. Each label must be unique for a given SLO, but many SLOs can carry the same label.
Labels can be attached to SLOs when creating or editing a service or a project in the SLO wizard and to alerts in the alert policy wizard. You can select existing pre-defined labels or add new ones that are specific to your organization.
You can also use Nobl9 metadata annotations to attach custom non-identifying metadata to SLOs, Services, Projects, and Alert Policies through sloctl and Nobl9 SDK for Go!
Check the section below to learn more.
Requirements for labels
Labels have a specific format and must conform to the following rules:
-
Labels must be in the
key: value
format (key=value
insloctl
).-
key
can contain only lowercase letters, digits0-9
, underscores_
, and hyphens-
. Start with a letter. End with a letter or digit. The maximum length is 63 characters -
value
can contain Unicode characters. The maximum length is 200 characters
-
-
Labels can contain international (diacritic) characters.
-
Labels can contain digits (
0-9
), underscores (_
) and hyphens (-
) between the letters. -
There can be a maximum of 20 Labels assigned to a resource.
Most common label examples
The following are the examples for the most common labels in the Nobl9 platform:
-
Area labels:
area: latency
,area: slowcheck
. -
Geo labels:
geo: apac
,geo: amer
,geo: eu
. -
Team labels:
team: green
,team: sales
. -
Alert policy labels:
alert: low
,alert: medium
,alert: high
. -
SLO labels:
slo: ratio
,slo: calendar
. -
Unit labels:
unit: seconds
,unit: ms
,unit: error per s
. -
Environment (organization) labels:
env: test
,env: prod
,env: staging
.
Labels for displaying units on SLI graphs
Labels for units have the same specific format.
To display a unit on the SLI graph in the SLO details tab:
-
Create or edit an SLO > SLO wizard Step 5: select or add unit labels:
- Enter the unit
key
-value
pair. For example,unit: ms
.
- Enter the unit
Save the changes. To view the unit you've added, go to SLO Details > SLI graph. Find the unit above the Y-axis:
Label management
You can create labels while adding them to Nobl9 resources: SLOs, services, projects, and alert policies within their wizards. To create a label, go to the required resource wizard:
- In the Nobl9 UI, go to the required resource list.
- Create a new resource: click at the top of the list
- Edit an existing resource: click in the required resource
- Create a label:
- Enter the required (new)
key
. - Click .
- Enter the required
value
.
- Enter the required (new)
Here, you can also add existing labels to the resource, edit labels, and remove them.
When removing a label in the resource wizard,
you only detach the entire key-value
pair.
Label detachment doesn't delete the label
but unlinks it from the resource.
The label remains available for reuse with any other resource.
Labels
detached from all resources appear in the Catalog > Labels list as Unassigned to any resource.
Resource | Create or add a label |
---|---|
SLO | SLO wizard > Step 5: Add Name, Alert Policy and Labels > the Labels field |
Project | Project wizard > the Labels field |
Service | Service wizard > the Labels field |
Alert policy | Alert policy wizard > Step 2: Add Alert Policy Name, Severity and Labels the Labels field |
Label list
You can access all labels available for your organization under Catalog > Labels:
The list of labels features the following options:
- View
key-value
pairs and resources per every label - Search labels by
key
andvalue
- Sort labels by
key
and usage - Edit individual labels
When, upon editing, two or more labels have identicalkey-value
pairs, such labels are merged into one - Delete individual labels
- Open the selected label details
Only Organization Admins can edit and delete labels.
Once you delete a label in the Catalog > Labels list, this key-value pair is no more available.
Label details
Under the label details, you can view resources that are labeled with it and manage the relation between labels and associated resources.
The resource tabs display only those resources you have access to.
So, when you see fewer resources under label details,
than are displayed for this label in the list or summary panel,
this means you have no access to the missing resources.
To remove the label from a resource under the label details, click in the required resource's row.
Filtering by labels - overview
Nobl9 allows you to filter by multiple labels:
-
Enter/select multiple labels with the same key to filter resources containing one of the labels with the matching key.
-
Enter/select multiple labels with different keys to filter resources containing all the labels with different keys.
For example:
SLO | Label 1 | Label 2 |
---|---|---|
SLO A has the labels | geo: eu | team: green |
SLO B has the labels | geo: apac | team: green |
SLO C has the labels | geo: eu | team: red |
SLO D has the labels | geo: apac | team: red |
-
User filters by:
geo: eu
geo: apac
team: green
-
Applying filters displays:
SLO A
SLO B
For more information, refer to the SLO search and filter logic document.
Retrieving labeled resources in sloctl
Retrieving SLO, Service, or a Project config also returns all the labels that are set on the objects and allows filtering them.
There are two versions of syntax accepted by sloctl
while filtering by labels:
-
Labels can be separated by a comma without spaces, for example:
sloctl get slo -A -l key1=value1,key2=value2,key3=value3
-
Labels can be separated by a
-l
with spaces in between, for example:sloctl get slo -A -l team=green -l team=orange -l key=value
Assumptions for Label Commands in sloctl
:
-
If you retrieve resources for two or more labels that have the same
key
, they are connected by an OR logical operator, for example:sloctl get slo -A -l team=green -l team=red
sloctl
retrieves all resources that haveteam=green
orteam=red
attached to them. -
If you retrieve resources for two or more labels that have different
keys
, they are connected by an AND logical operator, for example:sloctl get slo -A -l team=green -l geo=eu
sloctl
retrieves all resources that have bothteam=green
andgeo=eu
labels attached to them.
Metadata annotations
There are two ways of attaching metadata to your SLOs, services, projects, and alert policies in Nobl9:
- Using labels, or
- Using metadata annotations
Differences between labels and metadata annotations
Labels vs metadata annotations:
- Labels identify objects and locate groups of objects that meet specific criteria.
- You can add labels using Nobl9 web,
sloctl
, Terraform onr Nobl9 SDK for Go!. - Metadata annotations don't serve the purpose of object identification or selection.
- You can add or retrieve metadata annotations only via
sloctl
or Nobl9 SDK for Go!
You can apply both labels and annotations in the metadata of a single Nobl9 object.
The following table summarizes differences between labels and metadata annotations:
Capability | Labels | Metadata annotations |
---|---|---|
Object identification | Identify Nobl9 objects based on specific criteria. Use for grouping and filtering. | Do not identify Nobl9 objects. Use for descriptive purposes. |
Adding | retrieving | Via: • Nobl9 web • sloctl • Nobl9 Terraform provider • Nobl9 SDK for Go! | Only via: • sloctl • Nobl9 SDK for Go! |
Field structure | "key": - "list of values" | key: value |
Character limit for value | Up to 200 unicode characters. | Up to 1050 unicode characters. |
metadata.annotations
and kind: Annotation
metadata.annotations
differ from SLO annotations.
SLO annotations are defined as a separate YAML kind
, associated with SLOs as event notes. They include defined start and end times and are visible on the Nobl9 Web.