Manage derived labels
Create, update, and delete derived labels using Terraform or Chronoctl.
View derived labels
View existing derived labels using Chronoctl.
To view all labels:
chronoctl derived-labels list
To list specific labels using their slugs:
chronoctl derived-labels list --slugs slug_name_1,slug_name_2
Create a derived label
The value_glob
is the label pattern being matched. This example matches the
patterns:
m3coordinator-read*
m3coordinator-write*
m3coordinator-admin*
These values end with *
, which matches any pattern. These patterns display
under a single derived label defined by the label_name
, which is tier
.
You can provide multiple definitions for a value
with different value_glob
patterns. Chronosphere tries them in order of definition.
This example includes a constructed derived label and a mapping derived label. Both follow the same construction rules.
To create a label with Chronoctl:
-
Create a YAML file with the desired labels. To generate a templated example resource, run the
derived-labels scaffold
command:chronoctl derived-labels scaffold
You can redirect the output to a file for editing:
chronoctl derived-labels scaffold > derived-label.yaml
-
Run this command:
chronoctl apply -f derived-label.yml
This is an example definition file for Chronoctl.
api_version: v1/config
kind: DerivedLabel
spec:
name: Test Constructed Label
slug: test-constructed-label
label_name: tier
description: this is a test
metric_label:
constructed_label:
value_definitions:
- value: read
filters:
- name: instance
value_glob: m3coordinator-read*
- value: write
filters:
- name: instance
value_glob: m3coordinator-write*
---
api_version: v1/config
kind: DerivedLabel
spec:
name: Test Mapping Label
slug: test-mapping-label
label_name: chronosphere_service
description: this is a test
metric_label:
mapping_label:
name_mappings:
- filters:
- name: __name__
value_glob: grpc_*
source_label: grpc_service
- filters:
- name: __name__
value_glob: envoy_*
source_label: backend_service
Delete a derived label
Delete a derived label with Chronoctl by
using the chronoctl derived-labels delete
command, specifying the slug of
the derived label to delete.
For example, to delete the derived label with slug slug_name_1
:
chronoctl derived-labels delete slug_name_1