Skip to content

[FEATURE] Add GreptimeDB datasource Plugin#629

Open
sunchanglong wants to merge 28 commits into
perses:mainfrom
GreptimeTeam:main
Open

[FEATURE] Add GreptimeDB datasource Plugin#629
sunchanglong wants to merge 28 commits into
perses:mainfrom
GreptimeTeam:main

Conversation

@sunchanglong
Copy link
Copy Markdown

Description

This pull request adds a new GreptimeDB plugin to the plugins repository so Perses can query and visualize metrics & logs data from GreptimeDB.

The implementation covers the main GreptimeDB query workflows used in Perses dashboards:

querying time series data from GreptimeDB based on panel time range
converting GreptimeDB responses into the data format expected by Perses panels, so charts and related visual components can consume results without additional handling

A few points worth calling out for review:

GreptimeDB response data is normalized and mapped into Perses-compatible series/frames, including timestamps, values, and label dimensions
plugin schemas, SDK integration helpers, datasource configuration, query editor support, and tests are included in the same change
only files required for the GreptimeDB plugin and workspace/plugin registration were touched
This change is intended to address GreptimeDB datasource support discussed in the linked issue and related follow-up conversations.

Screenshots

Pasted Graphic 7 Pasted Graphic 8 Pasted Graphic 9 Pasted Graphic 10

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

Signed-off-by: sun <sunchang_long@163.com>
@sunchanglong sunchanglong requested review from a team, AntoineThebaud and Nexucis as code owners April 15, 2026 02:45
@sunchanglong sunchanglong requested review from jgbernalp and removed request for a team April 15, 2026 02:45
@sunchanglong
Copy link
Copy Markdown
Author

The CI workflow failure seems unrelated to the changes in this PR.
Could you please try rerunning the job?

Comment thread greptimedb/src/queries/greptimedb-log-query/greptimedb-log-query-types.test.ts Outdated
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
@sunchanglong
Copy link
Copy Markdown
Author

Added GreptimeDBResponseData to refine the unknown types. This ensures better type safety and clarifies the expected data structure from GreptimeDB.

@sunchanglong
Copy link
Copy Markdown
Author

sunchanglong commented May 13, 2026

Hi team, @jgbernalp we have addressed most review issues could you please check again.
We're using the Perses GreptimeDB plugin in our project: dashboard

Comment thread greptimedb/sdk/go/query/time-series/time-series.go
Comment thread greptimedb/src/queries/greptimedb-trace-query/get-greptimedb-trace-data.ts Outdated
Comment thread greptimedb/src/queries/greptimedb-trace-query/get-greptimedb-trace-data.ts Outdated
Comment thread greptimedb/src/queries/greptimedb-trace-query/get-greptimedb-trace-data.ts Outdated
Comment thread greptimedb/go.mod Outdated
Comment thread greptimedb/go.mod Outdated
Comment thread greptimedb/src/queries/greptimedb-log-query/greptimedb-log-query-types.test.ts Outdated
Comment thread greptimedb/src/queries/greptimedb-query-data-model.ts
Comment thread greptimedb/src/queries/greptimedb-trace-query/get-greptimedb-trace-data.ts Outdated
Comment thread greptimedb/src/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.tsx Outdated
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
@sunchanglong
Copy link
Copy Markdown
Author

the CI error was caused by perses-dev peerDependencies upgration, should be fixed

@jgbernalp
Copy link
Copy Markdown
Contributor

jgbernalp commented May 19, 2026

Code review

Found 1 issue:

  1. Missing Trace Explorer plugin registration and export. The GreptimeDBTraceExplorer component is fully implemented in src/explore/ but is never exported from src/index.ts and not registered in package.json under perses.plugins with kind: "Explore". Without these, the explorer is inaccessible to users. Compare with the Tempo plugin which exports explore at src/index.ts:16 and registers it at package.json:79-86.

greptimedb/src/index.ts is missing export * from './explore';:
https://github.com/perses/plugins/blob/21a1d260f3884018719a27554fdaaeeb87f9e140/greptimedb/src/index.ts#L13-L17

greptimedb/package.json is missing an Explore plugin entry (compare with Tempo's registration):

"perses": {
"moduleName": "GreptimeDB",
"schemasPath": "schemas",
"plugins": [
{
"kind": "Datasource",
"spec": {
"display": {
"name": "GreptimeDB Datasource"
},
"name": "GreptimeDBDatasource"
}
},
{
"kind": "TimeSeriesQuery",
"spec": {
"display": {
"name": "GreptimeDB Time Series Query"
},
"name": "GreptimeDBTimeSeriesQuery"
}
},
{
"kind": "LogQuery",
"spec": {
"display": {
"name": "GreptimeDB Log Query"
},
"name": "GreptimeDBLogQuery"
}
},
{
"kind": "TraceQuery",
"spec": {
"display": {
"name": "GreptimeDB Trace Query"
},
"name": "GreptimeDBTraceQuery"
}
}
]
}

The component exists but is dead code without proper wiring:

// Copyright The Perses Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//

Reference: Tempo plugin's correct pattern:

export { getPluginModule } from './getPluginModule';
export * from './components';
export * from './explore';
export * from './model';
export * from './plugins';

{
"kind": "Explore",
"spec": {
"display": {
"name": "Tempo Traces Explorer"
},
"name": "TempoExplorer"
}
}
]

🤖 Generated with Claude Code

@sunchanglong
Copy link
Copy Markdown
Author

Code review

Found 1 issue:

  1. Missing Trace Explorer plugin registration and export. The GreptimeDBTraceExplorer component is fully implemented in src/explore/ but is never exported from src/index.ts and not registered in package.json under perses.plugins with kind: "Explore". Without these, the explorer is inaccessible to users. Compare with the Tempo plugin which exports explore at src/index.ts:16 and registers it at package.json:79-86.

greptimedb/src/index.ts is missing export * from './explore';: https://github.com/perses/plugins/blob/21a1d260f3884018719a27554fdaaeeb87f9e140/greptimedb/src/index.ts#L13-L17

greptimedb/package.json is missing an Explore plugin entry (compare with Tempo's registration):

"perses": {
"moduleName": "GreptimeDB",
"schemasPath": "schemas",
"plugins": [
{
"kind": "Datasource",
"spec": {
"display": {
"name": "GreptimeDB Datasource"
},
"name": "GreptimeDBDatasource"
}
},
{
"kind": "TimeSeriesQuery",
"spec": {
"display": {
"name": "GreptimeDB Time Series Query"
},
"name": "GreptimeDBTimeSeriesQuery"
}
},
{
"kind": "LogQuery",
"spec": {
"display": {
"name": "GreptimeDB Log Query"
},
"name": "GreptimeDBLogQuery"
}
},
{
"kind": "TraceQuery",
"spec": {
"display": {
"name": "GreptimeDB Trace Query"
},
"name": "GreptimeDBTraceQuery"
}
}
]
}

The component exists but is dead code without proper wiring:

// Copyright The Perses Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//

Reference: Tempo plugin's correct pattern:

export { getPluginModule } from './getPluginModule';
export * from './components';
export * from './explore';
export * from './model';
export * from './plugins';

{
"kind": "Explore",
"spec": {
"display": {
"name": "Tempo Traces Explorer"
},
"name": "TempoExplorer"
}
}
]

🤖 Generated with Claude Code

yes, it is a knowned issue.
To keep this PR clean and avoid delaying the review, we've left Trace Explorer out for now, especially since we don't have an immediate need for it. We plan to follow up and open another PR for it in a future release, unless you prefer having it included now.

@jgbernalp
Copy link
Copy Markdown
Contributor

@sunchanglong in that case, please remove the dead code and create an GitHub issue for later implementation

Signed-off-by: sun <sunchang_long@163.com>
@sunchanglong
Copy link
Copy Markdown
Author

the dead code has been removed.
#660 the issue has been recorded here

Comment thread greptimedb/go.mod
Comment thread greptimedb/schemas/queries/greptimedb-log-query/query.cue
Comment thread greptimedb/schemas/queries/greptimedb-time-series-query/query.cue
Comment thread greptimedb/src/model/greptimedb-client.ts
Comment thread greptimedb/src/model/greptimedb-client.ts Outdated
Comment thread greptimedb/src/queries/greptimedb-trace-query/get-greptimedb-trace-data.ts Outdated
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
Signed-off-by: sun <sunchang_long@163.com>
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.

2 participants