Add tests for Prometheus metrics endpoint and validation#4185
Add tests for Prometheus metrics endpoint and validation#41850xaravindh merged 6 commits intoagones-dev:mainfrom
Conversation
… metrics setup - Added tests for Prometheus exporter registration and metrics endpoint exposure - Verified all expected metrics are served via /metrics endpoint - Included Stackdriver-only setup test to ensure no panics
|
Build Succeeded 🥳 Build Id: 9386d087-612a-404f-8994-fcf316d51dda The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
|
Build Succeeded 🥳 Build Id: 23068501-53f6-4639-b3c6-97f7f58947be The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
igooch
left a comment
There was a problem hiding this comment.
Looks like this test isn't including the agones_gameserver_allocations_duration_seconds or agones_gameserver_allocations_retry_total. @vicentefb could you confirm which metrics are expected at the allocator endpoint?
Try adding some debug statements (or just use your debugger) to see what metrics the test is testing for:
metricsSet := collectMetricNames(resp)
fmt.Println("GOT", metricsSet)
expectedMetrics := getMetricNames()
fmt.Println("EXPECTED", expectedMetrics)
// Force test to fail so that the above fmt.Println actually prints.
assert.True(t, false)
|
|
||
| } | ||
|
|
||
| func TestSetupMetrics_StackdriverOnly_NoPanic(t *testing.T) { |
There was a problem hiding this comment.
Stackdriver has been deprecated in favor of Google Cloud Monitoring.
As part of a separate issue we should investigate if these configs are still working as intended, or if they need to be updated.
Yeah, those two metrics are also expected at the allocator endpoint as well as metrics listed here: https://agones.dev/site/docs/guides/metrics/ |
| } | ||
| } | ||
|
|
||
| func TestAllocationMetrics(t *testing.T) { |
There was a problem hiding this comment.
@igooch @vicentefb I’ve added a separate test case for these metrics: agones_gameserver_allocations_duration_seconds, agones_gameserver_allocations_retry_total, and agones_gameserver_creation_duration. This should fix the issue with missing metrics in the tests. PR is now ready for review.
|
Build Succeeded 🥳 Build Id: 39b31441-5c49-41f8-9952-7da7117eefa8 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
|
Build Failed 😭 Build Id: 1034ca0f-312c-4550-8da4-0c52d51d32c0 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
|
/gcbrun |
|
Build Succeeded 🥳 Build Id: bce52699-46ed-4e2f-825c-d93dc931153f The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
|
Build Succeeded 🥳 Build Id: 135458f3-06d2-482b-b080-45996e261032 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
What type of PR is this?
/kind cleanup
What this PR does / Why we need it:
Which issue(s) this PR fixes:
Closes #3925
Special notes for your reviewer: