[FEATURE] Add Splunk datasource plugin#543
[FEATURE] Add Splunk datasource plugin#543sharangokul28 wants to merge 3 commits intoperses:mainfrom
Conversation
d37ccf8 to
756a791
Compare
splunk/cue.mod/module.cue
Outdated
| } | ||
| deps: { | ||
| "github.com/perses/perses/cue@v0": { | ||
| v: "v0.53.0-beta.3" |
There was a problem hiding this comment.
| v: "v0.53.0-beta.3" | |
| v: "v0.53.0-rc.1" |
splunk/package.json
Outdated
| "@perses-dev/components": "^0.53.0-beta.3", | ||
| "@perses-dev/core": "^0.53.0-beta.3", | ||
| "@perses-dev/plugin-system": "^0.53.0-beta.3", |
There was a problem hiding this comment.
| "@perses-dev/components": "^0.53.0-beta.3", | |
| "@perses-dev/core": "^0.53.0-beta.3", | |
| "@perses-dev/plugin-system": "^0.53.0-beta.3", | |
| "@perses-dev/components": "^0.53.0-rc.1", | |
| "@perses-dev/core": "^0.53.0-rc.1", | |
| "@perses-dev/plugin-system": "^0.53.0-rc.1", |
splunk/go.mod
Outdated
|
|
||
| go 1.25.1 | ||
|
|
||
| require github.com/perses/perses v0.53.0-beta.3 |
There was a problem hiding this comment.
| require github.com/perses/perses v0.53.0-beta.3 | |
| require github.com/perses/perses v0.53.0-rc.0 |
756a791 to
7997593
Compare
AntoineThebaud
left a comment
There was a problem hiding this comment.
CUE review following a change on main branch:
2ec9a89 to
7b2c6f5
Compare
Gladorme
left a comment
There was a problem hiding this comment.
Nice PR!
First review done, ping me if you have any questions :)
splunk/src/queries/splunk-time-series-query/get-splunk-time-series-data.ts
Outdated
Show resolved
Hide resolved
splunk/src/queries/splunk-time-series-query/get-splunk-time-series-data.ts
Show resolved
Hide resolved
splunk/src/queries/splunk-time-series-query/get-splunk-time-series-data.ts
Outdated
Show resolved
Hide resolved
splunk/src/queries/splunk-time-series-query/get-splunk-time-series-data.ts
Outdated
Show resolved
Hide resolved
| return response.json(); | ||
| } | ||
|
|
||
| export async function exportSearch( |
There was a problem hiding this comment.
This fetch looks like to be "streamed" when I look at the network inspect (result payload is displayed part by part), I wonder if we could use: https://tanstack.com/query/v5/docs/reference/streamedQuery 🤔
Never used it myself, but would ne nice if we don't have to wait full payload to display the content. Something that could be added in a future PR.
7b2c6f5 to
c9061d7
Compare
splunk/src/queries/splunk-time-series-query/get-splunk-time-series-data.ts
Outdated
Show resolved
Hide resolved
|
You need to add "splunk" in main package.json (workspaces) and then check format + lint (npm run lint and npm run type-check) |
c9061d7 to
d5a7aeb
Compare
splunk/src/model/splunk-client.ts
Outdated
| if (params.earliest_time) formData.append('earliest_time', params.earliest_time); | ||
| if (params.latest_time) formData.append('latest_time', params.latest_time); | ||
| formData.append('output_mode', params.output_mode || 'json'); | ||
| try { |
There was a problem hiding this comment.
Remove try catch + credentials: 'include'
And use:
| try { | |
| return await fetchJson<SplunkJobCreateResponse>(url.toString(), { | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/x-www-form-urlencoded', | |
| ...options.headers, | |
| }, | |
| body: formData.toString(), | |
| }); |
splunk/src/model/splunk-client.ts
Outdated
| export async function getJobStatus(jobId: string, options: SplunkApiOptions): Promise<SplunkJobStatusResponse> { | ||
| const url = buildUrl(`/services/search/v2/jobs/${jobId}`, options.datasourceUrl); | ||
| url.searchParams.append('output_mode', 'json'); | ||
| try { |
There was a problem hiding this comment.
| try { | |
| return await fetchJson<SplunkJobStatusResponse>(url.toString(), { | |
| method: 'GET', | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| ...options.headers, | |
| }, | |
| }); |
splunk/src/model/splunk-client.ts
Outdated
| url.searchParams.append('output_mode', params.output_mode || 'json'); | ||
| if (params.count) url.searchParams.append('count', params.count.toString()); | ||
| if (params.offset) url.searchParams.append('offset', params.offset.toString()); | ||
| try { |
There was a problem hiding this comment.
| try { | |
| return await fetchJson<SplunkResultsResponse>(url.toString(), { | |
| method: 'GET', | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| ...options.headers, | |
| }, | |
| }); |
splunk/src/model/splunk-client.ts
Outdated
| url.searchParams.append('output_mode', params.output_mode || 'json'); | ||
| if (params.count) url.searchParams.append('count', params.count.toString()); | ||
| if (params.offset) url.searchParams.append('offset', params.offset.toString()); | ||
| try { |
There was a problem hiding this comment.
return await fetchJson(url.toString(), {
method: 'GET',
headers: {
'Content-Type': 'application/json',
...options.headers,
},
});
splunk/src/model/splunk-client.ts
Outdated
| const url = buildUrl('/services/data/indexes', options.datasourceUrl); | ||
| url.searchParams.append('output_mode', 'json'); | ||
| url.searchParams.append('count', '0'); | ||
| try { |
There was a problem hiding this comment.
| try { | |
| return await fetchJson<SplunkIndexResponse>(url.toString(), { | |
| method: 'GET', | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| ...options.headers, | |
| }, | |
| }); |
splunk/src/bootstrap.tsx
Outdated
| // limitations under the License. | ||
|
|
||
| // This file is used for development mode only | ||
| export default function bootstrap() { |
There was a problem hiding this comment.
Please use the same boostrap as others plugins.
| export default function bootstrap() { | |
| import React from 'react'; | |
| import ReactDOM from 'react-dom/client'; | |
| const root = ReactDOM.createRoot(document.getElementById('root')!); | |
| root.render(<React.StrictMode></React.StrictMode>); |
splunk/go.mod
Outdated
|
|
||
| go 1.25.1 | ||
|
|
||
| require github.com/perses/perses v0.53.0-rc.0 |
There was a problem hiding this comment.
| require github.com/perses/perses v0.53.0-rc.0 | |
| require github.com/perses/perses v0.53.1 |
splunk/cue.mod/module.cue
Outdated
| } | ||
| deps: { | ||
| "github.com/perses/shared/cue@v0": { | ||
| v: "v0.53.0-rc.2" |
There was a problem hiding this comment.
| v: "v0.53.0-rc.2" | |
| v: "v0.53.1" |
splunk/package.json
Outdated
| "types": "lib/index.d.ts", | ||
| "dependencies": {}, | ||
| "peerDependencies": { | ||
| "@perses-dev/components": "^0.53.0-rc.1", |
There was a problem hiding this comment.
| "@perses-dev/components": "^0.53.0-rc.1", | |
| "@perses-dev/components": "^0.53.1", | |
| "@perses-dev/core": "^0.53.1", | |
| "@perses-dev/plugin-system": "^0.53.1", |
| @@ -0,0 +1,66 @@ | |||
| { | |||
| "name": "@perses-dev/splunk-plugin", | |||
| "version": "0.1.0", | |||
There was a problem hiding this comment.
| "version": "0.1.0", | |
| "version": "0.1.0", | |
| "homepage": "https://github.com/perses/plugins/blob/main/README.md", | |
| "repository": { | |
| "type": "git", | |
| "url": "git+https://github.com/perses/plugins.git" | |
| }, | |
| "bugs": { | |
| "url": "https://github.com/perses/plugins/issues" | |
| }, |
d5a7aeb to
6c2c090
Compare
Signed-off-by: Sharan Gokul <sharangokul@gmail.com>
6c2c090 to
d8a1e5d
Compare
Description
The Splunk plugin enables Perses to connect to Splunk instances and query data using Splunk Processing Language (SPL). It supports both time series visualizations and log queries.
Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes