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

Async traces #225

Merged
merged 13 commits into from
Apr 19, 2022
Merged

Async traces #225

merged 13 commits into from
Apr 19, 2022

Conversation

schoren
Copy link
Collaborator

@schoren schoren commented Apr 18, 2022

This PR refactors the test execution and trace polling into two different working queues.

Changes

  • everything

Fixes

  • inconsitencies when querying results

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

server/go/runner.go Outdated Show resolved Hide resolved
server/go/runner_test.go Outdated Show resolved Hide resolved
server/go/trace_poller_test.go Outdated Show resolved Hide resolved
server/go/api_api_service.go Show resolved Hide resolved
server/go/trace_poller.go Outdated Show resolved Hide resolved
@schoren schoren linked an issue Apr 19, 2022 that may be closed by this pull request
@schoren schoren requested a review from povilasv April 19, 2022 14:14
const maxTracePollRetry = 5

func donePollingTraces(job tracePollReq, currentResults TestRunResult) bool {
// we're done if we have the same amount of spans after polling `maxTracePollRetry` times
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. I was thinking of doing something similar.

func (tp tracePoller) requeue(job tracePollReq) {
go func() {
fmt.Printf("requeuing result %s for %d time\n", job.result.ResultId, job.count)
time.Sleep(500 * time.Millisecond)
Copy link
Member

@mathnogueira mathnogueira Apr 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this value and maxTracePollRetry should be configurable (maybe interval and retries options). If the service under test uses a SpanBatchExporter, updates are sent in batches every X seconds. And that interval is configurable by the application.

2.5s works only if the service under test doesn't send tracing logs in batches.

So, let's say the application uses a Batch exporter that sends updates every 10 seconds. At moment X, we have 10 spans in the trace, the application might have generated a few more, but they will only be exported to Jaeger at moment X+10s. However, at moment X+2.5s we will have get traces 5 times and the number of spans haven't changed since moment X, and we will consider the trace complete. However, that is not true. In this case, we must wait at least 10 seconds to consider the trace complete. As this is something that might change from application to application, we should allow the user to define those values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I'll address this in a separated PR, since it kindda works like this and we need to unblock

@schoren schoren merged commit 1291fe0 into main Apr 19, 2022
@schoren schoren deleted the async-traces branch April 19, 2022 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move the test result trace polling from controller to its own thread
3 participants