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

Add instance_stats background job #663

Merged
merged 1 commit into from
Aug 2, 2023
Merged

Add instance_stats background job #663

merged 1 commit into from
Aug 2, 2023

Conversation

skoeva
Copy link
Contributor

@skoeva skoeva commented Jul 28, 2023

Following #656 where we add the instance_stats table, we now implement a background task that populates this table every hour, with the purpose of committing a snapshot of live instance counts to the new database table. This task, using a Go ticker, is started at service startup and runs for the whole lifetime of the Nebraska server until it is stopped.

@skoeva skoeva marked this pull request as ready for review July 31, 2023 12:46
@skoeva skoeva force-pushed the skoeva/bg_job branch 2 times, most recently from ed51b88 to b362a95 Compare July 31, 2023 12:59
@skoeva skoeva marked this pull request as draft July 31, 2023 13:06
@skoeva skoeva requested review from pothos and yolossn July 31, 2023 22:45
backend/pkg/server/server.go Outdated Show resolved Hide resolved
Following #656 where we add the `instance_stats` table, we now implement a background task that populates this table every hour, with the purpose of committing a snapshot of live instance counts to the new database table. This task, using a Go ticker, is started at service startup and runs for the whole lifetime of the Nebraska server until it is stopped.
@skoeva skoeva marked this pull request as ready for review August 2, 2023 12:35
@skoeva skoeva removed the request for review from yolossn August 2, 2023 12:38
@skoeva skoeva merged commit 3eddf31 into main Aug 2, 2023
2 checks passed
@pothos pothos deleted the skoeva/bg_job branch August 2, 2023 16:06
skoeva added a commit that referenced this pull request Aug 7, 2023
Following #663 where we add the background job to periodically populate the instance_stats table, we want to ensure that we generate entries for instances that may not check in hourly but are still active. Thus, we consider a 2-hour default interval for instances checking in, maintaining the hourly cadence of the background job as desired.
skoeva added a commit that referenced this pull request Aug 11, 2023
author Evangelos Skopelitis <eas458@cornell.edu> 1690946509 -0400
committer Evangelos Skopelitis <eas458@cornell.edu> 1691771003 -0400

parent b641c2b
author Evangelos Skopelitis <eas458@cornell.edu> 1690946509 -0400
committer Evangelos Skopelitis <eas458@cornell.edu> 1691770975 -0400

Defined endpoints, registered handler, added func

Commented out JSON metrics endpoint spec

backend: Use UTC for instance stats default time

The time.Now() function uses the local time which causes a mismatch
and no entries get created when, e.g., being two hours ahead because
the instance would be checking in at 10 UTC but it gets compared to
12 local time and in this time span nothing is able to check in because
the local time will always be too far ahead.
Use the right time zone for the default time of the instance stats
query.

Added gauge metric and testing

Updated handler

Added custom registry and handler

Cosmetic changes

Adding JSON endpoint

Debugging

Removing unnecessary test

parent b641c2b
author Evangelos Skopelitis <eas458@cornell.edu> 1690946509 -0400
committer Evangelos Skopelitis <eas458@cornell.edu> 1691764647 -0400

Defined endpoints, registered handler, added func

Commented out JSON metrics endpoint spec

Added gauge metric and testing

Added custom registry and handler

Cosmetic changes

Adding JSON endpoint

Debugging

Removing unnecessary test

backend: Use UTC for instance stats default time

The time.Now() function uses the local time which causes a mismatch
and no entries get created when, e.g., being two hours ahead because
the instance would be checking in at 10 UTC but it gets compared to
12 local time and in this time span nothing is able to check in because
the local time will always be too far ahead.
Use the right time zone for the default time of the instance stats
query.

Added gauge metric and testing

Cosmetic changes

Adding JSON endpoint

Debugging

Removing unnecessary test

backend: Change default interval for instance stats query

Following #663 where we add the background job to periodically populate the instance_stats table, we want to ensure that we generate entries for instances that may not check in hourly but are still active. Thus, we consider a 2-hour default interval for instances checking in, maintaining the hourly cadence of the background job as desired.

Removing another unnecessary test
skoeva added a commit that referenced this pull request Aug 11, 2023
Commented out JSON metrics endpoint spec

backend: Use UTC for instance stats default time

The time.Now() function uses the local time which causes a mismatch
and no entries get created when, e.g., being two hours ahead because
the instance would be checking in at 10 UTC but it gets compared to
12 local time and in this time span nothing is able to check in because
the local time will always be too far ahead.
Use the right time zone for the default time of the instance stats
query.

Added gauge metric and testing

Updated handler

Added custom registry and handler

Cosmetic changes

Adding JSON endpoint

Debugging

Removing unnecessary test

backend: Change default interval for instance stats query

Following #663 where we add the background job to periodically populate the instance_stats table, we want to ensure that we generate entries for instances that may not check in hourly but are still active. Thus, we consider a 2-hour default interval for instances checking in, maintaining the hourly cadence of the background job as desired.

Removing another unnecessary test
skoeva added a commit that referenced this pull request Aug 11, 2023
Commented out JSON metrics endpoint spec

backend: Use UTC for instance stats default time

The time.Now() function uses the local time which causes a mismatch
and no entries get created when, e.g., being two hours ahead because
the instance would be checking in at 10 UTC but it gets compared to
12 local time and in this time span nothing is able to check in because
the local time will always be too far ahead.
Use the right time zone for the default time of the instance stats
query.

Added gauge metric and testing

Updated handler

Added custom registry and handler

Cosmetic changes

Adding JSON endpoint

Debugging

Removing unnecessary test

backend: Change default interval for instance stats query

Following #663 where we add the background job to periodically populate the instance_stats table, we want to ensure that we generate entries for instances that may not check in hourly but are still active. Thus, we consider a 2-hour default interval for instances checking in, maintaining the hourly cadence of the background job as desired.

Removing another unnecessary test
skoeva added a commit that referenced this pull request Aug 11, 2023
Commented out JSON metrics endpoint spec

backend: Use UTC for instance stats default time

The time.Now() function uses the local time which causes a mismatch
and no entries get created when, e.g., being two hours ahead because
the instance would be checking in at 10 UTC but it gets compared to
12 local time and in this time span nothing is able to check in because
the local time will always be too far ahead.
Use the right time zone for the default time of the instance stats
query.

Added gauge metric and testing

Updated handler

Added custom registry and handler

Cosmetic changes

Adding JSON endpoint

Debugging

Removing unnecessary test

backend: Change default interval for instance stats query

Following #663 where we add the background job to periodically populate the instance_stats table, we want to ensure that we generate entries for instances that may not check in hourly but are still active. Thus, we consider a 2-hour default interval for instances checking in, maintaining the hourly cadence of the background job as desired.

Removing another unnecessary test
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.

2 participants