Skip to content
This repository was archived by the owner on Apr 27, 2023. It is now read-only.

Commit 29efc40

Browse files
authored
Merge pull request #3 from pyroscope-io/new-structure-2
Version 1.1.0
2 parents a0e462c + cfcdd4e commit 29efc40

File tree

18 files changed

+4563
-6802
lines changed

18 files changed

+4563
-6802
lines changed

.github/workflows/ci.yml

Lines changed: 76 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ jobs:
1414
- uses: actions/checkout@v2
1515

1616
- name: Setup Node.js environment
17-
uses: actions/setup-node@v2.1.2
17+
uses: actions/setup-node@v2
1818
with:
19-
node-version: "14.x"
19+
node-version: "14.17"
2020

2121
- name: Get yarn cache directory path
2222
id: yarn-cache-dir-path
2323
run: echo "::set-output name=dir::$(yarn cache dir)"
24-
24+
2525
- name: Cache yarn cache
2626
uses: actions/cache@v2
2727
id: cache-yarn-cache
@@ -30,7 +30,7 @@ jobs:
3030
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3131
restore-keys: |
3232
${{ runner.os }}-yarn-
33-
33+
3434
- name: Cache node_modules
3535
id: cache-node-modules
3636
uses: actions/cache@v2
@@ -40,36 +40,85 @@ jobs:
4040
restore-keys: |
4141
${{ runner.os }}-${{ matrix.node-version }}-nodemodules-
4242
43-
- name: Install dependencies
44-
run: yarn install --frozen-lockfile
45-
46-
- name: Build and test frontend
43+
- name: Build plugin
4744
run: yarn build
4845

49-
- name: Check for backend
50-
id: check-for-backend
46+
- name: Sign plugin
5147
run: |
52-
if [ -f "Magefile.go" ]
53-
then
54-
echo "::set-output name=has-backend::true"
55-
fi
48+
# We only have a single dependency, grafana-toolkit
49+
# So we install next to where it's needed
50+
yarn
51+
yarn sign
52+
env:
53+
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com.
54+
55+
# We reuse the same tests from the other repo, after all, why not?
56+
# TODO: run other tests that are valid here
57+
# eg: checking README etc
58+
- name: Run grafana server
59+
run: docker-compose -f pyroscope/grafana-plugin/panel/docker-compose.yml up -d
60+
- name: Run tests
61+
run: yarn --cwd pyroscope cy:panel:ci
62+
env:
63+
CYPRESS_VIDEO: true
64+
CYPRESS_COMPARE_SNAPSHOTS: true
65+
- uses: actions/upload-artifact@v2
66+
if: always()
67+
with:
68+
name: cypress-screenshots
69+
path: pyroscope/cypress/screenshots
70+
- uses: actions/upload-artifact@v2
71+
if: always()
72+
with:
73+
name: cypress-videos
74+
path: pyroscope/cypress/videos
75+
- uses: actions/upload-artifact@v2
76+
if: always()
77+
with:
78+
name: cypress-snapshots
79+
# TODO: scope to only store screenshots that refer to grafana
80+
path: pyroscope/cypress/snapshots
5681

82+
# Setup the go environment, since the grafana plugin linter isn't distributed as a binary
5783
- name: Setup Go environment
5884
if: steps.check-for-backend.outputs.has-backend == 'true'
5985
uses: actions/setup-go@v2
6086
with:
61-
go-version: "1.15"
87+
go-version: "1.16"
6288

63-
- name: Test backend
64-
if: steps.check-for-backend.outputs.has-backend == 'true'
65-
uses: magefile/mage-action@v1
66-
with:
67-
version: latest
68-
args: coverage
89+
- name: Get plugin metadata
90+
id: metadata
91+
run: |
92+
sudo apt-get install jq
6993
70-
- name: Build backend
71-
if: steps.check-for-backend.outputs.has-backend == 'true'
72-
uses: magefile/mage-action@v1
73-
with:
74-
version: latest
75-
args: buildAll
94+
export GRAFANA_PLUGIN_ID=$(cat dist/plugin.json | jq -r .id)
95+
export GRAFANA_PLUGIN_VERSION=$(cat dist/plugin.json | jq -r .info.version)
96+
export GRAFANA_PLUGIN_TYPE=$(cat dist/plugin.json | jq -r .type)
97+
export GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip
98+
export GRAFANA_PLUGIN_ARTIFACT_CHECKSUM=${GRAFANA_PLUGIN_ARTIFACT}.md5
99+
100+
echo "::set-output name=plugin-id::${GRAFANA_PLUGIN_ID}"
101+
echo "::set-output name=plugin-version::${GRAFANA_PLUGIN_VERSION}"
102+
echo "::set-output name=plugin-type::${GRAFANA_PLUGIN_TYPE}"
103+
echo "::set-output name=archive::${GRAFANA_PLUGIN_ARTIFACT}"
104+
echo "::set-output name=archive-checksum::${GRAFANA_PLUGIN_ARTIFACT_CHECKSUM}"
105+
106+
echo ::set-output name=github-tag::${GITHUB_REF#refs/*/}
107+
108+
- name: Package plugin
109+
id: package-plugin
110+
run: |
111+
mv dist ${{ steps.metadata.outputs.plugin-id }}
112+
zip ${{ steps.metadata.outputs.archive }} ${{ steps.metadata.outputs.plugin-id }} -r
113+
md5sum ${{ steps.metadata.outputs.archive }} > ${{ steps.metadata.outputs.archive-checksum }}
114+
echo "::set-output name=checksum::$(cat ./${{ steps.metadata.outputs.archive-checksum }} | cut -d' ' -f1)"
115+
116+
- name: Lint plugin
117+
run: |
118+
export PATH="$(go env GOPATH)/bin/:$PATH"
119+
120+
git clone https://github.com/grafana/plugin-validator
121+
pushd ./plugin-validator/pkg/cmd/plugincheck2
122+
go install
123+
popd
124+
plugincheck2 -config lint.config.yaml ${{ steps.metadata.outputs.archive }}

.github/workflows/release.yml

Lines changed: 60 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Release
22

33
on:
44
push:
5-
tags:
6-
- "v*.*.*" # Run workflow on version tags, e.g. v1.0.0.
5+
branches:
6+
- main
77

88
jobs:
99
release:
@@ -13,19 +13,14 @@ jobs:
1313
- uses: actions/checkout@v2
1414

1515
- name: Setup Node.js environment
16-
uses: actions/setup-node@v2.1.2
16+
uses: actions/setup-node@v2
1717
with:
18-
node-version: "14.x"
19-
20-
- name: Setup Go environment
21-
uses: actions/setup-go@v2
22-
with:
23-
go-version: "1.15"
18+
node-version: "14.17"
2419

2520
- name: Get yarn cache directory path
2621
id: yarn-cache-dir-path
2722
run: echo "::set-output name=dir::$(yarn cache dir)"
28-
23+
2924
- name: Cache yarn cache
3025
uses: actions/cache@v2
3126
id: cache-yarn-cache
@@ -34,7 +29,7 @@ jobs:
3429
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3530
restore-keys: |
3631
${{ runner.os }}-yarn-
37-
32+
3833
- name: Cache node_modules
3934
id: cache-node-modules
4035
uses: actions/cache@v2
@@ -44,41 +39,51 @@ jobs:
4439
restore-keys: |
4540
${{ runner.os }}-${{ matrix.node-version }}-nodemodules-
4641
47-
- name: Install dependencies
48-
run: yarn install --frozen-lockfile;
49-
if: |
50-
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
51-
steps.cache-node-modules.outputs.cache-hit != 'true'
52-
53-
- name: Build and test frontend
42+
- name: Build plugin
5443
run: yarn build
5544

56-
- name: Check for backend
57-
id: check-for-backend
45+
- name: Sign plugin
5846
run: |
59-
if [ -f "Magefile.go" ]
60-
then
61-
echo "::set-output name=has-backend::true"
62-
fi
47+
# We only have a single dependency, grafana-toolkit
48+
# So we install next to where it's needed
49+
yarn
50+
yarn sign
51+
env:
52+
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com.
6353

64-
- name: Test backend
65-
if: steps.check-for-backend.outputs.has-backend == 'true'
66-
uses: magefile/mage-action@v1
54+
# We reuse the same tests from the other repo, after all, why not?
55+
# TODO: run other tests that are valid here
56+
# eg: checking README etc
57+
- name: Run grafana server
58+
run: docker-compose -f pyroscope/grafana-plugin/panel/docker-compose.yml up -d
59+
- name: Run tests
60+
run: yarn --cwd pyroscope cy:panel:ci
61+
env:
62+
CYPRESS_VIDEO: true
63+
CYPRESS_COMPARE_SNAPSHOTS: true
64+
- uses: actions/upload-artifact@v2
65+
if: always()
66+
with:
67+
name: cypress-screenshots
68+
path: pyroscope/cypress/screenshots
69+
- uses: actions/upload-artifact@v2
70+
if: always()
6771
with:
68-
version: latest
69-
args: coverage
72+
name: cypress-videos
73+
path: pyroscope/cypress/videos
74+
- uses: actions/upload-artifact@v2
75+
if: always()
76+
with:
77+
name: cypress-snapshots
78+
# TODO: scope to only store screenshots that refer to grafana
79+
path: pyroscope/cypress/snapshots
7080

71-
- name: Build backend
81+
# Setup the go environment, since the grafana plugin linter isn't distributed as a binary
82+
- name: Setup Go environment
7283
if: steps.check-for-backend.outputs.has-backend == 'true'
73-
uses: magefile/mage-action@v1
84+
uses: actions/setup-go@v2
7485
with:
75-
version: latest
76-
args: buildAll
77-
78-
- name: Sign plugin
79-
run: yarn sign
80-
env:
81-
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com.
86+
go-version: "1.16"
8287

8388
- name: Get plugin metadata
8489
id: metadata
@@ -99,15 +104,6 @@ jobs:
99104
100105
echo ::set-output name=github-tag::${GITHUB_REF#refs/*/}
101106
102-
- name: Read changelog
103-
id: changelog
104-
run: |
105-
awk '/^## / {s++} s == 1 {print}' CHANGELOG.md > release_notes.md
106-
echo "::set-output name=path::release_notes.md"
107-
108-
- name: Check package version
109-
run: if [ "v${{ steps.metadata.outputs.plugin-version }}" != "${{ steps.metadata.outputs.github-tag }}" ]; then printf "\033[0;31mPlugin version doesn't match tag name\033[0m\n"; exit 1; fi
110-
111107
- name: Package plugin
112108
id: package-plugin
113109
run: |
@@ -118,11 +114,24 @@ jobs:
118114
119115
- name: Lint plugin
120116
run: |
117+
export PATH="$(go env GOPATH)/bin/:$PATH"
118+
121119
git clone https://github.com/grafana/plugin-validator
122-
pushd ./plugin-validator/cmd/plugincheck
120+
pushd ./plugin-validator/pkg/cmd/plugincheck2
123121
go install
124122
popd
125-
plugincheck ${{ steps.metadata.outputs.archive }}
123+
plugincheck2 -config lint.config.yaml ${{ steps.metadata.outputs.archive }}
124+
# until here it's pretty much the same as ci.yml
125+
# TODO: share the code somehow
126+
127+
##########################
128+
# Release Specific Stuff #
129+
##########################
130+
- name: Read changelog
131+
id: changelog
132+
run: |
133+
awk '/^## / {s++} s == 1 {print}' CHANGELOG.md > release_notes.md
134+
echo "::set-output name=path::release_notes.md"
126135
127136
- name: Create release
128137
id: create_release
@@ -159,6 +168,5 @@ jobs:
159168

160169
- name: Publish to Grafana.com
161170
run: |
162-
echo A draft release has been created for your plugin. Please review and publish it. Then submit your plugin to grafana.com/plugins by opening a PR to https://github.com/grafana/grafana-plugin-repository with the following entry:
163-
echo
164-
echo '{ "id": "${{ steps.metadata.outputs.plugin-id }}", "type": "${{ steps.metadata.outputs.plugin-type }}", "url": "https://github.com/${{ github.repository }}", "versions": [ { "version": "${{ steps.metadata.outputs.plugin-version }}", "commit": "${{ github.sha }}", "url": "https://github.com/${{ github.repository }}", "download": { "any": { "url": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.metadata.outputs.plugin-version }}/${{ steps.metadata.outputs.archive }}", "md5": "${{ steps.package-plugin.outputs.checksum }}" } } } ] }' | jq .
171+
echo "A draft release has been created for your plugin. Please review and publish it."
172+
echo "To publish a new version, follow https://github.com/grafana/grafana-plugin-repository#maintain-your-plugin"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ e2e-results/
3131
.idea
3232

3333
src/flamegraphComponent.js
34+
pyroscope
35+
dist.zip
36+
plugin-validator

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3-
## 1.0.0 (Unreleased)
3+
## 1.1.0
4+
* Add context menu (triggered by right clicking the flamegraph)
5+
* Add toolbar
6+
* Allow focusing on a subtree
7+
* Allow searching nodes that match a specific string
8+
* Visual updates
9+
10+
## 1.0.0
411

512
Initial release.

README.md

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
# Pyroscope Grafana Panel Plugin
22

3-
**Important: Grafana version 7.2 or later required**
3+
For more info see [pyroscope-panel plugin for Grafana | Grafana Labs](https://grafana.com/grafana/plugins/pyroscope-panel/)
4+
or [pyroscope/grafana-plugin/panel at main · pyroscope-io/pyroscope](https://github.com/pyroscope-io/pyroscope/tree/main/grafana-plugin/panel)
45

5-
## Getting started
66

7-
1. Install the plugin (Installation tab)
8-
2. Install [datasource plugin](https://grafana.com/grafana/plugins/pyroscope-datasource/)
9-
3. Open Grafana ang go to **Configuratin -> Plugins**
10-
4. Check that plugins are available
11-
5. Set up data source plugin:
12-
* **Configuration -> Data Sources -> Add data source**
13-
* click on `pyroscope-datasource`
14-
* Specify Pyroscope host in `Endpoint` field:
15-
![endpoint](https://raw.githubusercontent.com/pyroscope-io/grafana-panel-plugin/main/docs/assets/endpoint.jpg)
16-
6. Set up panel plugin:
17-
* Add an empty panel on your dashboard
18-
* Select `pyroscope-panel` from Visualization list
19-
* Under panel view in Query tab select `pyroscope-datasource`
20-
* In `Application name` input specify app name
21-
* Click `Apply`
22-
![settings](https://raw.githubusercontent.com/pyroscope-io/grafana-panel-plugin/main/docs/assets/settings.jpg)
23-
24-
Congratulations! Now you can monitor application flamegraph on your Grafana dashboard!
25-
![dashboard](https://raw.githubusercontent.com/pyroscope-io/grafana-panel-plugin/main/docs/assets/dashboard.jpg)
7+
# Releasing new versions
8+
1. Update the `UPSTREAM_BRANCH` in `build-panel.sh`
9+
2. Update CHANGELOG.md
10+
3. Bump the version in `package.json`
11+
4. Merge to the main branch.

0 commit comments

Comments
 (0)