Skip to content

feat: add agentic traffic endpoints to fetch PG data | LLMO-4000#2178

Merged
calvarezg merged 9 commits intomainfrom
feat-LLMO-4000-agentic-traffic
Apr 14, 2026
Merged

feat: add agentic traffic endpoints to fetch PG data | LLMO-4000#2178
calvarezg merged 9 commits intomainfrom
feat-LLMO-4000-agentic-traffic

Conversation

@calvarezg
Copy link
Copy Markdown
Contributor

@calvarezg calvarezg commented Apr 10, 2026

Introduces a new llmo-agentic-traffic controller with 11 site-scoped GET endpoints that query mysticat-data-service via PostgREST, powering the new Postgres-backed Agentic Traffic dashboard.

  • New file src/controllers/llmo/llmo-agentic-traffic.js — 9 handler factories wired to existing DB RPCs (rpc_agentic_traffic_kpis, _kpis_trend, _by_region, _by_category, _by_page_type, _by_status, _by_user_agent, _by_url, _movers), plus
    /filter-dimensions (parallel distinct-value queries) and /weeks (min/max date → ISO week list)
  • Updated llmo-mysticat-controller.js — adds getSiteAndValidateAccess (site → org → LLMO entitlement check) and instantiates all 11 new handlers
  • Updated src/routes/index.js — registers all 11 new routes under GET /sites/:siteId/agentic-traffic/*
  • 100% test coverage on all modified files (63 tests); llmo-mysticat-controller.js getSiteAndValidateAccess path fully exercised

New routes:
GET /sites/:siteId/agentic-traffic/kpis
GET /sites/:siteId/agentic-traffic/kpis-trend
GET /sites/:siteId/agentic-traffic/by-region
GET /sites/:siteId/agentic-traffic/by-category
GET /sites/:siteId/agentic-traffic/by-page-type
GET /sites/:siteId/agentic-traffic/by-status
GET /sites/:siteId/agentic-traffic/by-user-agent
GET /sites/:siteId/agentic-traffic/by-url
GET /sites/:siteId/agentic-traffic/filter-dimensions
GET /sites/:siteId/agentic-traffic/weeks
GET /sites/:siteId/agentic-traffic/movers

Please ensure your pull request adheres to the following guidelines:

  • make sure to link the related issues in this description. Or if there's no issue created, make sure you
    describe here the problem you're solving.
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes

If the PR is changing the API specification:

  • make sure you add a "Not implemented yet" note the endpoint description, if the implementation is not ready
    yet. Ideally, return a 501 status code with a message explaining the feature is not implemented yet.
  • make sure you add at least one example of the request and response.

If the PR is changing the API implementation or an entity exposed through the API:

  • make sure you update the API specification and the examples to reflect the changes.

If the PR is introducing a new audit type:

  • make sure you update the API specification with the type, schema of the audit result and an example

Related Issues

LLMO-4000

This commit introduces a new controller for handling agentic traffic data, including KPIs, trends, and various filters. The following endpoints have been added:

- GET /sites/:siteId/agentic-traffic/kpis
- GET /sites/:siteId/agentic-traffic/kpis-trend
- GET /sites/:siteId/agentic-traffic/by-region
- GET /sites/:siteId/agentic-traffic/by-category
- GET /sites/:siteId/agentic-traffic/by-page-type
- GET /sites/:siteId/agentic-traffic/by-status
- GET /sites/:siteId/agentic-traffic/by-user-agent
- GET /sites/:siteId/agentic-traffic/by-url
- GET /sites/:siteId/agentic-traffic/filter-dimensions
- GET /sites/:siteId/agentic-traffic/weeks
- GET /sites/:siteId/agentic-traffic/movers

Additionally, a new test suite has been added to ensure the functionality of these endpoints. The implementation includes access validation and error handling for improved robustness.
@calvarezg calvarezg changed the title feat: add site-scoped agentic traffic endpoints feat: add agentic traffic endpoints to fetch PG data | LLMO-4000 Apr 10, 2026
@calvarezg calvarezg marked this pull request as draft April 10, 2026 11:42
@calvarezg calvarezg self-assigned this Apr 10, 2026
@calvarezg calvarezg added the enhancement New feature or request label Apr 10, 2026
@github-actions
Copy link
Copy Markdown

This PR will trigger a minor release when merged.

This commit expands the agentic traffic API by adding several new endpoints for site-scoped data retrieval. The following endpoints have been introduced:

- GET /sites/:siteId/agentic-traffic/kpis
- GET /sites/:siteId/agentic-traffic/kpis-trend
- GET /sites/:siteId/agentic-traffic/by-region
- GET /sites/:siteId/agentic-traffic/by-category
- GET /sites/:siteId/agentic-traffic/by-page-type
- GET /sites/:siteId/agentic-traffic/by-status
- GET /sites/:siteId/agentic-traffic/by-user-agent
- GET /sites/:siteId/agentic-traffic/by-url
- GET /sites/:siteId/agentic-traffic/filter-dimensions
- GET /sites/:siteId/agentic-traffic/weeks
- GET /sites/:siteId/agentic-traffic/movers

These endpoints are intended for UI use and are not yet required for server-to-server interactions.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@calvarezg calvarezg marked this pull request as ready for review April 13, 2026 07:56
@calvarezg calvarezg merged commit 32ca5e0 into main Apr 14, 2026
18 checks passed
@calvarezg calvarezg deleted the feat-LLMO-4000-agentic-traffic branch April 14, 2026 12:30
solaris007 pushed a commit that referenced this pull request Apr 14, 2026
# [1.437.0](v1.436.12...v1.437.0) (2026-04-14)

### Features

* add agentic traffic endpoints to fetch PG data | LLMO-4000 ([#2178](#2178)) ([32ca5e0](32ca5e0))
@solaris007
Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.437.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants