Skip to content

Commit ab4c50b

Browse files
tonyoAJ
authored andcommitted
relay: Next iteration of refactoring (#2365)
1 parent 1ae53c7 commit ab4c50b

File tree

7 files changed

+193
-113
lines changed

7 files changed

+193
-113
lines changed

src/docs/product/relay/getting-started.mdx

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Releases](https://github.com/getsentry/relay/releases). A Docker image is provid
2121

2222
To create the initial configuration, use Relay's `relay config init` command,
2323
which puts configuration files in the `.relay` folder under the current working
24-
directory.
24+
directory.
2525

2626
<Note>
2727

@@ -33,6 +33,14 @@ container and copying in the files.
3333
</Note>
3434

3535
```shell {tabTitle:Run in Docker}
36+
# Adjust permissions for the configuration directory
37+
docker run --rm -it \
38+
-v $(pwd)/config/:/work/.relay/ \
39+
--entrypoint bash \
40+
getsentry/relay \
41+
-c 'chown -R relay:relay /work/.relay'
42+
43+
# Generate the configuration
3644
docker run --rm -it \
3745
-v $(pwd)/config/:/work/.relay/ \
3846
getsentry/relay \
@@ -66,7 +74,18 @@ _"create custom config"_ and customizing these parameters:
6674
Settings are recorded in `.relay/config.yml`. Note that all configuration values
6775
are optional and default to these settings:
6876

69-
```yaml
77+
```yaml {tabTitle:Run in Docker}
78+
relay:
79+
mode: managed
80+
upstream: "https://sentry.io/"
81+
host: 0.0.0.0
82+
port: 3000
83+
tls_port: ~
84+
tls_identity_path: ~
85+
tls_identity_password: ~
86+
```
87+
88+
```yaml {tabTitle:Run Executable}
7089
relay:
7190
mode: managed
7291
upstream: "https://sentry.io/"
@@ -96,7 +115,7 @@ A typical credentials file is similar to this example:
96115
```json
97116
{
98117
"secret_key": "5gkTAfwOrJ0lMy9aOAOmHKO1k6gd8ApYkAInmg5VfWk",
99-
"public_key": "fQzvlvqLM2pJwLDwM_sXD2Lk5swzx-Oml4WhsOquon4",
118+
"public_key": "nDJI79SbEYH9-8NEJAI7ezrgYfoIPW3Bnkg00k1z0fA",
100119
"id": "cde0d72e-0c4e-4550-a934-c1867d8a177c"
101120
}
102121
```
@@ -144,10 +163,6 @@ This process registers Relay with Sentry so it is ready to send messages. See
144163

145164
## Running Relay
146165

147-
You can either run the Relay binary directly or using a Docker image.
148-
149-
### Running Relay Directly
150-
151166
After registering Relay with Sentry, it is ready to run:
152167

153168
```shell {tabTitle:Run in Docker}
@@ -167,17 +182,19 @@ Under default configuration, Relay emits log output similar to:
167182
```
168183
INFO relay::setup > launching relay from config folder .relay
169184
INFO relay::setup > relay mode: managed
170-
INFO relay::setup > relay id: f2119bc9-9a9b-4531-826b-24e9794902f2
171-
INFO relay::setup > public key: QPBITKKtKUuEZGGbPke8iufEXAcVrEv6nmWrkRtc3l8
185+
INFO relay::setup > relay id: cde0d72e-0c4e-4550-a934-c1867d8a177c
186+
INFO relay::setup > public key: nDJI79SbEYH9-8NEJAI7ezrgYfoIPW3Bnkg00k1z0fA
172187
...
173188
INFO relay_server::actors::upstream > relay successfully registered with upstream
174189
```
175190

191+
Refer to the [Logging](/product/relay/monitoring/#logging) page for more information on how to configure Relay's logging.
192+
176193
If you moved your config folder (for example, for security reasons), use the `--config` option to specify the location:
177194

178195
```shell {tabTitle:Run in Docker}
179196
docker run --rm -it \
180-
-v $(pwd)/config/:/work/.relay/ \
197+
-v $(pwd)/config/:/etc/relay/ \
181198
-p 3000:3000 \
182199
getsentry/relay \
183200
run --config /etc/relay/
@@ -187,66 +204,41 @@ docker run --rm -it \
187204
./relay run --config /etc/relay/
188205
```
189206

190-
## Logging
191-
192-
Once Relay is running, you will receive `INFO` messages, such as:
193-
194-
```
195-
INFO relay::setup > launching relay from config folder .relay
196-
INFO relay::setup > relay mode: managed
197-
INFO relay::setup > relay id: f2119bc9-9a9b-4531-826b-24e9794902f2
198-
INFO relay::setup > log level: INFO
199-
```
200-
201-
This example displays the default logging level, which you can modify so it displays either more or less information. For details about configuring logging please see [Logging](/product/relay/options/#logging) on the options page.
202-
203-
## Health Checks
204-
205-
Relay provides two URLs for checking system status:
206-
207-
- `GET /api/relay/healthcheck/live/`: Tests if Relay is running and listening to
208-
HTTP requests.
209-
- `GET /api/relay/healthcheck/ready/`: Tests if Relay is authenticated with the
210-
upstream and operating normally.
211-
212-
In case of success, both endpoints return a _200 OK_ response:
213-
214-
```json
215-
{
216-
"is_healthy": true
217-
}
218-
```
219-
220207
## Sending a Test Event
221208

222-
Once Relay is running and authenticated with Sentry, send a test event.
209+
Once Relay is running and authenticated with Sentry, send a test event to one of the projects in your organization.
223210

224-
Get the DSN of your project by navigating to _Project Settings > Client Keys
225-
(DSN)_, which looks similar to:
211+
Get the DSN of your project by navigating to your project settings at _Settings > Projects > {YOUR_PROJECT_NAME} > Client Keys (DSN)_, and select one of the existing DSNs, which looks similar to:
226212

227-
```
228-
https://[email protected]/2244
229-
```
213+
`https://[email protected]/2345`
230214

231215
Next, replace parts of the DSN to match the address at which Relay is reachable.
232216
For instance, if Relay listens at `http://localhost:3000`, change the protocol
233217
and host of the DSN to:
234218

235-
```
236-
http://12345abcdb1e4c123490ecec89c1f199@localhost:3000/2244
237-
```
219+
<p>
220+
<code>
221+
<strong><i>http</i></strong>
222+
://12345abcdef10111213141516171819@
223+
<strong><i>localhost:3000</i></strong>
224+
/2345
225+
</code>
226+
</p>
238227

239228
Use the new DSN in your SDK configuration. To test this, you can send a message
240-
with `sentry-cli`:
229+
with `sentry-cli` ([installation instructions](/cli/installation/)):
241230

242231
```shell
243-
export SENTRY_DSN='http://12345abcdb1e4c123490ecec89c1f199@127.0.0.1:3000/2244'
232+
export SENTRY_DSN='http://12345abcdef10111213141516171819@127.0.0.1:3000/2345'
244233
sentry-cli send-event -m 'A test event'
245234
```
246235

247236
In a few seconds, the event should appear in the issues stream in your
248237
project.
249238

250-
## Advanced Configuration
251239

252-
<PageGrid />
240+
## Next Steps
241+
242+
- **[Learn more about our Operating Guidelines](/product/relay/operating-guidelines/)**
243+
244+
With a working Relay instance, you can both monitor and scale your Relay setup.

src/docs/product/relay/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Sentry Relay offers enterprise-grade data security by providing a standalone ser
1010

1111
Relay is specifically designed to:
1212

13-
- Scrub personal information in a central place prior to sending it to Sentry, adding to the places Sentry already scrubs PII
13+
- Scrub personally identifiable information (PII) in a central place prior to sending it to Sentry
1414
- Improve event response time in regions with low bandwidth or limited connectivity
1515
- Act as an opaque proxy for organizations that restrict all HTTP communication to a custom domain name
1616

@@ -63,6 +63,6 @@ Relay responds very quickly to requests. Installing Relay close to your infrastr
6363

6464
By default, SDKs need to be configured with a Data Source Name (DSN) that points to `sentry.io`. If you need to restrict all HTTP communication to a custom domain name, Relay can act as an opaque proxy that reliably forwards events to Sentry.
6565

66-
## Configuration
66+
## Next Steps
6767

6868
<PageGrid />

src/docs/product/relay/metrics.mdx

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Collected Metrics
3+
description: "Learn what metrics Relay produces."
4+
sidebar_order: 3
5+
redirect_from:
6+
- /meta/relay/metrics/
7+
---
8+
9+
Relay collects the following metrics:
10+
11+
<RelayMetrics />
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: Monitoring
3+
description: "Configure logging, metrics, and error reporting for your Relay installation."
4+
sidebar_order: 3
5+
redirect_from:
6+
- /meta/relay/logging/
7+
---
8+
## Logging
9+
10+
Relay produces logs to the standard error stream (`stderr`), with `INFO` logging level by default.
11+
For example, after starting Relay you may see output such as this:
12+
13+
```
14+
INFO relay::setup > launching relay from config folder .relay
15+
INFO relay::setup > relay mode: managed
16+
INFO relay::setup > relay id: cde0d72e-0c4e-4550-a934-c1867d8a177c
17+
INFO relay::setup > log level: INFO
18+
```
19+
20+
This example displays the messages with the default logging level (`INFO`), which you can modify so it displays either more or less information. For details about configuring logging please see the [Logging](/product/relay/options/#logging) section on the options page.
21+
22+
## Error Reporting
23+
24+
By default, Relay logs errors to the configured logger. You can enable error
25+
reporting to your project in Sentry in the Relay configuration file:
26+
27+
```yaml
28+
sentry:
29+
enabled: true
30+
dsn: <your_dsn>
31+
```
32+
33+
More information about available options and their meaning can be found [on the options page](/product/relay/options/#internal-error-reporting).
34+
35+
## Health Checks
36+
37+
Relay provides two URLs for checking system status:
38+
39+
- `GET /api/relay/healthcheck/live/`: Tests if Relay is running and listening to
40+
HTTP requests.
41+
- `GET /api/relay/healthcheck/ready/`: Tests if Relay is authenticated with the
42+
upstream and operating normally.
43+
44+
Both endpoints return a _200 OK_ response when successful:
45+
46+
```json
47+
{
48+
"is_healthy": true
49+
}
50+
```
51+
52+
## Metrics
53+
54+
You can submit stats to a StatsD server by configuring the `metrics.statsd` key to an `ip:port` tuple.
55+
can be set to an `ip:port` tuple.
56+
57+
### Example Configuration
58+
59+
```yaml
60+
metrics:
61+
# Endpoint of your StatsD server
62+
statsd: 127.0.0.1:8126
63+
# Prefix all metric names with this string
64+
prefix: mycompany.relay
65+
```
66+
67+
The options for configuring metrics reporting are documented on the [options page](/product/relay/options/#statsd-metrics).
68+
69+
## Learn More
70+
71+
<PageGrid />

0 commit comments

Comments
 (0)