You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/how-to-guides/data-source-plugins/add-support-for-pdc.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,30 @@
1
1
---
2
2
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.
5
5
keywords:
6
6
- grafana
7
7
- plugins
8
8
- plugin
9
9
- pdc
10
-
- private datasource connect
10
+
- private data source connect
11
11
---
12
12
13
-
# Add support for private datasource connect (PDC)
13
+
# Add support for Private Data Source Connect (PDC)
14
14
15
15
## What is Private Data Source Connect?
16
16
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.
18
18
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/).
20
20
21
21
### When NOT to support PDC
22
22
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.
24
24
25
25
# Adding PDC to a data source
26
26
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.
28
28
29
29
[`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.
30
30
@@ -35,7 +35,7 @@ PDC support must be integrated in each data source because each plugin in Grafan
35
35
Note: It is not possible to add PDC support to frontend data sources because the connection to the proxy is established from the backend.
36
36
:::
37
37
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.
39
39
- Grafana version > `10.0.0`
40
40
41
41
## Overview
@@ -76,10 +76,10 @@ import { gte } from 'semver';
76
76
gte(config.buildInfo.version, '10.0.0') && (
77
77
<>
78
78
<InlineField
79
-
label="Secure Socks Proxy"
79
+
label="Secure SOCKS Proxy"
80
80
tooltip={
81
81
<>
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
83
83
different network.
84
84
See{''}
85
85
<a
@@ -111,7 +111,7 @@ import { gte } from 'semver';
111
111
)}
112
112
```
113
113
114
-

114
+

115
115
116
116
## Backend changes
117
117
@@ -123,8 +123,8 @@ This example involves plugins that use the [`http.Client`](https://github.com/gr
123
123
124
124
-`HTTPClientOptions(ctx)` reads and creates an HTTP client configuration based on the context passed from the Grafana process.
125
125
-`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.
128
128
129
129
This will proxy every request from the client through the proxy (and therefore through PDC), and then reach the data source.
130
130
@@ -145,8 +145,8 @@ func NewDatasource(ctx context.Context, s backend.DataSourceInstanceSettings) (i
145
145
146
146
Here are a few examples of how it was done for some data sources:
147
147
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.
-[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)
150
150
151
151
### Non-HTTP client
152
152
@@ -186,23 +186,23 @@ Check if we can set the `Transport` object (usually an `http.RoundTripper`). The
186
186
187
187
### Testing with Grafana Cloud instance
188
188
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.
190
190
191
191
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.
192
192
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
194
194
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.
195
195
1. We provision your instance with this plugin version and let you know that you can test
196
196
1. Once tested and confirmed you can go on with making this a regular release and submitting it for review
197
197
198
198
### Simulating / Testing locally with microsocks
199
199
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.
201
201
202
202
Steps to run this method:
203
203
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.
0 commit comments