Skip to content

feat(analytics): enhance endpoint metrics calculations and queries fo… - #26

Merged
li4nee merged 1 commit into
mainfrom
staging
Jul 10, 2026
Merged

li4nee merged 1 commit into
mainfrom
staging

Conversation

@li4nee

@li4nee li4nee commented Jul 10, 2026 •

Copy link
Copy Markdown
Owner

…r accuracy

Summary by CodeRabbit

  • Bug Fixes
    • Improved analytics accuracy by correctly handling aggregated metrics and latency values.
    • Fixed endpoint summaries to calculate hit counts, error rates, and latency statistics reliably.
    • Improved “top endpoints” rankings, including average-latency sorting and grouped metric calculations.

@li4nee
li4nee merged commit 21288fa into main Jul 10, 2026
2 checks passed
@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f681e11-bb2e-4406-869f-860d15e9895b

📥 Commits

Reviewing files that changed from the base of the PR and between f55faca and 86679d2.

📒 Files selected for processing (2)
  • server/src/modules/analytics/services/analytics.service.ts
  • server/src/modules/processor/repos/endpointMetrics.repo.ts

📝 Walkthrough

Walkthrough

Top-endpoint queries now use explicit aggregate projections and aggregate-safe average-latency ordering. Endpoint summary mapping converts PostgreSQL aggregate results to numbers before calculating derived metrics.

Changes

Endpoint metrics

Layer / File(s) Summary
Aggregate endpoint metric queries
server/src/modules/processor/repos/endpointMetrics.repo.ts
Top-endpoint queries explicitly aggregate metric fields, derive grouped metadata with MAX(...), set id to 0, and calculate average latency from summed values.
Numeric endpoint summaries
server/src/modules/analytics/services/analytics.service.ts
PostgreSQL aggregate results are coerced to numbers before calculating average latency and error rate or returning summary fields.

Estimated code review effort: 3 (Moderate) | ~20 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch staging

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.

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.

1 participant