Skip to content

Commit 5e2cd82

Browse files
committed
feat(docs): update OpenTelemetry self-hosted guide with new metrics and dashboard features
Enhanced the self-hosted OpenTelemetry documentation by adding a sample Grafana dashboard for visualizing metrics from Gate. Updated configuration details for the OpenTelemetry Collector, including new metrics endpoints and improved instructions for setting up Prometheus scraping. Removed outdated Kubernetes configuration examples and added new YAML files for the OpenTelemetry Collector setup. Updated the documentation to reflect changes in metrics collection and visualization capabilities.
1 parent 348db2f commit 5e2cd82

File tree

22 files changed

+261
-454
lines changed

22 files changed

+261
-454
lines changed

.web/docs/.vitepress/config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default defineConfig({
4848
],
4949

5050
vue: {
51-
reactivityTransform: true,
51+
// reactivityTransform: true, // This option is deprecated
5252
},
5353

5454
themeConfig: {
@@ -190,6 +190,10 @@ export default defineConfig({
190190
text: 'Self-hosted',
191191
link: '/guide/otel/self-hosted/',
192192
},
193+
{
194+
text: 'Dashboards',
195+
link: '/guide/otel/self-hosted/dashboard',
196+
},
193197
{
194198
text: 'FAQ',
195199
link: '/guide/otel/faq/',

.web/docs/guide/otel/index.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
# OpenTelemetry
22

3-
Gate uses OpenTelemetry for observability, leveraging the [otel-config-go](https://github.com/honeycombio/otel-config-go) library for configuration. This provides a simple way to configure tracing and metrics collection through environment variables.
3+
OpenTelemetry is an observability framework and toolkit designed to facilitate the generation, export, and collection of telemetry data such as traces, metrics, and logs. It is an open-source and vendor-agnostic project, meaning it can be used with a broad variety of observability backends, including open-source tools like Jaeger and Prometheus, as well as commercial offerings. A major goal of OpenTelemetry is to enable easy instrumentation of applications and systems, regardless of the programming language, infrastructure, and runtime environments used. OpenTelemetry itself is not an observability backend; the storage and visualization of telemetry data are intentionally left to other tools. ([Source](https://opentelemetry.io/docs/what-is-opentelemetry/))
4+
5+
::: info
6+
Gate utilizes OpenTelemetry for its observability capabilities. For configuration, Gate leverages the [otel-config-go](https://github.com/honeycombio/otel-config-go) library, which offers a straightforward method to set up tracing and metrics collection via [environment variables](#configuration).
7+
:::
48

59
# Start Generation Here
610

711
![OpenTelemetry Architecture](https://mermaid.ink/svg/pako:eNp9kl1vgjAUhv9Kc65cgoYvGXCxRNF4o9FNsouJFx1UbEZbUiCZGv_7CrhJ1KxX7XPe856e9pwgFgkBH1KJ8z2av0UcqVVUny2IYJTnGY1xSQWPoI3Wa7SZ4ZJsW0B4EvG7zJBkhJFSHlAgsozEtxbjzTIn_E4l5L-uC8Gp0lCeojGOv5So6JoGmwhmEu8wx2hBGZWot1DuNC6eIthedZOOLiQsF6gXShyTjuxx_XdaVDijx7sXmXYcl-v1I5sR6vfRMpyv0LXrfv8FjdvwuA5fbtvwoMPb2zV40uKgxisp2Ou8wdMWT27UU9CAEckwTdQ_n2pRBOVelY_AV9uMpvuybuSshLgqxfrAY_BLWRENpKjSPfg7nBXqVOWJ-vQJxeox2B_NMf8Qgv2mpLIudElXzRMZiIqX4FtOowX_BN_ge87AdoaGZViOZ1qO_azBAXzbGHiOaerPumXZpqsbw7MGx8ZdH7i6Z1i27jiGbruupwFJ6lFYtBPcDPL5B1Gd2L4)
812

913
## Configuration
1014

11-
Gate's OpenTelemetry implementation can be configured using the following environment variables:
12-
13-
| Environment Variable | Required | Default | Description |
14-
| --------------------------- | -------- | ---------------------- | ------------------------------------- |
15-
| OTEL_SERVICE_NAME | No | `gate` | Name of your service |
16-
| OTEL_SERVICE_VERSION | No | - | Version of your service |
17-
| OTEL_EXPORTER_OTLP_ENDPOINT | No | `localhost:4317` | Endpoint for OTLP export |
18-
| OTEL_LOG_LEVEL | No | `info` | Logging level |
19-
| OTEL_PROPAGATORS | No | `tracecontext,baggage` | Configured propagators |
20-
| OTEL_METRICS_ENABLED | No | `true` | Enable metrics collection |
21-
| OTEL_TRACES_ENABLED | No | `true` | Enable trace collection |
22-
| OTEL_METRICS_SERVER_ENABLED | No | `false` | Enable Prometheus metrics server |
23-
| OTEL_METRICS_SERVER_PATH | No | `/metrics` | Path for Prometheus metrics endpoint |
24-
| OTEL_METRICS_SERVER_ADDR | No | `:9464` | Address for Prometheus metrics server |
15+
Gate's OpenTelemetry implementation can be configured using the following [environment variables](https://github.com/honeycombio/otel-config-go/blob/127951890a85db4effad9fbc961d0f09ddd8a818/otelconfig/otelconfig.go#L304):
16+
17+
| Environment Variable | Required | Default | Description |
18+
| --------------------------- | -------- | ---------------------- | ------------------------- |
19+
| OTEL_SERVICE_NAME | No | `gate` | Name of your service |
20+
| OTEL_SERVICE_VERSION | No | - | Version of your service |
21+
| OTEL_EXPORTER_OTLP_ENDPOINT | No | `localhost:4317` | Endpoint for OTLP export |
22+
| OTEL_LOG_LEVEL | No | `info` | Logging level |
23+
| OTEL_PROPAGATORS | No | `tracecontext,baggage` | Configured propagators |
24+
| OTEL_METRICS_ENABLED | No | `true` | Enable metrics collection |
25+
| OTEL_TRACES_ENABLED | No | `true` | Enable trace collection |
2526

2627
Additional environment variables for exporters:
2728

@@ -30,12 +31,12 @@ Additional environment variables for exporters:
3031
| OTEL_EXPORTER_OTLP_HEADERS | No | `{}` | Global headers for OTLP exporter |
3132
| OTEL_EXPORTER_OTLP_TRACES_HEADERS | No | `{}` | Headers specific to trace exporter |
3233
| OTEL_EXPORTER_OTLP_METRICS_HEADERS | No | `{}` | Headers specific to metrics exporter |
33-
| OTEL_EXPORTER_OTLP_PROTOCOL | No | `grpc` | Protocol for OTLP export (grpc/http) |
3434
| OTEL_EXPORTER_OTLP_TRACES_ENDPOINT | No | `localhost:4317` | Endpoint for trace export |
3535
| OTEL_EXPORTER_OTLP_TRACES_INSECURE | No | `false` | Allow insecure trace connections |
3636
| OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | No | `localhost:4317` | Endpoint for metrics export |
3737
| OTEL_EXPORTER_OTLP_METRICS_INSECURE | No | `false` | Allow insecure metrics connections |
3838
| OTEL_EXPORTER_OTLP_METRICS_PERIOD | No | `30s` | Metrics reporting interval |
39+
| OTEL_EXPORTER_OTLP_PROTOCOL | No | `grpc` | Protocol for OTLP export |
3940
| OTEL_RESOURCE_ATTRIBUTES | No | - | Additional resource attributes |
4041

4142
## Example Configuration
@@ -53,15 +54,19 @@ OTEL_RESOURCE_ATTRIBUTES="deployment.environment=production"
5354

5455
You can use various solutions to collect and visualize OpenTelemetry data. Here are some popular options:
5556

56-
### Cloud Solutions
57+
### Detailed Setup Guides
5758

58-
::: info <VPBadge>Our recommendations</VPBadge>
59+
::: info <VPBadge>We provide detailed guides for these three solutions</VPBadge>
5960

6061
- [Grafana Cloud](/guide/otel/grafana-cloud/) - Fully managed observability platform with support for metrics, logs, and traces
6162
- [Honeycomb](/guide/otel/honeycomb/) - Observability platform designed for debugging complex systems
63+
- [Self-hosted](/guide/otel/self-hosted/) - Run your own OpenTelemetry collector and visualize data with Grafana
6264

6365
:::
6466

67+
### Other Cloud Solutions
68+
69+
- [Signoz](https://signoz.io/) - Open source observability platform with support for metrics, logs, and traces
6570
- [New Relic](https://newrelic.com/) - Full-stack observability platform with APM capabilities
6671
- [Datadog](https://www.datadog.com/) - Cloud monitoring and analytics platform
6772
- [Azure Monitor](https://azure.microsoft.com/services/monitor/) - Microsoft's cloud-native monitoring solution
@@ -129,9 +134,6 @@ You can use various solutions to collect and visualize OpenTelemetry data. Here
129134
# Secure endpoint configuration
130135
OTEL_EXPORTER_OTLP_ENDPOINT="https://otel-collector.example.com:4317"
131136
OTEL_EXPORTER_OTLP_HEADERS="api-key=secret123,tenant=team-a"
132-
133-
# Ensure TLS is enabled
134-
OTEL_EXPORTER_OTLP_INSECURE=false
135137
```
136138

137139
## Further Reading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Sample Gate Dashboard
2+
3+
<!--@include: ./grafana-dash.md -->
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
We provide a sample Grafana dashboard to help you get started with visualizing Gate's metrics.
3+
4+
::: info <VPBadge>You are expected to make your own dashboard, this is just a starting point.</VPBadge>
5+
6+
![Grafana Dashboard](/images/grafana-gate-dash.png)
7+
8+
:::
9+
10+
**Dashboard Features:**
11+
12+
- Total Player Count (`proxy_player_count`)
13+
- Gate Instance Status (`up`)
14+
- Go Goroutines (`go_goroutines`)
15+
- Go Memory Usage (`go_memstats_alloc_bytes`)
16+
17+
**Get the Dashboard JSON:**
18+
19+
- **Download Raw JSON:** [Download Dashboard JSON](https://raw.githubusercontent.com/minekube/gate/master/.web/docs/guide/otel/self-hosted/grafana-dashboards/gate-overview-dashboard.json)
20+
- **View on GitHub:** [gate-overview-dashboard.json](https://github.com/minekube/gate/blob/master/.web/docs/guide/otel/self-hosted/grafana-dashboards/gate-overview-dashboard.json)
21+
22+
If you have cloned the repository, you can also find the dashboard at `.web/docs/guide/otel/self-hosted/grafana-dashboards/gate-overview-dashboard.json` within your local copy.
23+
24+
**Importing the Dashboard:**
25+
26+
1. Navigate to your Grafana instance (usually http://localhost:3000).
27+
2. Log in (default: admin/admin, then change the password).
28+
3. On the left-hand menu, go to **Dashboards**.
29+
4. On the Dashboards page, click the **"New"** button in the top right and select **"Import"**.
30+
![Grafana Menu Dashboards](/images/grafana-new-dash.png)
31+
5. Click the **"Upload JSON file"** button and select the `gate-overview-dashboard.json` file you downloaded, or paste the JSON content directly into the text area.
32+
6. On the next screen, you can change the dashboard name if desired.
33+
7. **Important:** Select your Prometheus data source from the dropdown (usually named "Prometheus").
34+
![Grafana Import Dashboard](/images/grafana-import-dash.png)
35+
8. Click **"Import"**.
36+
37+
You should now see the "Gate Overview" dashboard with panels visualizing metrics from your Gate instance(s).

.web/docs/guide/otel/self-hosted/grafana-dashboards/gate-overview-dashboard.json

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"type": "prometheus",
100100
"uid": "${DS_PROMETHEUS}"
101101
},
102-
"expr": "sum(proxy_player_count{job=\"gate\"}) by (job)",
102+
"expr": "sum(otel_gate_player_count_ratio{job=\"otel-collector\", service_name=~\"$service_name_filter\"})",
103103
"legendFormat": "Total Players",
104104
"refId": "A"
105105
}
@@ -117,23 +117,7 @@
117117
"color": {
118118
"mode": "thresholds"
119119
},
120-
"mappings": [
121-
{
122-
"options": {
123-
"0": {
124-
"color": "red",
125-
"index": 0,
126-
"text": "Down"
127-
},
128-
"1": {
129-
"color": "green",
130-
"index": 1,
131-
"text": "Up"
132-
}
133-
},
134-
"type": "value"
135-
}
136-
],
120+
"mappings": [],
137121
"thresholds": {
138122
"mode": "absolute",
139123
"steps": [
@@ -155,15 +139,13 @@
155139
},
156140
"id": 4,
157141
"options": {
158-
"colorMode": "value",
159-
"graphMode": "area",
160-
"justifyMode": "auto",
161-
"orientation": "auto",
162142
"reduceOptions": {
163143
"calcs": ["lastNotNull"],
164-
"fields": "/^up$/",
144+
"fields": "",
165145
"values": false
166146
},
147+
"showThresholdLabels": false,
148+
"showThresholdMarkers": true,
167149
"textMode": "auto"
168150
},
169151
"pluginVersion": "10.2.2",
@@ -173,12 +155,12 @@
173155
"type": "prometheus",
174156
"uid": "${DS_PROMETHEUS}"
175157
},
176-
"expr": "up{job=\"gate\"}",
177-
"legendFormat": "{{instance}}",
158+
"expr": "sum(otel_gate_registered_servers_ratio{job=\"otel-collector\", service_name=~\"$service_name_filter\"})",
159+
"legendFormat": "Registered Servers",
178160
"refId": "A"
179161
}
180162
],
181-
"title": "Gate Instance Status (up)",
163+
"title": "Registered Servers",
182164
"type": "stat"
183165
},
184166
{
@@ -264,8 +246,8 @@
264246
"type": "prometheus",
265247
"uid": "${DS_PROMETHEUS}"
266248
},
267-
"expr": "sum(go_goroutines{job=\"gate\"}) by (instance)",
268-
"legendFormat": "{{instance}}",
249+
"expr": "sum(otel_process_runtime_go_goroutines{job=\"otel-collector\", service_name=~\"$service_name_filter\"}) by (service_name, instance, exported_job)",
250+
"legendFormat": "{{service_name}} {{exported_job}} {{instance}}",
269251
"refId": "A"
270252
}
271253
],
@@ -355,8 +337,8 @@
355337
"type": "prometheus",
356338
"uid": "${DS_PROMETHEUS}"
357339
},
358-
"expr": "sum(go_memstats_alloc_bytes{job=\"gate\"}) by (instance)",
359-
"legendFormat": "{{instance}}",
340+
"expr": "sum(otel_process_runtime_go_mem_heap_alloc_bytes{job=\"otel-collector\", service_name=~\"$service_name_filter\"}) by (service_name, instance, exported_job)",
341+
"legendFormat": "{{service_name}} {{exported_job}} {{instance}}",
360342
"refId": "A"
361343
}
362344
],
@@ -394,16 +376,16 @@
394376
"type": "prometheus",
395377
"uid": "${DS_PROMETHEUS}"
396378
},
397-
"definition": "label_values(up{job=\"gate\"}, job)",
379+
"definition": "label_values(otel_process_runtime_go_goroutines{job=\"otel-collector\"}, service_name)",
398380
"hide": 0,
399381
"includeAll": true,
400-
"label": "Job",
382+
"label": "Service Name",
401383
"multi": true,
402-
"name": "job",
384+
"name": "service_name_filter",
403385
"options": [],
404386
"query": {
405-
"query": "label_values(up{job=\"gate\"}, job)",
406-
"refId": "StandardVariableQuery"
387+
"query": "label_values(otel_process_runtime_go_goroutines{job=\"otel-collector\"}, service_name)",
388+
"refId": "StandardVariableQuery_ServiceName"
407389
},
408390
"refresh": 1,
409391
"regex": "",

0 commit comments

Comments
 (0)