Skip to content

get_insight_rule_report

get_insight_rule_report(
    *,
    config_overrides: Optional[CloudWatchClientConfig] = None,
    rule_name: Optional[InsightRuleName] = None,
    start_time: Optional[Timestamp] = None,
    end_time: Optional[Timestamp] = None,
    period: Optional[Period] = None,
    max_contributor_count: Optional[InsightRuleUnboundInteger] = None,
    metrics: Optional[InsightRuleMetricList] = None,
    order_by: Optional[InsightRuleOrderBy] = None,
) -> GetInsightRuleReportOutput

This operation returns the time series data collected by a Contributor Insights rule. The data includes the identity and number of contributors to the log group.

You can also optionally return one or more statistics about each data point in the time series. These statistics can include the following:

  • UniqueContributors -- the number of unique contributors for each data point.

  • MaxContributorValue -- the value of the top contributor for each data point. The identity of the contributor might change for each data point in the graph.

    If this rule aggregates by COUNT, the top contributor for each data point is the contributor with the most occurrences in that period. If the rule aggregates by SUM, the top contributor is the contributor with the highest sum in the log field specified by the rule's Value, during that period.

  • SampleCount -- the number of data points matched by the rule.

  • Sum -- the sum of the values from all contributors during the time period represented by that data point.

  • Minimum -- the minimum value from a single observation during the time period represented by that data point.

  • Maximum -- the maximum value from a single observation during the time period represented by that data point.

  • Average -- the average value from all contributors during the time period represented by that data point.

Parameters:

  • rule_name (Optional[InsightRuleName], default: None ) –

    The name of the rule that you want to see data from.

  • start_time (Optional[Timestamp], default: None ) –

    The start time of the data to use in the report. When used in a raw HTTP Query API, it is formatted as yyyy-MM-dd'T'HH:mm:ss. For example, 2019-07-01T23:59:59.

  • end_time (Optional[Timestamp], default: None ) –

    The end time of the data to use in the report. When used in a raw HTTP Query API, it is formatted as yyyy-MM-dd'T'HH:mm:ss. For example, 2019-07-01T23:59:59.

  • period (Optional[Period], default: None ) –

    The period, in seconds, to use for the statistics in the InsightRuleMetricDatapoint results.

  • max_contributor_count (Optional[InsightRuleUnboundInteger], default: None ) –

    The maximum number of contributors to include in the report. The range is 1 to 100. If you omit this, the default of 10 is used.

  • metrics (Optional[InsightRuleMetricList], default: None ) –

    Specifies which metrics to use for aggregation of contributor values for the report. You can specify one or more of the following metrics:

    • UniqueContributors -- the number of unique contributors for each data point.

    • MaxContributorValue -- the value of the top contributor for each data point. The identity of the contributor might change for each data point in the graph.

      If this rule aggregates by COUNT, the top contributor for each data point is the contributor with the most occurrences in that period. If the rule aggregates by SUM, the top contributor is the contributor with the highest sum in the log field specified by the rule's Value, during that period.

    • SampleCount -- the number of data points matched by the rule.

    • Sum -- the sum of the values from all contributors during the time period represented by that data point.

    • Minimum -- the minimum value from a single observation during the time period represented by that data point.

    • Maximum -- the maximum value from a single observation during the time period represented by that data point.

    • Average -- the average value from all contributors during the time period represented by that data point.

  • order_by (Optional[InsightRuleOrderBy], default: None ) –

    Determines what statistic to use to rank the contributors. Valid values are Sum and Maximum.

Raises:

Source code in docs_src/capo_cloudwatch/_services/cloud_watch.py
def get_insight_rule_report(
    self,
    *,
    config_overrides: Optional[CloudWatchClientConfig] = None,
    rule_name: Optional[
        "capo_cloudwatch.types.insight_rule_name.InsightRuleName"
    ] = None,
    start_time: Optional["capo_cloudwatch.types.timestamp.Timestamp"] = None,
    end_time: Optional["capo_cloudwatch.types.timestamp.Timestamp"] = None,
    period: Optional["capo_cloudwatch.types.period.Period"] = None,
    max_contributor_count: Optional[
        "capo_cloudwatch.types.insight_rule_unbound_integer.InsightRuleUnboundInteger"
    ] = None,
    metrics: Optional[
        "capo_cloudwatch.types.insight_rule_metric_list.InsightRuleMetricList"
    ] = None,
    order_by: Optional[
        "capo_cloudwatch.types.insight_rule_order_by.InsightRuleOrderBy"
    ] = None,
) -> "capo_cloudwatch.types.get_insight_rule_report_output.GetInsightRuleReportOutput":
    """<p>This operation returns the time series data collected by a Contributor Insights rule. The data includes the identity and number of contributors to the log group.</p> <p>You can also optionally return one or more statistics about each data point in the time series. These statistics can include the following:</p> <ul> <li> <p> <code>UniqueContributors</code> -- the number of unique contributors for each data point.</p> </li> <li> <p> <code>MaxContributorValue</code> -- the value of the top contributor for each data point. The identity of the contributor might change for each data point in the graph.</p> <p>If this rule aggregates by COUNT, the top contributor for each data point is the contributor with the most occurrences in that period. If the rule aggregates by SUM, the top contributor is the contributor with the highest sum in the log field specified by the rule's <code>Value</code>, during that period.</p> </li> <li> <p> <code>SampleCount</code> -- the number of data points matched by the rule.</p> </li> <li> <p> <code>Sum</code> -- the sum of the values from all contributors during the time period represented by that data point.</p> </li> <li> <p> <code>Minimum</code> -- the minimum value from a single observation during the time period represented by that data point.</p> </li> <li> <p> <code>Maximum</code> -- the maximum value from a single observation during the time period represented by that data point.</p> </li> <li> <p> <code>Average</code> -- the average value from all contributors during the time period represented by that data point.</p> </li> </ul>

    Args:
        rule_name: <p>The name of the rule that you want to see data from.</p>
        start_time: <p>The start time of the data to use in the report. When used in a raw HTTP Query API, it is formatted as <code>yyyy-MM-dd'T'HH:mm:ss</code>. For example, <code>2019-07-01T23:59:59</code>.</p>
        end_time: <p>The end time of the data to use in the report. When used in a raw HTTP Query API, it is formatted as <code>yyyy-MM-dd'T'HH:mm:ss</code>. For example, <code>2019-07-01T23:59:59</code>.</p>
        period: <p>The period, in seconds, to use for the statistics in the <code>InsightRuleMetricDatapoint</code> results.</p>
        max_contributor_count: <p>The maximum number of contributors to include in the report. The range is 1 to 100. If you omit this, the default of 10 is used.</p>
        metrics: <p>Specifies which metrics to use for aggregation of contributor values for the report. You can specify one or more of the following metrics:</p> <ul> <li> <p> <code>UniqueContributors</code> -- the number of unique contributors for each data point.</p> </li> <li> <p> <code>MaxContributorValue</code> -- the value of the top contributor for each data point. The identity of the contributor might change for each data point in the graph.</p> <p>If this rule aggregates by COUNT, the top contributor for each data point is the contributor with the most occurrences in that period. If the rule aggregates by SUM, the top contributor is the contributor with the highest sum in the log field specified by the rule's <code>Value</code>, during that period.</p> </li> <li> <p> <code>SampleCount</code> -- the number of data points matched by the rule.</p> </li> <li> <p> <code>Sum</code> -- the sum of the values from all contributors during the time period represented by that data point.</p> </li> <li> <p> <code>Minimum</code> -- the minimum value from a single observation during the time period represented by that data point.</p> </li> <li> <p> <code>Maximum</code> -- the maximum value from a single observation during the time period represented by that data point.</p> </li> <li> <p> <code>Average</code> -- the average value from all contributors during the time period represented by that data point.</p> </li> </ul>
        order_by: <p>Determines what statistic to use to rank the contributors. Valid values are <code>Sum</code> and <code>Maximum</code>.</p>

    Raises:
        capo_cloudwatch.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value of an input parameter is bad or out-of-range.</p>
        capo_cloudwatch.errors.missing_required_parameter_exception.MissingRequiredParameterException: <p>An input parameter that is required is missing.</p>
        capo_cloudwatch.errors.resource_not_found_exception.ResourceNotFoundException: <p>The named resource does not exist.</p>
        capo_cloudwatch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatch.types.get_insight_rule_report_input.GetInsightRuleReportInput]",
    ) -> OperationResponse[
        "capo_cloudwatch.types.get_insight_rule_report_output.GetInsightRuleReportOutput"
    ]:
        import capo_cloudwatch._operations.granite_service_version20100801.get_insight_rule_report

        output, http_response = (
            capo_cloudwatch._operations.granite_service_version20100801.get_insight_rule_report.get_insight_rule_report(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetInsightRuleReport")
    )
    input_: capo_cloudwatch.types.get_insight_rule_report_input.GetInsightRuleReportInput = {}
    if rule_name is not None:
        input_["rule_name"] = rule_name
    if start_time is not None:
        input_["start_time"] = start_time
    if end_time is not None:
        input_["end_time"] = end_time
    if period is not None:
        input_["period"] = period
    if max_contributor_count is not None:
        input_["max_contributor_count"] = max_contributor_count
    if metrics is not None:
        input_["metrics"] = metrics
    if order_by is not None:
        input_["order_by"] = order_by

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output