SearchComponents

class aws_cdk.aws_cloudwatch.SearchComponents(*, dimensions, metric_name, namespace, populate_from)

Bases: object

Search components for use with {@link Values.fromSearchComponents}.

Parameters:
  • dimensions (Sequence[str]) – The list of dimensions to be used in the search expression.

  • metric_name (str) – The metric name to be used in the search expression.

  • namespace (str) – The namespace to be used in the search expression.

  • populate_from (str) – The dimension name, that the search expression retrieves, whose values will be used to populate the values to choose from.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_cloudwatch as cw


dashboard = cw.Dashboard(self, "Dash",
    default_interval=Duration.days(7),
    variables=[cw.DashboardVariable(
        id="functionName",
        type=cw.VariableType.PATTERN,
        label="Function",
        input_type=cw.VariableInputType.RADIO,
        value="originalFuncNameInDashboard",
        # equivalent to cw.Values.fromSearch('{AWS/Lambda,FunctionName} MetricName="Duration"', 'FunctionName')
        values=cw.Values.from_search_components(
            namespace="AWS/Lambda",
            dimensions=["FunctionName"],
            metric_name="Duration",
            populate_from="FunctionName"
        ),
        default_value=cw.DefaultValue.FIRST,
        visible=True
    )]
)

Attributes

dimensions

The list of dimensions to be used in the search expression.

metric_name

The metric name to be used in the search expression.

namespace

The namespace to be used in the search expression.

populate_from

The dimension name, that the search expression retrieves, whose values will be used to populate the values to choose from.