Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Using React Tools debugger with Grafana #1559

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions docusaurus/docs/how-to-guides/debugging-plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
id: debugging-plugins
title: Add anonymous usage reporting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title should match the H1 on line 12

description: How to add anonymous usage tracking to your Grafana plugin.
keywords:
- grafana
- plugins
- plugin
- debugging
---

# How to set up Grafana for React Tools profiling and debugging

Using the React Tools debugger in the browser is very useful when either creating a new plugin or troubleshooting an issue with an existing plugin.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Using the React Tools debugger in the browser is very useful when either creating a new plugin or troubleshooting an issue with an existing plugin.
The React Tools debugger in the browser is invaluable for developing new Grafana plugins and troubleshooting existing ones.


## Setup for debugging

By default Grafana docker images do not include a debug build for React.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default Grafana docker images do not include a debug build for React.
By default, Grafana Docker images do not contain a React debug build.


By using a debug build of grafana you are able to easily step through code that has not been "uglified" and also use the "Profiler" in React Dev Tools.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what "uglified" means or why Profiler is in quotes. If Profiler is a UI element, you can put it in bold.


To use a debug build, update your `docker-compose.yml` with the corresponding version found on hub.docker.com.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To use a debug build, update your `docker-compose.yml` with the corresponding version found on hub.docker.com.
To use a debug build, update your `docker-compose.yml` with the corresponding version found on [hub.docker.com](https://hub.docker.com/).


If your plugin supports and older (supported) release, locate the tag using search option (this matches v10.2).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If your plugin supports and older (supported) release, locate the tag using search option (this matches v10.2).
If your plugin supports an older but still supported release, use the search option to locate the corresponding tag (for example, v10.2).


### Grafana OSS

For v10.2+ OSS
[v10.2+ OSS](https://hub.docker.com/repository/docker/grafana/grafana-oss-dev/tags?name=10.2)

For 11.5+ OSS
[v11.5+ OSS](https://hub.docker.com/repository/docker/grafana/grafana-oss-dev/tags?name=11.5)

```YAML
services:
grafana:
image: grafana/grafana-oss-dev:11.5.0-221762
...
```

Alternatively you can use an environment variable and not modify the existing docker-compose.yml file:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you can use an environment variable instead of modifying the existing docker-compose.yml file:


```SHELL
export GRAFANA_IMAGE=grafana-oss-dev
export GRAFANA_VERSION=11.5.0-221762
```

### Grafana Enterprise

Enterprise supports additional API calls, use this type of image when your plugin relies on Enterprise features.

For v10.2+ Enterprise
[v10.2+ Enterprise](https://hub.docker.com/repository/docker/grafana/grafana-enterprise-dev/tags?name=10.2)

For 11.5+ Enterprise
[v11.5+ Enterprise](https://hub.docker.com/repository/docker/grafana/grafana-enterprise-dev/tags?name=11.5)

```YAML
services:
grafana:
image: grafana/grafana-enterprise-dev:11.5.0-82747
...
```

Alternatively you can use an environment variable and not modify the existing docker-compose.yml file:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Alternatively you can use an environment variable and not modify the existing docker-compose.yml file:
Alternatively, you can use an environment variable without modifying the existing `docker-compose.yml` file:


```SHELL
export GRAFANA_IMAGE=grafana-enterprise-dev
export GRAFANA_VERSION=11.5.0-82747
```

## Using React Tools

Once your docker environment has started up, navigate to the instance and select
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once your docker environment has started up, navigate to the instance and select
After your Docker environment starts, go to the instance and select


`View->Developer->Developer Tools`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`View->Developer->Developer Tools`
**View** > **Developer** > **Developer Tools**.


You can now use the "Profiler" tab in the debugging tools, which provides Flamegraph, Ranked, and Timeline options.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can now use the "Profiler" tab in the debugging tools, which provides Flamegraph, Ranked, and Timeline options.
You can now use the **Profiler** tab in the debugging tools, which provides Flamegraph, Ranked, and Timeline options.

1 change: 1 addition & 0 deletions docusaurus/docs/how-to-guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ keywords:
- panel
- app
- ui extensions
- debugging
---

Learn how to extend Grafana plugins with additional functionality and capabilities with short guides.
Expand Down
Loading