Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Conversation

@mattjohnsonpint
Copy link
Contributor

  • Remove agents from health endpoint (causing perf issues, and not needed)
  • Add go version and kubernetes namespace to health endpoint
  • Optimizations / cleanup

@mattjohnsonpint mattjohnsonpint requested review from a team and Copilot July 3, 2025 17:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactors the health endpoint to remove agent details, introduce Go version and Kubernetes namespace fields, and centralize JSON object construction, while caching the namespace lookup for performance.

  • Added a reusable MakeJsonObject utility and KeyValuePair type.
  • Updated health handler to use the new JSON helper, removed agents list, and added go_version and optional kubernetes_namespace.
  • Wrapped the Kubernetes namespace lookup in a sync.OnceValues cache and updated the changelog.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
runtime/utils/json.go Introduce KeyValuePair and MakeJsonObject for manual JSON assembly
runtime/httpserver/health.go Refactor health endpoint to use MakeJsonObject, remove agents, and add go_version & namespace
runtime/app/app.go Cache Kubernetes namespace lookup with sync.OnceValues
runtime/actors/agents.go Remove deprecated ListLocalAgents function
CHANGELOG.md Added entry for the health endpoint update
Comments suppressed due to low confidence (4)

runtime/httpserver/health.go:27

  • [nitpick] Changing the field key from "version" to "app_version" may break existing consumers; consider retaining the original key or clearly documenting this breaking change.
		{Key: "app_version", Value: app.VersionNumber()},

runtime/httpserver/health.go:28

  • Introduce unit tests to verify the "go_version" field is present and correctly reflects the runtime.Version() output in the health endpoint response.
		{Key: "go_version", Value: runtime.Version()},

runtime/httpserver/health.go:31

  • Add tests to cover the optional "kubernetes_namespace" field, ensuring it appears only when the namespace lookup succeeds.
		data = append(data, utils.KeyValuePair{Key: "kubernetes_namespace", Value: ns})

runtime/httpserver/health.go:34

  • [nitpick] Pretty-printing the health JSON adds CPU overhead per request; consider using compact output in high-throughput scenarios or making pretty-printing configurable.
	_, _ = w.Write(utils.MakeJsonObject(data, true))

@mattjohnsonpint mattjohnsonpint enabled auto-merge (squash) July 3, 2025 18:01
@mattjohnsonpint mattjohnsonpint merged commit 72bb2d4 into main Jul 3, 2025
33 checks passed
@mattjohnsonpint mattjohnsonpint deleted the mjp/health-endpoint branch July 3, 2025 18:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants