Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Await query completed CloudWatch log result #1386

Closed
jasonycw opened this issue Aug 21, 2019 · 4 comments
Closed

Await query completed CloudWatch log result #1386

jasonycw opened this issue Aug 21, 2019 · 4 comments
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.

Comments

@jasonycw
Copy link

/// <para>
/// <code>GetQueryResults</code> does not start a query execution. To run a query, use
/// .
/// </para>

Is there any proper documentation on how to query a completed result?

Expected Behavior

await GetQueryResultsAsync will return a completed query result

Current Behavior

var query = await _cloudWatch.StartQueryAsync(
    new StartQueryRequest
    {
        LogGroupName = _config["SEARCH_LOG_GROUP"],
        StartTime = (long)(DateTime.UtcNow.AddMinutes(-10) - new DateTime(1970, 1, 1)).TotalSeconds,
        EndTime = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds,
        QueryString = "{ $.Level=\"Error\"}",
        Limit = 10
    }, token);

var results = await _cloudWatch.GetQueryResultsAsync(
    new GetQueryResultsRequest
    {
        QueryId = query.QueryId
    }, token);

results will still be in Running status

Your Environment

  • AWSSDK.Core version used: 1.1.0
  • Service assembly and version used: AWSSDK.CloudWatchLogs 3.3.101.13
  • Operating System and version: Windows 10
  • Visual Studio version: 2019 16.2.2
  • Targeted .NET platform: Core 2.1
@klaytaybai
Copy link
Contributor

Hi @jasonycw, as specified in the documentation in the code and the API reference, GetQueryResults may return incomplete results if the status is not "Complete". In this case, users are supposed to retry the operation later to see the final results once the status is "Complete". If you want to stop an ongoing query, you can use the StopQuery operation.

@klaytaybai klaytaybai added closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information. labels Aug 21, 2019
@jasonycw
Copy link
Author

So there is no way to await a completed result and I need to loop GetQueryResultsAsync until I get complete status?

@klaytaybai
Copy link
Contributor

Currently that is correct, but I believe this will be included in the future "waiters" work described in our project section for SDK improvements. #1336

@Ganesh-Prakash
Copy link

Hi Team,
is there any properties or method introduced to check QueryResult status is completed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants