Skip to content

Commit d9012c8

Browse files
authored
feat: document server flags (#881)
1 parent dc70d62 commit d9012c8

File tree

5 files changed

+428
-57
lines changed

5 files changed

+428
-57
lines changed

.github/workflows/docs-test.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,19 @@ jobs:
2727
vale: true
2828
# Doesn't yet work on forks.
2929
readability: false
30+
31+
flags-up-to-date:
32+
name: Flags up to date
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: read
36+
steps:
37+
- uses: actions/checkout@v6
38+
with:
39+
persist-credentials: false
40+
- uses: actions/setup-go@v6
41+
with:
42+
go-version-file: go.mod
43+
cache: false
44+
- run: go run ./scripts/help-documentation/
45+
- run: git diff --exit-code docs/

docs/sources/flags.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
description: Flags for the grafana-image-renderer service
3+
keywords:
4+
- grafana
5+
- image
6+
- rendering
7+
- plugin
8+
- troubleshooting
9+
labels:
10+
products:
11+
- enterprise
12+
- oss
13+
menuTitle: Flags
14+
title: Image rendering flags
15+
weight: 300
16+
---
17+
18+
# Image rendering flags
19+
20+
This section aims to list the entire set of flags that can be used to configure the image rendering service.
21+
22+
## Configuration format
23+
24+
To configure the service, any of the following methods can be used:
25+
26+
- Set CLI flags. These are passed in on the command line, and take complete precedence over all other methods.
27+
For example, `--server.addr=":8081"` sets the HTTP address to listen on all interfaces on port `8081`.
28+
- Set environment variables. These are set in the environment.
29+
If environment variables are supported for a flag, they are listed in the help command.
30+
- Write a JSON or YAML configuration file. These must be named `config.json`, `config.yaml`, or `config.yml`.
31+
There should only be one file; precedence is undefined if multiple files are present.
32+
Dot-separated keys are nested keys. For example, the flag `a.b` becomes `{"a": {"b": "VALUE"}}` in the file.
33+
The configuration keys are always mentioned in the help command alongside the flag.
34+
35+
For example, a complete configuration file might look like this in YAML:
36+
37+
```yaml
38+
server:
39+
addr: ":8081" # server.addr
40+
auth-token: # server.auth-token
41+
- "a"
42+
- "b"
43+
```
44+
45+
## List of flags
46+
47+
The following is a complete list of all flags that are currently supported in the latest release.
48+
This is a verbatim copy of the output of the `grafana-image-renderer server --help` command.
49+
50+
```
51+
--browser.flag=<string> / --browser.flags=<string> [${BROWSER_FLAG}]
52+
Flags to pass to the browser. These are syntaxed `${flag}` or `${flag}=${value}`. [config: browser.flag]
53+
--browser.gpu [${BROWSER_GPU}]
54+
Enable GPU support in the browser. [config: browser.gpu]
55+
--browser.header=<string> / --browser.headers=<string> [${BROWSER_HEADER}]
56+
Headers to add to every request the browser makes. Syntax is `${key}=${value}`. May be repeated. [config: browser.header]
57+
--browser.max-height=<int> [${BROWSER_MAX_HEIGHT}]
58+
The maximum height of the browser viewport. Requests cannot request a larger height than this, except for when capturing full-page screenshots. Negative means ignored. [config: browser.max-height]
59+
--browser.max-width=<int> [${BROWSER_MAX_WIDTH}]
60+
The maximum width of the browser viewport. Requests cannot request a larger width than this. Negative means ignored. [config: browser.max-width]
61+
--browser.min-height=<int> [${BROWSER_MIN_HEIGHT}]
62+
The minimum height of the browser viewport. This is the default height in requests. [config: browser.min-height]
63+
--browser.min-width=<int> [${BROWSER_MIN_WIDTH}]
64+
The minimum width of the browser viewport. This is the default width in requests. [config: browser.min-width]
65+
--browser.namespaced [${BROWSER_NAMESPACED}]
66+
Enable namespacing the browser. This requires Linux and the CAP_SYS_ADMIN and CAP_SYS_CHROOT capabilities, or a privileged user. [config: browser.namespaced]
67+
--browser.page-scale-factor=<float> [${BROWSER_PAGE_SCALE_FACTOR}]
68+
The page scale factor of the browser. [config: browser.page-scale-factor]
69+
--browser.path=<string> [${BROWSER_PATH}]
70+
The path to the browser's binary. This is resolved against PATH. [config: browser.path]
71+
--browser.portrait [${BROWSER_PORTRAIT}]
72+
Use a portrait viewport instead of the default landscape. [config: browser.portrait]
73+
--browser.readiness.disable-dom-hashcode-wait [${BROWSER_READINESS_DISABLE_DOM_HASHCODE_WAIT}]
74+
Disable waiting for the DOM to stabilize (i.e. not change) before capturing. [config: browser.readiness.disable-dom-hashcode-wait]
75+
--browser.readiness.disable-network-wait [${BROWSER_READINESS_DISABLE_NETWORK_WAIT}]
76+
Disable waiting for network requests to finish before capturing. [config: browser.readiness.disable-network-wait]
77+
--browser.readiness.disable-query-wait [${BROWSER_READINESS_DISABLE_QUERY_WAIT}]
78+
Disable waiting for queries to finish before capturing. [config: browser.readiness.disable-query-wait]
79+
--browser.readiness.dom-hashcode-timeout=<duration> [${BROWSER_READINESS_DOM_HASHCODE_TIMEOUT}]
80+
How long to wait before giving up on the DOM stabilizing (i.e. not changing). If <= 0, the timeout is disabled. [config: browser.readiness.dom-hashcode-timeout]
81+
--browser.readiness.give-up-on-all-queries=<duration> [${BROWSER_READINESS_GIVE_UP_ON_ALL_QUERIES}]
82+
How long to wait before giving up on all running queries. If <= 0, the give-up is disabled. [config: browser.readiness.give-up-on-all-queries]
83+
--browser.readiness.give-up-on-first-query=<duration> [${BROWSER_READINESS_GIVE_UP_ON_FIRST_QUERY}]
84+
How long to wait before giving up on a first query being registered. If <= 0, the give-up is disabled. [config: browser.readiness.give-up-on-first-query]
85+
--browser.readiness.iteration-interval=<duration> [${BROWSER_READINESS_ITERATION_INTERVAL}]
86+
How long to wait between each iteration of checking whether the page is ready. Must be positive. [config: browser.readiness.iteration-interval]
87+
--browser.readiness.network-idle-timeout=<duration> [${BROWSER_READINESS_NETWORK_IDLE_TIMEOUT}]
88+
How long to wait before giving up on the network being idle. If <= 0, the timeout is disabled. [config: browser.readiness.network-idle-timeout]
89+
--browser.readiness.prior-wait=<duration> [${BROWSER_READINESS_PRIOR_WAIT}]
90+
The time to wait before checking for how ready the page is. This lets you force the webpage to take a beat and just do its thing before the service starts looking for whether it's time to render anything. If <= 0, this is disabled. [config: browser.readiness.prior-wait]
91+
--browser.readiness.timeout=<duration> [${BROWSER_READINESS_TIMEOUT}]
92+
The maximum time to wait for a web-page to become ready (i.e. no longer loading anything). If <= 0, the timeout is disabled. [config: browser.readiness.timeout]
93+
--browser.readiness.wait-for-n-query-cycles=<int> [${BROWSER_READINESS_WAIT_FOR_N_QUERY_CYCLES}]
94+
The number of readiness checks that must pass consecutively before considering the page ready. [config: browser.readiness.wait-for-n-query-cycles]
95+
--browser.sandbox [${BROWSER_SANDBOX}]
96+
Enable the browser's sandbox. Sets the `no-sandbox` flag to `false` for you. [config: browser.sandbox]
97+
--browser.time-between-scrolls=<duration> [${BROWSER_TIME_BETWEEN_SCROLLS}]
98+
The time between scroll events when capturing a full-page screenshot. [config: browser.time-between-scrolls]
99+
--browser.time-zone=<string> / --browser.timezone=<string> / --browser.tz=<string> [${BROWSER_TIMEZONE}, ${TZ}]
100+
The timezone for the browser to use, e.g. 'America/New_York'. [config: browser.timezone]
101+
--help / -h
102+
show help
103+
--log.level=<string> [${LOG_LEVEL}]
104+
The minimum level to log at (enum: debug, info, warn, error) [config: log.level]
105+
--rate-limit.disabled [${RATE_LIMIT_DISABLED}]
106+
Disable rate limiting entirely. [config: rate-limit.disabled]
107+
--rate-limit.headroom=<uint> [${RATE_LIMIT_HEADROOM}]
108+
The amount of memory (in bytes) to leave as headroom after allocating memory for browser processes. Set to 0 to disable headroom. [config: rate-limit.headroom]
109+
--rate-limit.max-available=<uint> [${RATE_LIMIT_MAX_AVAILABLE}]
110+
The maximum amount of memory (in bytes) available to processes. If more memory exists, only this amount is used. 0 disables the maximum. [config: rate-limit.max-available]
111+
--rate-limit.max-limit=<uint> [${RATE_LIMIT_MAX_LIMIT}]
112+
The maximum number of requests to permit. Ratelimiting will reject requests if the number of currently running requests is at or above this value. Set to 0 to disable maximum. The v4 service used 5 by default. [config: rate-limit.max-limit]
113+
--rate-limit.min-limit=<uint> [${RATE_LIMIT_MIN_LIMIT}]
114+
The minimum number of requests to permit. Ratelimiting will not reject requests if the number of currently running requests is below this value. Set to 0 to disable minimum (not recommended). [config: rate-limit.min-limit]
115+
--rate-limit.min-memory-per-browser=<uint> [${RATE_LIMIT_MIN_MEMORY_PER_BROWSER}]
116+
The minimum amount of memory (in bytes) each browser process is expected to use. Set to 0 to disable the minimum. [config: rate-limit.min-memory-per-browser]
117+
--rate-limit.process-tracker.decay=<int> [${RATE_LIMIT_PROCESS_TRACKER_DECAY}]
118+
The decay factor N to use in slow-moving averages of process statistics, where `avg = ((N-1)*avg + new) / N`. Must be at least 1. [config: rate-limit.process-tracker.decay]
119+
--rate-limit.process-tracker.interval=<duration> [${RATE_LIMIT_PROCESS_TRACKER_INTERVAL}]
120+
How often to sample process statistics on the browser processes. Must be >= 1ms. [config: rate-limit.process-tracker.interval]
121+
--server.addr=<string> [${SERVER_ADDR}]
122+
The address to listen on for HTTP requests. [config: server.addr]
123+
--server.auth-token=<string> / --server.auth-tokens=<string> / --server.token=<string> / --server.tokens=<string> [${AUTH_TOKEN}]
124+
The X-Auth-Token header value that must be sent to the service to permit requests. May be repeated. [config: server.auth-token]
125+
--server.cert-file=<string> / --server.cert=<string> / --server.certificate-file=<string> / --server.certificate=<string> [${SERVER_CERTIFICATE_FILE}]
126+
A path to a TLS certificate file to use for HTTPS. If not set, HTTP is used. [config: server.certificate-file]
127+
--server.key-file=<string> / --server.key=<string> [${SERVER_KEY_FILE}]
128+
A path to a TLS key file to use for HTTPS. [config: server.key-file]
129+
--server.min-tls-version=<string> [${SERVER_MIN_TLS_VERSION}]
130+
The minimum TLS version to accept for HTTPS connections. (enum: 1.0, 1.1, 1.2, 1.3) [config: server.min-tls-version]
131+
--tracing.client-certificate=<string> [${TRACING_CLIENT_CERTIFICATE}]
132+
A path to a PEM-encoded client certificate to use for mTLS when connecting to the tracing endpoint over gRPC or HTTPS. [config: tracing.client_certificate]
133+
--tracing.client-key=<string> [${TRACING_CLIENT_KEY}]
134+
A path to a PEM-encoded client key to use for mTLS when connecting to the tracing endpoint over gRPC or HTTPS. [config: tracing.client_key]
135+
--tracing.compressor=<string> [${TRACING_COMPRESSOR}]
136+
The compression algorithm to use when sending traces. (enum: none, gzip) [config: tracing.compressor]
137+
--tracing.endpoint=<string> [${TRACING_ENDPOINT}]
138+
The tracing endpoint to send spans to. Use grpc://, http://, or https:// to specify the protocol (grpc:// is implied). [config: tracing.endpoint]
139+
--tracing.header=<string> / --tracing.headers=<string> [${TRACING_HEADER}]
140+
A header to add to requests to the tracing endpoint. Syntax is `${key}=${value}`. May be repeated. This is useful for things like authentication. [config: tracing.header]
141+
--tracing.insecure [${TRACING_INSECURE}]
142+
Whether to skip TLS verification when connecting. If set, the scheme in the endpoint is overridden to be insecure. [config: tracing.insecure]
143+
--tracing.service-name=<string> [${TRACING_SERVICE_NAME}]
144+
The service name to use in traces. [config: tracing.service_name]
145+
--tracing.timeout=<duration> [${TRACING_TIMEOUT}]
146+
The timeout for requests to the tracing endpoint. [config: tracing.timeout]
147+
--tracing.trusted-certificate=<string> [${TRACING_TRUSTED_CERTIFICATE}]
148+
A path to a PEM-encoded certificate to use as a trusted root when connecting to the tracing endpoint over gRPC or HTTPS. [config: tracing.trusted_certificate]
149+
```

0 commit comments

Comments
 (0)