Skip to content

Commit 84b968d

Browse files
committed
wip
1 parent f09967f commit 84b968d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

packages/create-plugin/templates/datasource/.config/AGENTS/instructions.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ A typical datasource with backend plugin includes:
2424
**Main module (`src/module.ts`)**
2525

2626
- Exports: `new DataSourcePlugin(DataSource)`
27-
- Registers query editor, config editor.
27+
- Registers query editor, config editor
2828

2929
**Data source (`src/datasource.ts`)**
3030

31-
- Defines the class that extends DataSourceWithBackend.
31+
- Frontend datasource that extends DataSourceWithBackend.
3232
- Connects the UI to the backend, provides the default query, applies template variables, filters queries, and sends them to the Go backend for execution
3333

3434
**Query editor (`src/QueryEditor.tsx`)**
@@ -42,10 +42,15 @@ A typical datasource with backend plugin includes:
4242

4343
**Main module (`pkg/main.go`)**
4444

45-
- Register a factory function with `grafana-plugin-sdk-go` to create datasource backend instances.
45+
- Register a factory function with `grafana-plugin-sdk-go` to create datasource backend instances
4646

4747
**Data source (`pkg/plugin/datasource.go`)**
4848

49+
- Backend datasource that Implements QueryData (receives queries from frontend, unmarshals into queryModel, returns data frames)
50+
- CheckHealth (validates API key from settings)
51+
- Dispose (cleanup hook).
52+
- NewDatasource factory called when Grafana starts instance of plugin
53+
4954
### Repository layout
5055

5156
- `src/` - Frontend (TypeScript/React)
@@ -84,12 +89,17 @@ You must **NOT**:
8489
- Modify anything inside `.config/*`
8590
- Remove/change existing query model without a migration handler
8691
- Break public APIs (query model)
92+
- Use the local file system
93+
- Use environment variables
94+
- Execute arbitrary code in the backend
8795

8896
You **SHOULD**:
8997

9098
- Maintain backward compatibility
9199
- Preserve query model schema unless migration handler is added
92100
- Follow official Grafana datasource plugin patterns
93101
- Use idiomatic React + TypeScript
102+
- Use secureJsonData instead of jsonData for credentials and sensitive data
103+
- Error happening should be logged with level `error`
94104

95105
## Instructions for specific tasks

0 commit comments

Comments
 (0)