-
Notifications
You must be signed in to change notification settings - Fork 2
Add Algolia plugin #67
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
andrewmumblebee
wants to merge
9
commits into
main
Choose a base branch
from
work/ah/algolia
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1bb21ff
Add Algolia plugin
andrewmumblebee bf3bee8
Update Algolia icon
andrewmumblebee f4724ba
tweak algolia icon alignment
andrewmumblebee 2eb7ac7
fix algoliaIndex tile sizing and placement
andrewmumblebee 25cca2b
Swap baseUrl for Algolia plugin dataStreams to reduce duplication
andrewmumblebee 6ef8027
Remove test edits and add tags
andrewmumblebee e4473e5
Rename Algolia sourceType to Index as per guidelines
andrewmumblebee 24ddd4e
Add algolia codeowner
andrewmumblebee d072d87
Update object types
andrewmumblebee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "steps": [ | ||
| { | ||
| "displayName": "Authenticate", | ||
| "dataStream": { "name": "indexes" }, | ||
| "required": true, | ||
| "error": "Could not connect to Algolia. Check your Application ID is correct and that your API key has the 'listIndexes' ACL (a Search-Only key will not work).", | ||
| "success": "Connected to Algolia." | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [ | ||
| { | ||
| "name": "Index", | ||
| "sourceType": "Index", | ||
| "icon": "magnifying-glass", | ||
| "singular": "Index", | ||
| "plural": "Indices" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| { | ||
| "name": "indexes", | ||
| "displayName": "Indices", | ||
| "description": "Algolia indices in the application, with record counts, sizes, last build time and pending tasks", | ||
| "tags": ["Indices"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "baseUrl": "https://{{dataSource.applicationId}}.algolia.net", | ||
| "httpMethod": "get", | ||
| "endpointPath": "/1/indexes", | ||
| "pathToData": "items", | ||
| "paging": { "mode": "none" } | ||
| }, | ||
| "matches": "none", | ||
| "metadata": [ | ||
| { "name": "name", "displayName": "Index", "role": "label" }, | ||
| { | ||
| "name": "entries", | ||
| "displayName": "Records", | ||
| "shape": ["number", { "decimalPlaces": 0 }] | ||
| }, | ||
| { | ||
| "name": "dataSize", | ||
| "displayName": "Data Size", | ||
| "shape": ["bytes", { "thousandsSeparator": true }] | ||
| }, | ||
| { | ||
| "name": "fileSize", | ||
| "displayName": "File Size", | ||
| "shape": ["bytes", { "thousandsSeparator": true }] | ||
| }, | ||
| { | ||
| "name": "lastBuildTimeS", | ||
| "displayName": "Last Build Time", | ||
| "shape": ["seconds", { "thousandsSeparator": true }] | ||
| }, | ||
| { | ||
| "name": "numberOfPendingTasks", | ||
| "displayName": "Pending Tasks", | ||
| "shape": ["number", { "decimalPlaces": 0 }] | ||
| }, | ||
| { "name": "pendingTask", "displayName": "Has Pending Task" }, | ||
|
Check warning on line 42 in plugins/Algolia/v1/dataStreams/indexes.json
|
||
| { "name": "updatedAt", "displayName": "Last Updated", "shape": "date" }, | ||
| { "name": "primary", "displayName": "Primary Index" } | ||
| ], | ||
| "timeframes": false | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| { | ||
| "name": "noResultRate", | ||
| "displayName": "No-Result Rate", | ||
| "description": "Daily proportion of searches returning no results for an index", | ||
| "tags": ["Analytics"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "/2/searches/noResultRate", | ||
| "getArgs": [ | ||
| { "key": "index", "value": "{{object.rawId}}" }, | ||
| { "key": "startDate", "value": "{{timeframe.start.slice(0,10)}}" }, | ||
| { "key": "endDate", "value": "{{timeframe.end.slice(0,10)}}" } | ||
| ], | ||
| "pathToData": "dates" | ||
| }, | ||
| "matches": { "sourceType": { "type": "equals", "value": "Index" } }, | ||
| "metadata": [ | ||
| { | ||
| "name": "date", | ||
| "displayName": "Date", | ||
| "shape": "date", | ||
| "role": "timestamp" | ||
| }, | ||
| { | ||
| "name": "rate", | ||
| "displayName": "No-result rate", | ||
| "shape": ["percent", { "asZeroToOne": true }], | ||
| "role": "value" | ||
| }, | ||
| { | ||
| "name": "count", | ||
| "displayName": "Searches", | ||
| "shape": ["number", { "decimalPlaces": 0 }] | ||
| }, | ||
| { | ||
| "name": "noResultCount", | ||
| "displayName": "No-result searches", | ||
| "shape": ["number", { "decimalPlaces": 0 }] | ||
| } | ||
| ], | ||
| "timeframes": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| { | ||
| "name": "noResultSearches", | ||
| "displayName": "Top Searches With No Results", | ||
| "description": "Most frequent searches that returned no results for an index", | ||
| "tags": ["Analytics"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "/2/searches/noResults", | ||
| "getArgs": [ | ||
| { "key": "index", "value": "{{object.rawId}}" }, | ||
| { "key": "startDate", "value": "{{timeframe.start.slice(0,10)}}" }, | ||
| { "key": "endDate", "value": "{{timeframe.end.slice(0,10)}}" }, | ||
| { "key": "limit", "value": "50" } | ||
| ], | ||
| "pathToData": "searches", | ||
| "paging": { "mode": "none" } | ||
| }, | ||
| "matches": { "sourceType": { "type": "equals", "value": "Index" } }, | ||
| "metadata": [ | ||
| { | ||
| "name": "search", | ||
| "displayName": "Search", | ||
| "shape": "string", | ||
| "role": "label" | ||
| }, | ||
| { | ||
| "name": "count", | ||
| "displayName": "Count", | ||
| "shape": ["number", { "decimalPlaces": 0 }] | ||
| }, | ||
| { | ||
| "name": "withFilterCount", | ||
| "displayName": "With filters", | ||
| "shape": ["number", { "decimalPlaces": 0 }] | ||
| } | ||
| ], | ||
| "timeframes": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "name": "searchCount", | ||
| "displayName": "Search Count", | ||
| "description": "Daily number of searches for an index over the selected timeframe", | ||
| "tags": ["Analytics"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "/2/searches/count", | ||
| "getArgs": [ | ||
| { "key": "index", "value": "{{object.rawId}}" }, | ||
| { "key": "startDate", "value": "{{timeframe.start.slice(0,10)}}" }, | ||
| { "key": "endDate", "value": "{{timeframe.end.slice(0,10)}}" } | ||
| ], | ||
| "pathToData": "dates" | ||
| }, | ||
| "matches": { "sourceType": { "type": "equals", "value": "Index" } }, | ||
| "metadata": [ | ||
| { | ||
| "name": "date", | ||
| "displayName": "Date", | ||
| "shape": "date", | ||
| "role": "timestamp" | ||
| }, | ||
| { | ||
| "name": "count", | ||
| "displayName": "Searches", | ||
| "shape": ["number", { "decimalPlaces": 0 }], | ||
| "role": "value" | ||
| }, | ||
| { | ||
| "pattern": ".*" | ||
| } | ||
| ], | ||
| "timeframes": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| { | ||
| "name": "topSearches", | ||
| "displayName": "Top Searches", | ||
| "description": "Most frequent search queries for an index over the selected timeframe", | ||
| "tags": ["Analytics"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "/2/searches", | ||
| "getArgs": [ | ||
| { "key": "index", "value": "{{object.rawId}}" }, | ||
| { "key": "startDate", "value": "{{timeframe.start.slice(0,10)}}" }, | ||
| { "key": "endDate", "value": "{{timeframe.end.slice(0,10)}}" }, | ||
| { "key": "limit", "value": "50" } | ||
| ], | ||
| "pathToData": "searches", | ||
| "paging": { "mode": "none" } | ||
| }, | ||
| "matches": { "sourceType": { "type": "equals", "value": "Index" } }, | ||
| "metadata": [ | ||
| { | ||
| "name": "search", | ||
| "displayName": "Search", | ||
| "shape": "string", | ||
| "role": "label" | ||
| }, | ||
| { | ||
| "name": "count", | ||
| "displayName": "Count", | ||
| "shape": ["number", { "decimalPlaces": 0 }] | ||
| }, | ||
| { | ||
| "name": "nbHits", | ||
| "displayName": "Results", | ||
| "shape": ["number", { "decimalPlaces": 0 }] | ||
| } | ||
| ], | ||
| "timeframes": true | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π‘ Nit: the
pendingTaskcolumn onplugins/Algolia/v1/dataStreams/indexes.json:42has noshapedeclaration, while every other typed column in this same file (entries,dataSize,fileSize,lastBuildTimeS,numberOfPendingTasks,updatedAt) is shaped. Algolia returnspendingTaskas a boolean and the displayName "Has Pending Task" reads as a yes/no question, so adding"shape": "boolean"would make the column render as a formatted indicator rather than a rawtrue/falsestring. The neighbouringprimarycolumn on line 44 is in the same situation. Pure cosmetic β the data flows correctly today.Extended reasoning...
What the bug is
plugins/Algolia/v1/dataStreams/indexes.json:42declares thependingTaskcolumn with only a name and displayName:{ "name": "pendingTask", "displayName": "Has Pending Task" },Algolia's
/1/indexesAPI returnspendingTaskas a boolean (trueif the index has tasks pending,falseotherwise). The displayName "Has Pending Task" is phrased as a yes/no question, reinforcing the boolean intent.Internal inconsistency within the same file
Every other typed column in this same stream is shaped β
entriesasnumber,dataSize/fileSizeasbytes,lastBuildTimeSasseconds,numberOfPendingTasksasnumber,updatedAtasdate(the last of which was specifically added in response to a prior review nudge in this same PR). So the shape-discipline is otherwise applied throughout the file;pendingTaskis the lone exception. The neighbouringprimarycolumn on line 44 has the same omission.Addressing the refutation
A reviewer correctly pointed out that the
shape: booleanpattern is not universal across the repo β NinjaOne uses it consistently (smartCapable, isDynamic, etc.), but AutoTask boolean columns ship with no shape, and MicrosoftDefender usesshape: numberfor booleans. That's a fair point: there is no single repo-wide standard, andREVIEW.md's shapes guidance listsbytes/timestamp/durationas examples without namingboolean. This is why the issue is a nit, not a normal-severity bug β there's no documented rule being violated, only an internal inconsistency within this one file and a missed opportunity to use a more semantic shape.Why it's still worth flagging
The column is rendered in the per-index Algolia Index dashboard's "Index Details" tile (a transposed
datastream-propertiestable with nohiddenColumnsfilter), so users will see the raw value there β it's not entirely hidden behind the Overview dashboard's hide list. And the cost of the fix is two characters on a brand-new plugin where the author has otherwise been meticulous about shapes.How to fix
Optionally apply the same to
primaryon line 44.Step-by-step proof
plugins/Algolia/v1/dataStreams/indexes.json:42β{ "name": "pendingTask", "displayName": "Has Pending Task" }with no shape./1/indexesAPI documentation βpendingTaskis a boolean indicator.plugins/NinjaOne/v1/dataStreams/disks.json:88β{ "name": "smartCapable", "displayName": "SMART Capable", "shape": "boolean" }confirms the pattern exists in the repo.true/falsestring in the per-index dashboard rather than as a formatted boolean indicator.