mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Parca: Add standalone building configuration (#79896)
* Parca: Decouple frontend * Parca: decouple backend * Parca: add standalone build process * Regenerate cue files * Fix import * Trigger CI * Fix test * Trigger CI * Trigger CI
This commit is contained in:
@@ -97,7 +97,9 @@
|
||||
{
|
||||
"files": [
|
||||
"public/app/plugins/datasource/grafana-testdata-datasource/*.{ts,tsx}",
|
||||
"public/app/plugins/datasource/grafana-testdata-datasource/**/*.{ts,tsx}"
|
||||
"public/app/plugins/datasource/grafana-testdata-datasource/**/*.{ts,tsx}",
|
||||
"public/app/plugins/datasource/parca/*.{ts,tsx}",
|
||||
"public/app/plugins/datasource/parca/**/*.{ts,tsx}"
|
||||
],
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
|
||||
@@ -56,6 +56,8 @@ deny = [
|
||||
files = [
|
||||
"**/pkg/tsdb/grafana-testdata-datasource/*",
|
||||
"**/pkg/tsdb/grafana-testdata-datasource/**/*",
|
||||
"**/pkg/tsdb/parca/*",
|
||||
"**/pkg/tsdb/parca/**/*",
|
||||
]
|
||||
|
||||
[linters-settings.gocritic]
|
||||
|
||||
@@ -243,6 +243,7 @@
|
||||
"@fingerprintjs/fingerprintjs": "^3.4.2",
|
||||
"@glideapps/glide-data-grid": "^5.2.1",
|
||||
"@grafana-plugins/grafana-testdata-datasource": "workspace:*",
|
||||
"@grafana-plugins/parca": "workspace:*",
|
||||
"@grafana/aws-sdk": "0.3.1",
|
||||
"@grafana/data": "workspace:*",
|
||||
"@grafana/e2e-selectors": "workspace:*",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
import * as common from '@grafana/schema';
|
||||
|
||||
export const pluginVersion = "10.3.0-pre";
|
||||
export const pluginVersion = "%VERSION%";
|
||||
|
||||
export type ParcaQueryType = ('metrics' | 'profile' | 'both');
|
||||
|
||||
|
||||
@@ -1238,7 +1238,7 @@
|
||||
"updated": ""
|
||||
},
|
||||
"dependencies": {
|
||||
"grafanaDependency": "",
|
||||
"grafanaDependency": "\u003e=10.3.0-0",
|
||||
"grafanaVersion": "*",
|
||||
"plugins": []
|
||||
},
|
||||
@@ -1618,7 +1618,7 @@
|
||||
"updated": ""
|
||||
},
|
||||
"dependencies": {
|
||||
"grafanaDependency": ">=10.3.0-0",
|
||||
"grafanaDependency": "\u003e=10.3.0-0",
|
||||
"grafanaVersion": "*",
|
||||
"plugins": []
|
||||
},
|
||||
|
||||
38
pkg/tsdb/parca/standalone/datasource.go
Normal file
38
pkg/tsdb/parca/standalone/datasource.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt"
|
||||
"github.com/grafana/grafana/pkg/tsdb/parca"
|
||||
)
|
||||
|
||||
var (
|
||||
_ backend.QueryDataHandler = (*Datasource)(nil)
|
||||
_ backend.CheckHealthHandler = (*Datasource)(nil)
|
||||
_ backend.CallResourceHandler = (*Datasource)(nil)
|
||||
)
|
||||
|
||||
func NewDatasource(context.Context, backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
|
||||
return &Datasource{
|
||||
Service: parca.ProvideService(httpclient.NewProvider()),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type Datasource struct {
|
||||
Service *parca.Service
|
||||
}
|
||||
|
||||
func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
|
||||
return d.Service.QueryData(ctx, req)
|
||||
}
|
||||
|
||||
func (d *Datasource) CallResource(ctx context.Context, req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error {
|
||||
return d.Service.CallResource(ctx, req, sender)
|
||||
}
|
||||
|
||||
func (d *Datasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error) {
|
||||
return d.Service.CheckHealth(ctx, req)
|
||||
}
|
||||
23
pkg/tsdb/parca/standalone/main.go
Normal file
23
pkg/tsdb/parca/standalone/main.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/datasource"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Start listening to requests sent from Grafana. This call is blocking so
|
||||
// it won't finish until Grafana shuts down the process or the plugin choose
|
||||
// to exit by itself using os.Exit. Manage automatically manages life cycle
|
||||
// of datasource instances. It accepts datasource instance factory as first
|
||||
// argument. This factory will be automatically called on incoming request
|
||||
// from Grafana to create different instances of SampleDatasource (per datasource
|
||||
// ID). When datasource configuration changed Dispose method will be called and
|
||||
// new datasource instance created using NewSampleDatasource factory.
|
||||
if err := datasource.Manage("parca", NewDatasource, datasource.ManageOpts{}); err != nil {
|
||||
log.DefaultLogger.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -39,8 +39,7 @@ const alertmanagerPlugin = async () =>
|
||||
await import(/* webpackChunkName: "alertmanagerPlugin" */ 'app/plugins/datasource/alertmanager/module');
|
||||
const pyroscopePlugin = async () =>
|
||||
await import(/* webpackChunkName: "pyroscopePlugin" */ 'app/plugins/datasource/grafana-pyroscope-datasource/module');
|
||||
const parcaPlugin = async () =>
|
||||
await import(/* webpackChunkName: "parcaPlugin" */ 'app/plugins/datasource/parca/module');
|
||||
const parcaPlugin = async () => await import(/* webpackChunkName: "parcaPlugin" */ '@grafana-plugins/parca/module');
|
||||
|
||||
import * as alertGroupsPanel from 'app/plugins/panel/alertGroups/module';
|
||||
import * as alertListPanel from 'app/plugins/panel/alertlist/module';
|
||||
|
||||
1
public/app/plugins/datasource/parca/CHANGELOG.md
Normal file
1
public/app/plugins/datasource/parca/CHANGELOG.md
Normal file
@@ -0,0 +1 @@
|
||||
# Changelog
|
||||
3
public/app/plugins/datasource/parca/README.md
Normal file
3
public/app/plugins/datasource/parca/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Grafana Parca data source
|
||||
|
||||
Grafana plugin for the Parca data source.
|
||||
37
public/app/plugins/datasource/parca/package.json
Normal file
37
public/app/plugins/datasource/parca/package.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "@grafana-plugins/parca",
|
||||
"description": "Continuous profiling for analysis of CPU and memory usage, down to the line number and throughout time. Saving infrastructure cost, improving performance, and increasing reliability.",
|
||||
"private": true,
|
||||
"version": "10.3.0-pre",
|
||||
"dependencies": {
|
||||
"@emotion/css": "11.11.2",
|
||||
"@grafana/data": "10.3.0-pre",
|
||||
"@grafana/runtime": "10.3.0-pre",
|
||||
"@grafana/schema": "10.3.0-pre",
|
||||
"@grafana/ui": "10.3.0-pre",
|
||||
"lodash": "4.17.21",
|
||||
"monaco-editor": "0.34.0",
|
||||
"react": "18.2.0",
|
||||
"react-use": "17.4.0",
|
||||
"rxjs": "7.8.1",
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@grafana/plugin-configs": "10.3.0-pre",
|
||||
"@testing-library/react": "14.0.0",
|
||||
"@testing-library/user-event": "14.5.1",
|
||||
"@types/lodash": "4.14.195",
|
||||
"@types/react": "18.2.15",
|
||||
"ts-node": "10.9.1",
|
||||
"webpack": "5.89.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@grafana/runtime": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack -c ./webpack.config.ts --env production",
|
||||
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
|
||||
"dev": "webpack -w -c ./webpack.config.ts --env development"
|
||||
},
|
||||
"packageManager": "yarn@3.6.0"
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
"type": "datasource",
|
||||
"name": "Parca",
|
||||
"id": "parca",
|
||||
"executable": "gpx_parca",
|
||||
"category": "profiling",
|
||||
"metrics": true,
|
||||
"backend": true,
|
||||
@@ -21,6 +22,10 @@
|
||||
"name": "GitHub Project",
|
||||
"url": "https://github.com/parca-dev/parca"
|
||||
}
|
||||
]
|
||||
],
|
||||
"version": "%VERSION%"
|
||||
},
|
||||
"dependencies": {
|
||||
"grafanaDependency": ">=10.3.0-0"
|
||||
}
|
||||
}
|
||||
|
||||
4
public/app/plugins/datasource/parca/tsconfig.json
Normal file
4
public/app/plugins/datasource/parca/tsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "@grafana/plugin-configs/tsconfig.json",
|
||||
"include": ["."]
|
||||
}
|
||||
3
public/app/plugins/datasource/parca/webpack.config.ts
Normal file
3
public/app/plugins/datasource/parca/webpack.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import config from '@grafana/plugin-configs/webpack.config';
|
||||
|
||||
export default config;
|
||||
28
yarn.lock
28
yarn.lock
@@ -2893,6 +2893,33 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@grafana-plugins/parca@workspace:*, @grafana-plugins/parca@workspace:public/app/plugins/datasource/parca":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@grafana-plugins/parca@workspace:public/app/plugins/datasource/parca"
|
||||
dependencies:
|
||||
"@emotion/css": "npm:11.11.2"
|
||||
"@grafana/data": "npm:10.3.0-pre"
|
||||
"@grafana/plugin-configs": "npm:10.3.0-pre"
|
||||
"@grafana/runtime": "npm:10.3.0-pre"
|
||||
"@grafana/schema": "npm:10.3.0-pre"
|
||||
"@grafana/ui": "npm:10.3.0-pre"
|
||||
"@testing-library/react": "npm:14.0.0"
|
||||
"@testing-library/user-event": "npm:14.5.1"
|
||||
"@types/lodash": "npm:4.14.195"
|
||||
"@types/react": "npm:18.2.15"
|
||||
lodash: "npm:4.17.21"
|
||||
monaco-editor: "npm:0.34.0"
|
||||
react: "npm:18.2.0"
|
||||
react-use: "npm:17.4.0"
|
||||
rxjs: "npm:7.8.1"
|
||||
ts-node: "npm:10.9.1"
|
||||
tslib: "npm:2.6.0"
|
||||
webpack: "npm:5.89.0"
|
||||
peerDependencies:
|
||||
"@grafana/runtime": "*"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@grafana/async-query-data@npm:0.1.4":
|
||||
version: 0.1.4
|
||||
resolution: "@grafana/async-query-data@npm:0.1.4"
|
||||
@@ -17303,6 +17330,7 @@ __metadata:
|
||||
"@fingerprintjs/fingerprintjs": "npm:^3.4.2"
|
||||
"@glideapps/glide-data-grid": "npm:^5.2.1"
|
||||
"@grafana-plugins/grafana-testdata-datasource": "workspace:*"
|
||||
"@grafana-plugins/parca": "workspace:*"
|
||||
"@grafana/aws-sdk": "npm:0.3.1"
|
||||
"@grafana/data": "workspace:*"
|
||||
"@grafana/e2e-selectors": "workspace:*"
|
||||
|
||||
Reference in New Issue
Block a user