Skip to content

feat: add the TInyBird resources for the search volume data #3178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

borfast
Copy link
Collaborator

@borfast borfast commented Jun 13, 2025

Ticket in Linear

This adds the TinyBird data source and pipe with the respective endpoint for the search volume data, to be consumed by the Insights application.

Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
@borfast borfast self-assigned this Jun 13, 2025
@borfast borfast marked this pull request as ready for review June 13, 2025 11:50
@borfast borfast requested a review from epipav as a code owner June 13, 2025 11:50
@borfast borfast marked this pull request as draft June 13, 2025 15:33
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
Copy link
Collaborator

@epipav epipav left a comment

Choose a reason for hiding this comment

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

added a few nitpicks and some consistency points

@@ -0,0 +1,12 @@
SCHEMA >
`id` UInt64 `json:$.record.id`,
`projectId` UUID `json:$.record.project_id`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT: can we call this insightsProjectId to be consistent with the rest?

Copy link
Collaborator Author

@borfast borfast Jun 16, 2025

Choose a reason for hiding this comment

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

Sure, no problem.

NODE searchVolume_pipe
SQL >
%
SELECT projectId, keyword, dataTimestamp, volume, updatedAt
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT: same naming nitpick as above


ENGINE ReplacingMergeTree
ENGINE_PARTITION_KEY toYear(dataTimestamp)
ENGINE_SORTING_KEY projectId
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can add dataTimestamp to the sorting key - since queries will filter out first by insightsProjectId and timestamp, I'm guessing it's gonna help with filtering performance

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. In fact, the project ID will probably not help much here at all, since we're going to query by keyword (the project slug), not project ID, so I think removing the project ID from here is even better.

SQL >
%
SELECT projectId, keyword, dataTimestamp, volume, updatedAt
FROM searchVolume
Copy link
Collaborator

Choose a reason for hiding this comment

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

You probably want FINAL here since the engine is ReplacingMergeTree in the source

)
}}
{% end %}
{% if defined(projectId) %} AND searchVolume.projectId = {{ projectId }} {% end %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT: It's gonna help with consistency and usability of the pipe if we provide a project slug filter instead of an opaque id filter here. (since everywhere else FE expects this filtering to be done by slug)

There's a reusable example here
Another benefit of using segments_filtered pipe for this is that it provides insightsProjects.enabled check as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The keyword filter below this one is actually the slug. I'll change the name, it doesn't make sense to use the syntax from Keywords Everywhere here.

@borfast borfast force-pushed the feature/ins-658-search-volume-tinybird-resources branch from d7cf633 to 8726d7d Compare June 17, 2025 17:23
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
@borfast borfast force-pushed the feature/ins-658-search-volume-tinybird-resources branch from 8726d7d to 97d233e Compare June 17, 2025 17:55
borfast added 2 commits June 18, 2025 12:01
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
@borfast borfast marked this pull request as ready for review June 20, 2025 15:28
@borfast
Copy link
Collaborator Author

borfast commented Jun 20, 2025

@epipav , can you review this again, please?

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

Successfully merging this pull request may close these issues.

2 participants