Skip to content

Commit 766728d

Browse files
tolzhabayevCopilot
andauthored
Docs: small fixes to comply better with the grafana writers toolkit (#1827)
Co-authored-by: Copilot <[email protected]>
1 parent f5f06f5 commit 766728d

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

docusaurus/docs/how-to-guides/data-source-plugins/add-support-for-pdc.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
---
22
id: add-support-for-pdc
3-
title: Add support for Private Datasource Connect (PDC)
4-
description: Add support for private datasource connect (PDC) functionality to your Grafana plugin.
3+
title: Add support for Private Data Source Connect (PDC)
4+
description: Add support for Private Data Source Connect (PDC) functionality to your Grafana plugin.
55
keywords:
66
- grafana
77
- plugins
88
- plugin
99
- pdc
10-
- private datasource connect
10+
- private data source connect
1111
---
1212

13-
# Add support for private datasource connect (PDC)
13+
# Add support for Private Data Source Connect (PDC)
1414

1515
## What is Private Data Source Connect?
1616

17-
Private data source connect, or PDC, is a way for you to establish a private, secured connection between a Grafana Cloud instance, or stack, and data sources secured within a private network.
17+
Private Data Source connect (PDC) is a way for you to establish a private, secured connection between a Grafana Cloud instance, or stack, and data sources secured within a private network.
1818

19-
Read more about it [here](https://grafana.com/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/).
19+
Read more about [Private Data Source Connect](https://grafana.com/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/).
2020

2121
### When NOT to support PDC
2222

23-
PDC is a Grafana Cloud - only solution, so if your datasource is not available in Grafana Cloud, there is not much benefit to implementing PDC support.
23+
PDC is a Grafana Cloud-only solution, so if your data source is not available in Grafana Cloud, there is not much benefit to implementing PDC support.
2424

2525
# Adding PDC to a data source
2626

27-
PDC support must be integrated in each data source because each plugin in Grafana is responsible for establishing its own connection to the target data source. While Grafana stores the proxy configuration details (such as `proxy_address`, `server_address`, and certificates) in its config, each plugin consumes this configuration in a different way.
27+
PDC support must be integrated in each data source because each Grafana plugin is responsible for establishing its own connection to the target data source. While Grafana stores the proxy configuration details (such as `proxy_address`, `server_address`, and certificates) in its config, each plugin consumes this configuration in a different way.
2828

2929
[`grafana-plugin-sdk-go`](https://github.com/grafana/grafana-plugin-sdk-go) provides an `httpClientProvider` that automatically uses the proxy configuration, making it easier for plugins that use the HTTP client from the plugin SDK to implement PDC support. However, plugins that use other types of clients require more manual adjustments to use the proxy configuration.
3030

@@ -35,7 +35,7 @@ PDC support must be integrated in each data source because each plugin in Grafan
3535
Note: It is not possible to add PDC support to frontend data sources because the connection to the proxy is established from the backend.
3636
:::
3737

38-
- [`grafana-plugin-sdk`](https://github.com/grafana/grafana-plugin-sdk-go) version > [`0.229.0`](https://github.com/grafana/grafana-plugin-sdk-go/releases/tag/v0.229.0) is needed to get the latest changes compatible with the remote plugins. It is good practice to keep this as up to date as possible.
38+
- [`grafana-plugin-sdk`](https://github.com/grafana/grafana-plugin-sdk-go) version > [`0.229.0`](https://github.com/grafana/grafana-plugin-sdk-go/releases/tag/v0.229.0) is needed to get the latest changes compatible with the remote plugins. Keep this SDK up to date for the latest compatible changes.
3939
- Grafana version > `10.0.0`
4040

4141
## Overview
@@ -76,10 +76,10 @@ import { gte } from 'semver';
7676
gte(config.buildInfo.version, '10.0.0') && (
7777
<>
7878
<InlineField
79-
label="Secure Socks Proxy"
79+
label="Secure SOCKS Proxy"
8080
tooltip={
8181
<>
82-
Enable proxying the data source connection through the secure socks proxy to a
82+
Enable proxying the data source connection through the secure SOCKS proxy to a
8383
different network.
8484
See{' '}
8585
<a
@@ -111,7 +111,7 @@ import { gte } from 'semver';
111111
)}
112112
```
113113

114-
![That's pretty much it for the frontend changes](./images/pdc-image-editor.png)
114+
![PDC toggle option in data source configuration screen](./images/pdc-image-editor.png)
115115

116116
## Backend changes
117117

@@ -123,8 +123,8 @@ This example involves plugins that use the [`http.Client`](https://github.com/gr
123123

124124
- `HTTPClientOptions(ctx)` reads and creates an HTTP client configuration based on the context passed from the Grafana process.
125125
- `httpclient.New(opts)` calls `GetTransport()`. [Transport](https://github.com/grafana/grafana-plugin-sdk-go/blob/main/backend/httpclient/http_client.go#L90-L94) object is the one responsible for handling TLS, proxies, and other configurations within [the standard package](https://pkg.go.dev/net/http#hdr-Clients_and_Transports).
126-
- `GetTransport() uses ConfigureSecureSocksHTTPProxy()` to wrap the `Transport` object into socks5 proxy with TLS
127-
- `ConfigureSecureSocksHTTPProxy()` calls `NewSecureSocksProxyContextDialer()` which creates a socks proxy dialer.
126+
- `GetTransport() uses ConfigureSecureSocksHTTPProxy()` to wrap the `Transport` object into SOCKS5 proxy with TLS
127+
- `ConfigureSecureSocksHTTPProxy()` calls `NewSecureSocksProxyContextDialer()` which creates a SOCKS proxy dialer.
128128

129129
This will proxy every request from the client through the proxy (and therefore through PDC), and then reach the data source.
130130

@@ -145,8 +145,8 @@ func NewDatasource(ctx context.Context, s backend.DataSourceInstanceSettings) (i
145145

146146
Here are a few examples of how it was done for some data sources:
147147

148-
- [BigQuery](https://github.com/grafana/google-bigquery-datasource/pull/193/) \- an external library was used to connect to datasource in those cases, but it allowed swapping the default HTTP client. So all we had to do to configure the PDC proxy was to pass a client from the SDK.
149-
- [VictoriaMetrics Metrics Datasource](https://github.com/VictoriaMetrics/victoriametrics-datasource/releases/tag/v0.15.1)
148+
- [BigQuery](https://github.com/grafana/google-bigquery-datasource/pull/193/) \- an external library was used to connect to data source in those cases, but it allowed swapping the default HTTP client. So all we had to do to configure the PDC proxy was to pass a client from the SDK.
149+
- [VictoriaMetrics Metrics Data Source](https://github.com/VictoriaMetrics/victoriametrics-datasource/releases/tag/v0.15.1)
150150

151151
### Non-HTTP client
152152

@@ -186,23 +186,23 @@ Check if we can set the `Transport` object (usually an `http.RoundTripper`). The
186186

187187
### Testing with Grafana Cloud instance
188188

189-
**Pre-requisites:** If you do not have a grafana cloud instance to test on yet, [sign up](https://grafana.com/docs/grafana-cloud/get-started/#sign-up-for-a-grafana-cloud-account) for a free grafana cloud account instance first.
189+
**Pre-requisites:** If you do not have a Grafana Cloud instance to test on yet, [sign up](https://grafana.com/docs/grafana-cloud/get-started/#sign-up-for-a-grafana-cloud-account) for a free Grafana Cloud account instance first.
190190

191191
Once you have added PDC support and before you wish to publish your plugin into our catalog, we require you to verify that it is working as intended in Grafana Cloud to make sure our and your customers have the best experience.
192192

193-
1. Build a ready to use version of your datasource plugin that has PDC support
193+
1. Build a ready to use version of your data source plugin that has PDC support
194194
1. Reach out to us via `[email protected]` sending us your plugin version and which grafana cloud instance and organisation you want to have this plugin running on for testing.
195195
1. We provision your instance with this plugin version and let you know that you can test
196196
1. Once tested and confirmed you can go on with making this a regular release and submitting it for review
197197

198198
### Simulating / Testing locally with microsocks
199199

200-
In this case, we will use [microsocks](https://github.com/rofl0r/microsocks), which is an open sourde SOCKS server. This will not be the same as how Grafana runs in our cloud, but it shows a simpler way to do this without any internal dependency.
200+
In this case, we will use [microsocks](https://github.com/rofl0r/microsocks), which is an open source SOCKS server. This will not be the same as how Grafana runs in our cloud, but it shows a lightweight way to do this without any internal dependency.
201201

202202
Steps to run this method:
203203

204-
1. Install [microsocks](https://github.com/rofl0r/microsocks) . It can be done with \`brew install microsocks\`
205-
1. Run microsocks \-i 127.0.0.1 \-p 5555\. This will start up the socks server and await for connections.
204+
1. Install [microsocks](https://github.com/rofl0r/microsocks) . For macOS, this can be done with \`brew install microsocks\`
205+
1. Run microsocks \-i 127.0.0.1 \-p 5555\. This will start up the SOCKS server and await for connections.
206206
1. Run Grafana with this configuration.
207207

208208
```shell

0 commit comments

Comments
 (0)