Skip to content

Add shutdown delay and e2e test#3395

Merged
joe-elliott merged 4 commits intografana:mainfrom
joe-elliott:shutdown-delay
Feb 15, 2024
Merged

Add shutdown delay and e2e test#3395
joe-elliott merged 4 commits intografana:mainfrom
joe-elliott:shutdown-delay

Conversation

@joe-elliott
Copy link
Copy Markdown
Collaborator

What this PR does:
Adds a shutdown delay configurable parameter modeled after mimir:

grafana/mimir#3298

After receiving SIGTERM Tempo will drop its readiness handler and wait the configured seconds. In a k8s environment this will allow Tempo to cleanly roll its frontend without dropping queries.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Comment thread cmd/tempo/app/config.go
Copy link
Copy Markdown
Member

@electron0zero electron0zero left a comment

Choose a reason for hiding this comment

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

one small Q, rest lgtm 👍🏼

Comment thread integration/e2e/e2e_test.go Outdated
// confirm the readiness flag is down
res, err := e2e.DoGet("http://" + tempo.Endpoint(3200) + "/ready")
require.NoError(t, err)
require.Equal(t, http.StatusServiceUnavailable, res.StatusCode)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps perform a query before and after to confirm the change in behavior.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added a comment to help clarify that the /ready point is confirmed to be up before we stop tempo

Comment thread cmd/tempo/app/app.go
t.Server.SetKeepAlivesEnabled(false)

if t.cfg.ShutdownDelay > 0 {
time.Sleep(t.cfg.ShutdownDelay)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we also want to sleep when there are no requests in flight?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i'm concerned about the complexity about that change. this is a very simple one that will do nearly all of what we want with some config choices in k8s

Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Copy link
Copy Markdown
Contributor

@zalegrala zalegrala left a comment

Choose a reason for hiding this comment

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

Its a step in the right direction.

@joe-elliott joe-elliott merged commit 4f53eb9 into grafana:main Feb 15, 2024
yvrhdn pushed a commit to yvrhdn/tempo that referenced this pull request Feb 26, 2024
* Add shutdown delay and e2e test

Signed-off-by: Joe Elliott <number101010@gmail.com>

* changelog

Signed-off-by: Joe Elliott <number101010@gmail.com>

* determinism + comment

Signed-off-by: Joe Elliott <number101010@gmail.com>

* .Stop in a different goroutine then .Start creates a race

Signed-off-by: Joe Elliott <number101010@gmail.com>

---------

Signed-off-by: Joe Elliott <number101010@gmail.com>
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.

3 participants