Skip to content

start_query async

start_query(
    monitor_name: ResourceName,
    start_time: datetime,
    end_time: datetime,
    query_type: QueryType,
    *,
    config_overrides: Optional[AsyncInternetMonitorClientConfig] = None,
    filter_parameters: Optional[FilterParameters] = None,
    linked_account_id: Optional[AccountId] = None,
) -> StartQueryOutput

Start a query to return data for a specific query type for the Amazon CloudWatch Internet Monitor query interface. Specify a time period for the data that you want returned by using StartTime and EndTime. You filter the query results to return by providing parameters that you specify with FilterParameters.

For more information about using the query interface, including examples, see Using the Amazon CloudWatch Internet Monitor query interface in the Amazon CloudWatch Internet Monitor User Guide.

Parameters:

  • monitor_name (ResourceName) –

    The name of the monitor to query.

  • start_time (datetime) –

    The timestamp that is the beginning of the period that you want to retrieve data for with your query.

  • end_time (datetime) –

    The timestamp that is the end of the period that you want to retrieve data for with your query.

  • query_type (QueryType) –

    The type of query to run. The following are the three types of queries that you can run using the Internet Monitor query interface:

    • MEASUREMENTS: Provides availability score, performance score, total traffic, and round-trip times, at 5 minute intervals.

    • TOP_LOCATIONS: Provides availability score, performance score, total traffic, and time to first byte (TTFB) information, for the top location and ASN combinations that you're monitoring, by traffic volume.

    • TOP_LOCATION_DETAILS: Provides TTFB for Amazon CloudFront, your current configuration, and the best performing EC2 configuration, at 1 hour intervals.

    • OVERALL_TRAFFIC_SUGGESTIONS: Provides TTFB, using a 30-day weighted average, for all traffic in each Amazon Web Services location that is monitored.

    • OVERALL_TRAFFIC_SUGGESTIONS_DETAILS: Provides TTFB, using a 30-day weighted average, for each top location, for a proposed Amazon Web Services location. Must provide an Amazon Web Services location to search.

    • ROUTING_SUGGESTIONS: Provides the predicted average round-trip time (RTT) from an IP prefix toward an Amazon Web Services location for a DNS resolver. The RTT is calculated at one hour intervals, over a one hour period.

    For lists of the fields returned with each query type and more information about how each type of query is performed, see Using the Amazon CloudWatch Internet Monitor query interface in the Amazon CloudWatch Internet Monitor User Guide.

  • filter_parameters (Optional[FilterParameters], default: None ) –

    The FilterParameters field that you use with Amazon CloudWatch Internet Monitor queries is a string the defines how you want a query to be filtered. The filter parameters that you can specify depend on the query type, since each query type returns a different set of Internet Monitor data.

    For more information about specifying filter parameters, see Using the Amazon CloudWatch Internet Monitor query interface in the Amazon CloudWatch Internet Monitor User Guide.

  • linked_account_id (Optional[AccountId], default: None ) –

    The account ID for an account that you've set up cross-account sharing for in Amazon CloudWatch Internet Monitor. You configure cross-account sharing by using Amazon CloudWatch Observability Access Manager. For more information, see Internet Monitor cross-account observability in the Amazon CloudWatch Internet Monitor User Guide.

Raises:

Source code in docs_src/capo_internetmonitor/_services/async_internet_monitor.py
async def start_query(
    self,
    monitor_name: "capo_internetmonitor.types.resource_name.ResourceName",
    start_time: datetime.datetime,
    end_time: datetime.datetime,
    query_type: "capo_internetmonitor.types.query_type.QueryType",
    *,
    config_overrides: Optional[AsyncInternetMonitorClientConfig] = None,
    filter_parameters: Optional[
        "capo_internetmonitor.types.filter_parameters.FilterParameters"
    ] = None,
    linked_account_id: Optional[
        "capo_internetmonitor.types.account_id.AccountId"
    ] = None,
) -> "capo_internetmonitor.types.start_query_output.StartQueryOutput":
    """<p>Start a query to return data for a specific query type for the Amazon CloudWatch Internet Monitor query interface. Specify a time period for the data that you want returned by using <code>StartTime</code> and <code>EndTime</code>. You filter the query results to return by providing parameters that you specify with <code>FilterParameters</code>.</p> <p>For more information about using the query interface, including examples, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-IM-view-cw-tools-cwim-query.html">Using the Amazon CloudWatch Internet Monitor query interface</a> in the Amazon CloudWatch Internet Monitor User Guide.</p>

    Args:
        monitor_name: <p>The name of the monitor to query.</p>
        start_time: <p>The timestamp that is the beginning of the period that you want to retrieve data for with your query.</p>
        end_time: <p>The timestamp that is the end of the period that you want to retrieve data for with your query.</p>
        query_type: <p>The type of query to run. The following are the three types of queries that you can run using the Internet Monitor query interface:</p> <ul> <li> <p> <code>MEASUREMENTS</code>: Provides availability score, performance score, total traffic, and round-trip times, at 5 minute intervals.</p> </li> <li> <p> <code>TOP_LOCATIONS</code>: Provides availability score, performance score, total traffic, and time to first byte (TTFB) information, for the top location and ASN combinations that you're monitoring, by traffic volume.</p> </li> <li> <p> <code>TOP_LOCATION_DETAILS</code>: Provides TTFB for Amazon CloudFront, your current configuration, and the best performing EC2 configuration, at 1 hour intervals.</p> </li> <li> <p> <code>OVERALL_TRAFFIC_SUGGESTIONS</code>: Provides TTFB, using a 30-day weighted average, for all traffic in each Amazon Web Services location that is monitored.</p> </li> <li> <p> <code>OVERALL_TRAFFIC_SUGGESTIONS_DETAILS</code>: Provides TTFB, using a 30-day weighted average, for each top location, for a proposed Amazon Web Services location. Must provide an Amazon Web Services location to search.</p> </li> <li> <p> <code>ROUTING_SUGGESTIONS</code>: Provides the predicted average round-trip time (RTT) from an IP prefix toward an Amazon Web Services location for a DNS resolver. The RTT is calculated at one hour intervals, over a one hour period.</p> </li> </ul> <p>For lists of the fields returned with each query type and more information about how each type of query is performed, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-IM-view-cw-tools-cwim-query.html"> Using the Amazon CloudWatch Internet Monitor query interface</a> in the Amazon CloudWatch Internet Monitor User Guide.</p>
        filter_parameters: <p>The <code>FilterParameters</code> field that you use with Amazon CloudWatch Internet Monitor queries is a string the defines how you want a query to be filtered. The filter parameters that you can specify depend on the query type, since each query type returns a different set of Internet Monitor data.</p> <p>For more information about specifying filter parameters, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-IM-view-cw-tools-cwim-query.html">Using the Amazon CloudWatch Internet Monitor query interface</a> in the Amazon CloudWatch Internet Monitor User Guide.</p>
        linked_account_id: <p>The account ID for an account that you've set up cross-account sharing for in Amazon CloudWatch Internet Monitor. You configure cross-account sharing by using Amazon CloudWatch Observability Access Manager. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cwim-cross-account.html">Internet Monitor cross-account observability</a> in the Amazon CloudWatch Internet Monitor User Guide.</p>

    Raises:
        capo_internetmonitor.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient permission to perform this action.</p>
        capo_internetmonitor.errors.internal_server_exception.InternalServerException: <p>An internal error occurred.</p>
        capo_internetmonitor.errors.limit_exceeded_exception.LimitExceededException: <p>The request exceeded a service quota.</p>
        capo_internetmonitor.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_internetmonitor.errors.validation_exception.ValidationException: <p>Invalid request.</p>
        capo_internetmonitor.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_internetmonitor.types.start_query_input.StartQueryInput]",
    ) -> AsyncOperationResponse[
        "capo_internetmonitor.types.start_query_output.StartQueryOutput"
    ]:
        import capo_internetmonitor._operations.internet_monitor20210603.start_query

        (
            output,
            http_response,
        ) = await capo_internetmonitor._operations.internet_monitor20210603.start_query.async_start_query(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartQuery")
    )
    input_: capo_internetmonitor.types.start_query_input.StartQueryInput = {
        "monitor_name": monitor_name,
        "start_time": start_time,
        "end_time": end_time,
        "query_type": query_type,
    }
    if filter_parameters is not None:
        input_["filter_parameters"] = filter_parameters
    if linked_account_id is not None:
        input_["linked_account_id"] = linked_account_id

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output