Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
fe757f6
commit 7746250
Showing
15 changed files
with
153 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,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) | ||
} |
This file contains 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,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) | ||
} | ||
} |
This file contains 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 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 @@ | ||
# Changelog |
This file contains 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,3 @@ | ||
# Grafana Parca data source | ||
|
||
Grafana plugin for the Parca data source. |
This file contains 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,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" | ||
} |
This file contains 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 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,4 @@ | ||
{ | ||
"extends": "@grafana/plugin-configs/tsconfig.json", | ||
"include": ["."] | ||
} |
This file contains 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,3 @@ | ||
import config from '@grafana/plugin-configs/webpack.config'; | ||
|
||
export default config; |
This file contains 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