agones icon indicating copy to clipboard operation
agones copied to clipboard

Add tests for Prometheus metrics endpoint and validation

Open 0xaravindh opened this issue 7 months ago • 7 comments

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking /kind bug

/kind cleanup

/kind documentation /kind feature /kind hotfix /kind release

What this PR does / Why we need it:

  • 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

Which issue(s) this PR fixes:

Closes #3925

Special notes for your reviewer:

0xaravindh avatar May 22 '25 09:05 0xaravindh

Build Succeeded :partying_face:

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):

  • https://67da16b-dot-preview-dot-agones-images.appspot.com/

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4185/head:pr_4185 && git checkout pr_4185
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.50.0-dev-67da16b

agones-bot avatar May 22 '25 10:05 agones-bot

Build Succeeded :partying_face:

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):

  • https://d097ea8-dot-preview-dot-agones-images.appspot.com/

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4185/head:pr_4185 && git checkout pr_4185
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.50.0-dev-d097ea8

agones-bot avatar Jun 02 '25 22:06 agones-bot

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)

Yeah, those two metrics are also expected at the allocator endpoint as well as metrics listed here: https://agones.dev/site/docs/guides/metrics/

vicentefb avatar Jun 04 '25 16:06 vicentefb

Build Succeeded :partying_face:

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):

  • https://cbf1045-dot-preview-dot-agones-images.appspot.com/

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4185/head:pr_4185 && git checkout pr_4185
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.50.0-dev-cbf1045

agones-bot avatar Jun 13 '25 09:06 agones-bot

Build Failed :sob:

Build Id: 1034ca0f-312c-4550-8da4-0c52d51d32c0

Status: FAILURE

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

agones-bot avatar Jun 13 '25 16:06 agones-bot

/gcbrun

0xaravindh avatar Jun 13 '25 17:06 0xaravindh

Build Succeeded :partying_face:

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):

  • https://2acecd1-dot-preview-dot-agones-images.appspot.com/

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4185/head:pr_4185 && git checkout pr_4185
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.50.0-dev-2acecd1

agones-bot avatar Jun 13 '25 18:06 agones-bot

Build Succeeded :partying_face:

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):

  • https://837d684-dot-preview-dot-agones-images.appspot.com/

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4185/head:pr_4185 && git checkout pr_4185
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.51.0-dev-837d684

agones-bot avatar Jun 20 '25 07:06 agones-bot