이미지 렌더링 플래그

이미지 렌더링 플래그 (Image rendering flags)

이 섹션은 이미지 렌더링 서비스를 구성하는 데 사용할 수 있는 전체 플래그 집합을 나열해요. CLI 플래그, 환경 변수, JSON/YAML 구성 파일로 구성할 수 있어요.

출처: 문서

본문

이 섹션은 이미지 렌더링 서비스를 구성하는 데 사용할 수 있는 전체 플래그 집합을 나열해요.

구성 형식 (Configuration format)

서비스를 구성하려면 다음 방법 중 아무거나 사용할 수 있어요:

  • CLI 플래그 설정: 명령줄에서 전달되며 다른 모든 방법보다 완전히 우선해요. 예를 들어 --server.addr=":8081"은 모든 인터페이스의 포트 8081에서 수신하도록 HTTP 주소를 설정해요.
  • 환경 변수 설정: 환경에 설정돼요. 플래그에 대해 환경 변수가 지원된다면 도움말 명령에 나열돼요.
  • JSON 또는 YAML 구성 파일 작성: 파일 이름은 config.json, config.yaml, 또는 config.yml이어야 해요. 파일은 하나만 있어야 하며, 여러 파일이 있으면 우선순위가 정의되지 않아요. 점으로 구분된 키는 중첩 키예요. 예를 들어 플래그 a.b는 파일에서 {"a": {"b": "VALUE"}}가 돼요. 구성 키는 항상 도움말 명령에서 플래그와 함께 언급돼요.

예를 들어 완전한 구성 파일은 YAML에서 다음과 같을 수 있어요:

server:
  addr: ":8081" # server.addr
  auth-token: # server.auth-token
    - "a"
    - "b"

플래그 목록 (List of flags)

다음은 최신 릴리스에서 현재 지원되는 모든 플래그의 전체 목록이에요. 이것은 grafana-image-renderer server --help 명령의 출력을 그대로 옮긴 것이에요.

--api.default-encoding=<string> [default: "pdf"] [${API_DEFAULT_ENCODING}]
    The default encoding for render requests when not specified. (values: pdf, png) [config: api.default-encoding]
--api.silence-request-log-path=<string> [${API_SILENCE_REQUEST_LOG_PATH}]
    Allows silencing the HTTP request logs for a certain path. It requires a direct match. Multiple values can be passed separated by comma or multiple flags. Examples: '/healthz', '/render/version'. [config: api.silence-request-log-path]
--browser.flag=<string> / --browser.flags=<string> [${BROWSER_FLAGS}, ${BROWSER_FLAG}]
    Flags to pass to the browser. These are syntaxed `--${flag}` or `--${flag}=${value}`. Note the required `--` prefix for each flag. [config: browser.flag]
--browser.force-polling-mode [default: false] [${BROWSER_FORCE_POLLING_MODE}]
    Forces the renderer to poll for scenes' query running count variable to detect when rendering is done, rather than use an event-based approach even when that is available. [config: browser.force-polling-mode]
--browser.gpu [default: false] [${BROWSER_GPU}]
    Enable GPU support in the browser. [config: browser.gpu]
--browser.header=<string> / --browser.headers=<string> [${BROWSER_HEADER}]
    Headers to add to every request the browser makes. Syntax is `${key}=${value}`. May be repeated. [config: browser.header]
--browser.max-height=<int> [default: 3000] [${BROWSER_MAX_HEIGHT}]
    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]
--browser.max-page-scale-factor=<float> [default: 4] [${BROWSER_MAX_PAGE_SCALE_FACTOR}]
    The maximum page scale factor of the browser. Requests cannot request a larger scale than this. [config: browser.max-page-scale-factor]
--browser.max-width=<int> [default: 3000] [${BROWSER_MAX_WIDTH}]
    The maximum width of the browser viewport. Requests cannot request a larger width than this. Negative means ignored. [config: browser.max-width]
--browser.min-height=<int> [default: 500] [${BROWSER_MIN_HEIGHT}]
    The minimum height of the browser viewport. This is the default height in requests. [config: browser.min-height]
--browser.min-width=<int> [default: 1000] [${BROWSER_MIN_WIDTH}]
    The minimum width of the browser viewport. This is the default width in requests. [config: browser.min-width]
--browser.namespaced [default: false] [${BROWSER_NAMESPACED}]
    Enable namespacing the browser. This requires Linux and the CAP_SYS_ADMIN and CAP_SYS_CHROOT capabilities, or a privileged user. [config: browser.namespaced]
--browser.override=<string> / --browser.overrides=<string> [${BROWSER_OVERRIDE}]
    URL pattern override in format: 'pattern=--flag=value --flag2=value2'. Pattern is a regex. May be repeated. Example: --browser.override='^https://slow\\.example\\.com/.*=--browser.readiness.timeout=60s' [config: browser.override]
--browser.page-scale-factor=<float> [default: 1] [${BROWSER_PAGE_SCALE_FACTOR}]
    The page scale factor of the browser. [config: browser.page-scale-factor]
--browser.path=<string> [default: "chromium"] [${BROWSER_PATH}]
    The path to the browser's binary. This is resolved against PATH. [config: browser.path]
--browser.portrait [default: false] [${BROWSER_PORTRAIT}]
    Use a portrait viewport instead of the default landscape. [config: browser.portrait]
--browser.readiness.disable-dom-hashcode-wait [default: false] [${BROWSER_READINESS_DISABLE_DOM_HASHCODE_WAIT}]
    Disable waiting for the DOM to stabilize (i.e. not change) before capturing. [config: browser.readiness.disable-dom-hashcode-wait]
--browser.readiness.disable-network-wait [default: false] [${BROWSER_READINESS_DISABLE_NETWORK_WAIT}]
    Disable waiting for network requests to finish before capturing. [config: browser.readiness.disable-network-wait]
--browser.readiness.disable-query-wait [default: false] [${BROWSER_READINESS_DISABLE_QUERY_WAIT}]
    Disable waiting for queries to finish before capturing. [config: browser.readiness.disable-query-wait]
--browser.readiness.dom-hashcode-timeout=<duration> [default: 0s] [${BROWSER_READINESS_DOM_HASHCODE_TIMEOUT}]
    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]
--browser.readiness.give-up-on-all-queries=<duration> [default: 0s] [${BROWSER_READINESS_GIVE_UP_ON_ALL_QUERIES}]
    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]
--browser.readiness.give-up-on-first-query=<duration> [default: 3s] [${BROWSER_READINESS_GIVE_UP_ON_FIRST_QUERY}]
    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]
--browser.readiness.iteration-interval=<duration> [default: 100ms] [${BROWSER_READINESS_ITERATION_INTERVAL}]
    How long to wait between each iteration of checking whether the page is ready. Must be positive. [config: browser.readiness.iteration-interval]
--browser.readiness.network-idle-timeout=<duration> [default: 0s] [${BROWSER_READINESS_NETWORK_IDLE_TIMEOUT}]
    How long to wait before giving up on the network being idle. If <= 0, the timeout is disabled. [config: browser.readiness.network-idle-timeout]
--browser.readiness.prior-wait=<duration> [default: 1s] [${BROWSER_READINESS_PRIOR_WAIT}]
    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]
--browser.readiness.timeout=<duration> [default: 30s] [${BROWSER_READINESS_TIMEOUT}]
    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]
--browser.readiness.wait-for-n-query-cycles=<int> [default: 1] [${BROWSER_READINESS_WAIT_FOR_N_QUERY_CYCLES}]
    The number of readiness checks that must pass consecutively before considering the page ready. [config: browser.readiness.wait-for-n-query-cycles]
--browser.sandbox [default: false] [${BROWSER_SANDBOX}]
    Enable the browser's sandbox. Sets the `no-sandbox` flag to `false` for you. [config: browser.sandbox]
--browser.time-between-scrolls=<duration> [default: 50ms] [${BROWSER_TIME_BETWEEN_SCROLLS}]
    The time between scroll events when capturing a full-page screenshot. [config: browser.time-between-scrolls]
--browser.time-zone=<string> / --browser.timezone=<string> / --browser.tz=<string> [default: "Etc/UTC"] [${BROWSER_TIMEZONE}, ${TZ}]
    The timezone for the browser to use, e.g. 'America/New_York'. [config: browser.timezone]
--browser.user-agent=<string> [${BROWSER_USER_AGENT}]
    Sets the default User-Agent header for browser requests. If not set, Chromium's default will be used instead. [config: browser.user-agent]
--browser.ws-url-read-timeout=<duration> [default: 0s] [${BROWSER_WS_URL_READ_TIMEOUT}]
    The timeout for reading the WebSocket URL when connecting to the browser. If <= 0, uses chromedp default (20s). [config: browser.ws-url-read-timeout]
--help / -h
    show help
--log.format=<string> [default: "text"] [${LOG_FORMAT}]
    The log output format (enum: text, json) [config: log.format]
--log.level=<string> [default: "info"] [${LOG_LEVEL}]
    The minimum level to log at (enum: debug, info, warn, error) [config: log.level]
--rate-limit.disabled [default: false] [${RATE_LIMIT_DISABLED}]
    Disable rate limiting entirely. [config: rate-limit.disabled]
--rate-limit.headroom=<uint> [default: 33554432] [${RATE_LIMIT_HEADROOM}]
    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]
--rate-limit.max-available=<uint> [default: 0] [${RATE_LIMIT_MAX_AVAILABLE}]
    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]
--rate-limit.max-limit=<uint> [default: 0] [${RATE_LIMIT_MAX_LIMIT}]
    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]
--rate-limit.min-limit=<uint> [default: 3] [${RATE_LIMIT_MIN_LIMIT}]
    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]
--rate-limit.min-memory-per-browser=<uint> [default: 67108864] [${RATE_LIMIT_MIN_MEMORY_PER_BROWSER}]
    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]
--rate-limit.process-tracker.decay=<int> [default: 5] [${RATE_LIMIT_PROCESS_TRACKER_DECAY}]
    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]
--rate-limit.process-tracker.interval=<duration> [default: 50ms] [${RATE_LIMIT_PROCESS_TRACKER_INTERVAL}]
    How often to sample process statistics on the browser processes. Must be >= 1ms. [config: rate-limit.process-tracker.interval]
--server.addr=<string> [default: ":8081"] [${SERVER_ADDR}]
    The address to listen on for HTTP requests. [config: server.addr]
--server.auth-token=<string> / --server.auth-tokens=<string> / --server.token=<string> / --server.tokens=<string> [default: "-"] [${AUTH_TOKEN}]
    The X-Auth-Token header value that must be sent to the service to permit requests. May be repeated. [config: server.auth-token]
--server.cert-file=<string> / --server.cert=<string> / --server.certificate-file=<string> / --server.certificate=<string> [${SERVER_CERTIFICATE_FILE}]
    A path to a TLS certificate file to use for HTTPS. If not set, HTTP is used. [config: server.certificate-file]
--server.key-file=<string> / --server.key=<string> [${SERVER_KEY_FILE}]
    A path to a TLS key file to use for HTTPS. [config: server.key-file]
--server.min-tls-version=<string> [default: "1.2"] [${SERVER_MIN_TLS_VERSION}]
    The minimum TLS version to accept for HTTPS connections. (enum: 1.0, 1.1, 1.2, 1.3) [config: server.min-tls-version]
--tracing.client-certificate=<string> [${TRACING_CLIENT_CERTIFICATE}]
    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]
--tracing.client-key=<string> [${TRACING_CLIENT_KEY}]
    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]
--tracing.compressor=<string> [default: "none"] [${TRACING_COMPRESSOR}]
    The compression algorithm to use when sending traces. (enum: none, gzip) [config: tracing.compressor]
--tracing.endpoint=<string> [${TRACING_ENDPOINT}]
    The tracing endpoint to send spans to. Use grpc://, http://, or https:// to specify the protocol (grpc:// is implied). [config: tracing.endpoint]
--tracing.header=<string> / --tracing.headers=<string> [${TRACING_HEADER}]
    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]
--tracing.insecure [default: false] [${TRACING_INSECURE}]
    Whether to skip TLS verification when connecting. If set, the scheme in the endpoint is overridden to be insecure. [config: tracing.insecure]
--tracing.service-name=<string> [default: "grafana-image-renderer"] [${TRACING_SERVICE_NAME}]
    The service name to use in traces. [config: tracing.service_name]
--tracing.timeout=<duration> [default: 10s] [${TRACING_TIMEOUT}]
    The timeout for requests to the tracing endpoint. [config: tracing.timeout]
--tracing.trusted-certificate=<string> [${TRACING_TRUSTED_CERTIFICATE}]
    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]

구성 디버깅 (Debug the configuration)

Note

여기 권장되는 명령은 비밀과 민감한 정보를 평문으로 출력해요. 출력을 공유하거나 로그에 저장할 때 주의하세요.

서비스가 예상대로 작동하지 않는 것처럼 보일 때는 구성이 유효하지 않기 때문일 수 있어요. 플래그가 유효하지 않으면 서비스가 시작되지 않지만, 구성 파일에는 알 수 없는 키가 포함될 수 있고 조용히 무시돼요.

구성이 유효하고 기대한 대로인지 디버깅하려면 print-config 명령을 실행해 구성을 나타내는 Go 구조의 전체 덤프를 얻을 수 있어요. 예를 들어:

docker run --rm -v ./config.json:/home/nonroot/config.json grafana/grafana-image-renderer:latest print-config

이 명령은 server 명령과 정확히 같은 플래그와 구성 파일을 사용해요.

더 알아보기 (Learn more)