Skip to content

start_telemetry_query

start_telemetry_query(
    query_string: str,
    session_id: str,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
) -> StartTelemetryQueryResponse

Starts a telemetry query within a session. Submits the provided query string for execution in the specified session. Use GetTelemetryQueryResults to poll for results and check query status.

Parameters:

  • query_string (str) –

    The query string to execute.

  • session_id (str) –

    The unique ID of the session.

Raises:

Examples:

Start a telemetry query The following example submits a SQL query within a session and returns the query ID used to poll for results. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> client.start_telemetry_query(session_id='9f8c7d6e-5b4a-4c3d-9e2f-1a0b2c3d4e5f', query_string='SELECT `@timestamp`, `@message` FROM "logs.default" WHERE `@timestamp` BETWEEN NOW() - INTERVAL \'1 HOUR\' AND NOW() ORDER BY `@timestamp` DESC LIMIT 100')
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
def start_telemetry_query(
    self,
    query_string: str,
    session_id: str,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
) -> "capo_cloudwatchomni.types.start_telemetry_query_response.StartTelemetryQueryResponse":
    r"""Starts a telemetry query within a session. Submits the provided query string for execution in the specified session. Use GetTelemetryQueryResults to poll for results and check query status.

    Args:
        query_string: The query string to execute.
        session_id: The unique ID of the session.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Start a telemetry query
        The following example submits a SQL query within a session and returns the query ID used to poll for results. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> client.start_telemetry_query(session_id='9f8c7d6e-5b4a-4c3d-9e2f-1a0b2c3d4e5f', query_string='SELECT `@timestamp`, `@message` FROM "logs.default" WHERE `@timestamp` BETWEEN NOW() - INTERVAL \'1 HOUR\' AND NOW() ORDER BY `@timestamp` DESC LIMIT 100')
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatchomni.types.start_telemetry_query_request.StartTelemetryQueryRequest]",
    ) -> OperationResponse[
        "capo_cloudwatchomni.types.start_telemetry_query_response.StartTelemetryQueryResponse"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.start_telemetry_query

        output, http_response = (
            capo_cloudwatchomni._operations.cloud_watch_omni_frontend.start_telemetry_query.start_telemetry_query(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartTelemetryQuery")
    )
    input_: capo_cloudwatchomni.types.start_telemetry_query_request.StartTelemetryQueryRequest = {
        "query_string": query_string,
        "session_id": session_id,
    }

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