Skip to content

Add performance metrics to controllers#499

Merged
dgkanatsios merged 4 commits intomainfrom
copilot/add-performance-metrics-to-controllers
Mar 23, 2026
Merged

Add performance metrics to controllers#499
dgkanatsios merged 4 commits intomainfrom
copilot/add-performance-metrics-to-controllers

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 21, 2026

Controllers lacked timing metrics for reconciliation operations.

New Prometheus histograms

  • thundernetes_gameserver_reconcile_duration_seconds — GameServer controller reconcile latency
  • thundernetes_gameserverbuild_reconcile_duration_seconds (BuildName) — GameServerBuild controller reconcile latency

All use prometheus.DefBuckets and register via promauto.With(metrics.Registry), consistent with existing metrics.

Instrumentation points

  • GameServerReconciler.Reconciledefer at method entry
  • GameServerBuildReconciler.Reconciledefer after fetching the GSB (so BuildName label is available)

Per-operation creation/deletion duration metrics were intentionally omitted since individual K8s API calls are very fast and those values would be close to zero. The reconciliation duration histograms already capture the full picture including all batch creation/deletion time.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add metrics to controllers </issue_title>
<issue_description>We should add performance metrics to controllers. Like how much time it took to reconcile, to create/delete X number of GameServers etc</issue_description>

Comments on the Issue (you are @copilot in this section)


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

…lers

Add Prometheus histogram metrics to track:
- GameServer controller reconciliation duration
- GameServerBuild controller reconciliation duration
- Individual GameServer creation duration
- Individual GameServer deletion duration

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Agent-Logs-Url: https://github.com/PlayFab/thundernetes/sessions/7e3c4e94-d118-43dd-9d35-d93f02f2f5c5
Copilot AI changed the title [WIP] Add performance metrics to controllers Add performance metrics to controllers Mar 21, 2026
Copilot AI requested a review from dgkanatsios March 21, 2026 22:00
@dgkanatsios dgkanatsios marked this pull request as ready for review March 23, 2026 21:06
@dgkanatsios
Copy link
Copy Markdown
Collaborator

@copilot the reconciliation metrics seem OK, but the creation/deletion metrics should be close to zero, as the call to K8s API server should be really fast. What do you think?

Individual K8s API calls for GameServer creation/deletion are very fast,
so per-operation duration metrics would be close to zero and not useful.
The reconciliation duration histograms already capture the full picture
including all batch creation/deletion time.

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Agent-Logs-Url: https://github.com/PlayFab/thundernetes/sessions/6c0ae221-390f-45ce-a2ee-3a4d1cfdb8e8
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 23, 2026

@copilot the reconciliation metrics seem OK, but the creation/deletion metrics should be close to zero, as the call to K8s API server should be really fast. What do you think?

You're right — individual K8s API calls for creation/deletion are very fast, so those per-operation duration metrics would be near zero and not useful. Removed GameServerCreationDuration and GameServerDeletionDuration in 1e66795, keeping only the reconciliation duration histograms which already capture the full picture including all batch creation/deletion time.

@dgkanatsios dgkanatsios merged commit 99a7016 into main Mar 23, 2026
7 checks passed
@dgkanatsios dgkanatsios deleted the copilot/add-performance-metrics-to-controllers branch March 23, 2026 21:41
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.

Add metrics to controllers

2 participants