Skip to content

metrics: include the name of the server#47

Merged
xcoulon merged 1 commit into
codeready-toolchain:masterfrom
xcoulon:mcp_metrics_server_lbl
Jan 28, 2026
Merged

metrics: include the name of the server#47
xcoulon merged 1 commit into
codeready-toolchain:masterfrom
xcoulon:mcp_metrics_server_lbl

Conversation

@xcoulon
Copy link
Copy Markdown
Collaborator

@xcoulon xcoulon commented Jan 27, 2026

all MCP servers will have the same metrics, so let's add a label for the name of the server (here: argocd-mcp-server) to help with our PromQL queries

Signed-off-by: Xavier Coulon xcoulon@redhat.com

Summary by CodeRabbit

  • Chores

    • Ensure container images are rebuilt when bringing services up and update the runtime base image for the final build stage.
    • Enhance metrics instrumentation to include server identification labels for improved observability.
  • Tests

    • Update end-to-end tests to validate metrics now include server identification labels.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 27, 2026

Warning

Rate limit exceeded

@xcoulon has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

Adds a "server" label to two Prometheus metrics and updates middleware, tests, and build config; swaps the final Containerfile base image. No control-flow or error-handling changes.

Changes

Cohort / File(s) Summary
Prometheus Metrics
internal/metrics/metrics.go
Expanded label set for MCPCallsTotal and MCPCallDuration from {method, name, success} to {server, method, name, success}
Metric Instrumentation
internal/server/middleware.go
Added serverName = "argocd-mcp-server" constant and updated metric recording calls to pass the new server label
Tests
test/e2e/server_test.go
Updated metric queries/assertions to include server="argocd-mcp-server" for relevant metrics in HTTP and STDIO branches
Build Task
taskfile.yaml
Podman compose invocation changed to podman-compose up -d --build with explanatory comment to force rebuilds
Container Image
Containerfile
Final stage base image changed from ubi10/ubi-micro to ubi9/ubi-minimal (stage name and other steps preserved)

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • rsoaresd
  • alexeykazakov
  • mfrancisc
  • rajivnathan

Poem

🐰 I hopped into metrics' den,
Added a name for server-when,
Tests now check a steadier tune,
Images rebuilt beneath the moon,
Hooray — small hops make systems mend! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and directly summarizes the main change: adding a server name label to metrics for easier PromQL queries.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread Containerfile
# image to be deployed to the target platform
################################################################################################
FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi10/ubi-micro:latest AS argocd-mcp-server
FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9/ubi-minimal:latest AS argocd-mcp-server
Copy link
Copy Markdown
Collaborator Author

@xcoulon xcoulon Jan 27, 2026

Choose a reason for hiding this comment

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

switching to ubi9-minimal after getting multiple times the following error on GH Action 🤷‍♂️

Trying to pull registry.access.redhat.com/ubi10/ubi-micro:latest...
Error: creating build container: copying system image from manifest list: Source image rejected: None of the signatures were accepted, reasons: 
Signature for digest sha256:5941a9196571ade1959ca204e04acaf579418810fbc967b61436b26814ac5ce9 does not match; 
Signature for digest sha256:5941a9196571ade1959ca204e04acaf579418810fbc967b61436b26814ac5ce9 does not match; 
Signature for digest sha256:4fbdc7571973e6be219cba884e191294a2b8d8d1e0951cacb52cac3582c4e517 does not match; 
Signature for digest sha256:4fbdc7571973e6be219cba884e191294a2b8d8d1e0951cacb52cac3582c4e517 does not match

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

see #48

@xcoulon xcoulon force-pushed the mcp_metrics_server_lbl branch from e168c6b to d376b91 Compare January 28, 2026 08:13
all MCP servers will have the same metrics, so let's
add a label for the name of the server (here: `argocd-mcp-server`)
to help with our PromQL queries

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
@xcoulon xcoulon force-pushed the mcp_metrics_server_lbl branch from d376b91 to 2e4a7c6 Compare January 28, 2026 09:14
Copy link
Copy Markdown
Contributor

@rsoaresd rsoaresd left a comment

Choose a reason for hiding this comment

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

🚀

@xcoulon xcoulon merged commit d641743 into codeready-toolchain:master Jan 28, 2026
6 checks passed
@xcoulon xcoulon deleted the mcp_metrics_server_lbl branch January 28, 2026 10:13
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