Skip to content

Add request_source field - #19

Open
Gutts-n wants to merge 1 commit into
mainfrom
feat/request-source-field
Open

Add request_source field#19
Gutts-n wants to merge 1 commit into
mainfrom
feat/request-source-field

Conversation

@Gutts-n

@Gutts-n Gutts-n commented Aug 26, 2026

Copy link
Copy Markdown

What changed

Records a new request_source field on every analytics event emitted by
AnalyticsMiddleware, read from the Request-Source request header.
None when the header is absent (the common case).

Why

Part of the NESO API-usage-metrics work (neso-nextgen-shared#152). Data
Explorer already sends Request-Source: data-explorer on its calls to this
service (see neso-nextgen-shared#145). Without capturing that header in the
event payload, there is no way to tell Data Explorer traffic apart from
genuine external API use downstream, so it inflates the usage figures.

This only adds the field to the event shape - filtering it out of the
dashboards happens in neso-monitoring. Same change was also made to
ckanext-analytics for the CKAN Action API side (datopian/ckanext-analytics#1),
since the two services feed one shared BigQuery table.

Verified

  • pytest - 481 passed.
  • ruff check - clean.
  • Added two new tests: header present -> value recorded, header absent ->
    None.

Not verified: end-to-end against a live pipeline (Loki -> BigQuery -> Grafana).

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e0bcdd4-64ac-4d49-b534-3f5e266a1db3


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