Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

don't register stackdriver metrics on every instance start #1548

Closed
mikehelmick opened this issue Aug 16, 2021 · 4 comments · Fixed by #1549
Closed

don't register stackdriver metrics on every instance start #1548

mikehelmick opened this issue Aug 16, 2021 · 4 comments · Fixed by #1549
Assignees

Comments

@mikehelmick
Copy link
Contributor

TL;DR

Registering on every instance start causes us to get throttled on the stackdriver API and can cause errors on startup.

@mikehelmick mikehelmick self-assigned this Aug 16, 2021
@sethvargo
Copy link
Member

I think there's a few ways we could do this:

  1. Move the metrics registration process into its own binary that we execute as part of the build/deploy steps. This ensures it happens once per deploy (which is what we really want). I think I prefer this approach.

  2. Move the metrics creation back into Terraform. It started this way, but became unsustainable to keep them in sync. Now that metrics creation is rare, we could move it back. It would be ugly, since we'd have to terraform import all the existing metrics.

  3. Establish a lower-level connection to Redis and write the current build-id somewhere. If no value exists, do the registration. This has some complex edge cases. It makes connecting to Redis a SPOF for startups, but we already have that. Another challenge is that we can't use a nice client here, because we don't establish the client until after metrics have been registered (since the client emits metrics).

Other ideas?

@mikehelmick
Copy link
Contributor Author

mikehelmick commented Aug 16, 2021

I was thinking something along the lines of 1

Separate binary, but deployed as a service.
So when it's deployed, and the container starts, the metrics will register.

@sethvargo
Copy link
Member

Ah - and then set min/max instances to 1?

@sethvargo sethvargo assigned sethvargo and unassigned mikehelmick Aug 17, 2021
@sethvargo
Copy link
Member

#1549

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants