Excluding metrics by using the drop action
You can configure IBM Cloud® Metrics Routing to exclude (drop) metrics based on a configured rule. Dropped metrics are not sent on to a target.
Prereqs
-
Ensure you have the correct IAM permissions to configure IBM Cloud Metrics Routing routes.
-
Log in to IBM Cloud. Run the following command: ibmcloud login.
Define the inclusion filter
Inclusion filters determine which metrics are routed to the targets.
Inclusion filters are comprised of an operand
, operator
, and values
:
operand
-
Operand is the name of the property on which the
operator
test is run. The following operands are supported:location
,service_name
,service_instance
,resource_type
, andresource
. operator
-
Two operators are supported:
in
andis
.in
-
The value of the operand property is compared to a list of values.
You can define up to 20 values.
is
-
The value of the operand property is compared to a single value.
When using
is
, only 1 value can be specified.
value
-
A string, or an array of strings, to be compared with the
operand
property to determine whether the metric is routed or not. When theis
operator
is used,value
must include a single string. When thein
operator
is used,value
can include multiple strings in an array.Valid values depend on the
operand
.location
- Any location where IBM Cloud Metrics Routing is available.
service_name
- The CRN service name of an [IBM Cloud service that generates metrics managed through IBM Cloud Metrics Routing
service_instance
,resource_type
, andresource
- Values appropriate to an [IBM Cloud service that generates metrics managed through IBM Cloud Metrics Routing
For example, to define an inclusion filter that defines the condition where only metrics that are generated in the us-south region are routed, looks as follows:
{"operand": "location","operator": "is","values": "us-south"}
Configure the route
Run the following command to exclude all metrics received by IBM Cloud Metrics Routing from the us-south
region.
ibmcloud metrics-router route create --name drop-route --rules '[{"action": "drop", "inclusion_filters":[{"operand": "location","operator": "is","values": "us-south"}]}]'
Where inclusion_filters
specifies the filters.