Instana Tag Filter Expressions
What is a tag filter expression?
With tag filter expression, you can specify conditions that Instana uses to selectively display or analyze data. For example, you can create a filter expression to show data that is only related to services tagged with "production" and "backend", or to monitor metrics specifically from hosts tagged with "AWS" and "us-east-1".
These expressions typically use logical operators (AND, OR) and comparison operators (equals, not equals) to combine tags and define the filtering rules effectively. They're essential for focusing monitoring efforts on specific subsets of your infrastructure or applications, making it easier to manage and troubleshoot performance issues.
Structure of a tag filter expression in Instana
In Instana, the data model for a tag filter expression follows a structured format to define conditions based on tags that are associated with monitored entities.
Structure overview
-
Tag Key and Value:
- Tags are represented as key-value pairs.
- Example:
environment:production
, whereenvironment
is the tag key andproduction
is the tag value.
-
Logical Operators:
- AND Operator (
&&
): Combines multiple conditions where all must be true. - OR Operator (
||
): Combines multiple conditions where at least one must be true. - NOT Operator (
!
): Negates a condition.
- AND Operator (
-
Comparison Operators:
- Equals (
=
): Matches a specific tag value. - Not Equals (
!=
): Does not match a specific tag value. - Exists (
exists
): Checks if a tag exists for an entity.
- Equals (
Examples of tag filter expressions
-
Simple Tag Match:
- Filter for services tagged with
environment:production
. - Expression:
environment:production
- Filter for services tagged with
-
Multiple Tags with AND Operator:
- Filter for hosts that are tagged with both
environment:production
andservice:backend
. - Expression:
environment:production && service:backend
- Filter for hosts that are tagged with both
-
OR Operator for Alternative Tags:
- Filter for services that are tagged with either
environment:production
orenvironment:staging
. - Expression:
environment:production || environment:staging
- Filter for services that are tagged with either
-
Combining AND and OR:
- Filter for services that are tagged with
environment:production
and eitherservice:frontend
orservice:backend
. - Expression:
environment:production && (service:frontend || service:backend)
- Filter for services that are tagged with
-
Negation with NOT Operator:
- Filter for hosts not tagged with
environment:development
. - Expression:
!environment:development
- Filter for hosts not tagged with
-
Checking Tag Existence:
- Filter for services where the
version
tag exists. - Expression:
version:exists
- Filter for services where the
Notes
- Parentheses
()
can be used to group conditions for clarity and to specify the order of operations. - Instana's tag filter expressions are versatile and allow for complex criteria to precisely define which monitored entities and metrics should be included or excluded from analysis or monitoring views. Adjustments can be made dynamically based on your monitoring needs and infrastructure setup.