Skip to content

feat: add metrics tracking http request#10

Merged
frac merged 1 commit into
mainfrom
add-metrics
Mar 6, 2026
Merged

feat: add metrics tracking http request#10
frac merged 1 commit into
mainfrom
add-metrics

Conversation

@phvalguima
Copy link
Copy Markdown

No description provided.

@phvalguima phvalguima marked this pull request as draft March 6, 2026 09:52
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Copy Markdown

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

Adds OpenTelemetry metrics instrumentation to track counts and durations of outbound model (LLM) calls and MCP tool calls, improving observability of the responses server’s external dependencies.

Changes:

  • Introduce a shared metrics module (src/lib/metrics.ts) defining counters and histograms for model calls and MCP tool calls.
  • Record model call duration/count (tagged with status code + model name) in handleOneTurnStream.
  • Record MCP tool call duration/count (tagged with status code + tool/server identifiers) in callMcpTool, and extend the OTEL mock in tests to support metrics.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/routes/responses/handleOneTurn.ts Records model-call counter + duration around streamed LLM calls.
src/routes/responses/handleOneTurn.test.ts Extends OpenTelemetry mock to include metrics.getMeter() and instruments.
src/mcp.ts Records MCP tool-call counter + duration around MCP calls.
src/lib/metrics.ts Defines OpenTelemetry meter instruments for model/MCP metrics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/routes/responses/handleOneTurn.ts
Comment thread src/routes/responses/handleOneTurn.ts Outdated
Comment thread src/mcp.ts Outdated
Comment thread src/routes/responses/handleOneTurn.test.ts
@phvalguima phvalguima marked this pull request as ready for review March 6, 2026 14:49
@frac frac merged commit 6cea26b into main Mar 6, 2026
9 checks passed
@frac frac deleted the add-metrics branch March 6, 2026 15:06
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.

3 participants