Update an existing usage groups configuration
This section describes how to update an already existing MimirUsageGroupsConfiguration resource named config for a customer stack.
This includes adding new usage groups, modifying existing ones, or removing them.
Before you begin
Note
Ensure you have completed the prerequisites.
Step 1: Select the customer context
Use gcx CLI to switch to the desired context:
gcx config use-context <CONTEXT>For more details on how to correctly configure contexts, refer to the gcx CLI Configuration.
Step 2: Pull the existing configuration
Fetch the existing MimirUsageGroupsConfiguration resource:
gcx resources pull mimirusagegroupsconfiguration/config --path <path-to-local-copy> -o yamlThis command stores the resource locally at:
<path-to-local-copy>/mimirusagegroupsconfigurations.v1alpha1.mimir.ext.grafana.com/config.yamlExpected result:
✔ 1 resources pulledStep 3: Create a backup
Before making any changes, create a backup of the fetched configuration files. For example, in a separate folder on path:
<path-to-local-copy-backup>This ensures you can restore the previous configuration if needed.
Step 4: Modify the configuration
Edit the file:
<path-to-local-copy>/mimirusagegroupsconfigurations.v1alpha1.mimir.ext.grafana.com/config.yamlUpdate the spec.usageGroups section as required:
- Add new usage groups
- Modify existing usage groups
- Delete usage groups that are no longer needed
Ensure that all changes follow the required syntax and naming constraints. For example, the updated configuration can look like this:
apiVersion: mimir.ext.grafana.com/v1alpha1
kind: MimirUsageGroupsConfiguration
metadata:
name: config
spec:
usageGroups:
grafanacloud_usage_group/errors: '{status=~"5.."}'
grafanacloud_usage_group/dev: '{env=~"dev.*"}' # this is a new usage group
grafanacloud_usage_group/production: '{env=~"prod.*|ops.*"}' # this is a modification of an existing usage groupStep 5: Push the updated configuration
Apply the updated configuration:
gcx resources push mimirusagegroupsconfiguration/config --path <path-to-local-copy>/mimirusagegroupsconfigurations.v1alpha1.mimir.ext.grafana.com/config.yamlIf update is successful, the following message is displayed:
✔ 1 resources pushed, 0 errorsThis indicates that the MimirUsageGroupsConfiguration resource named config has been updated.
It is then automatically validated and propagated to the customer’s Mimir environment.
For more details on how to manage resources using gcx CLI, refer to Manage resources with Grafana CLI.
Was this page helpful?
Related resources from Grafana Labs


