远程可读存储

remote_read 主要用于可读远程存储配置,主要包含以下参数:

  • url: 访问地址
  • remote_timeout: 请求超时时间

其代码结构体为:

  1. // RemoteReadConfig is the configuration for reading from remote storage.
  2. type RemoteReadConfig struct {
  3. URL *URL `yaml:"url,omitempty"`
  4. RemoteTimeout model.Duration `yaml:"remote_timeout,omitempty"`
  5. // We cannot do proper Go type embedding below as the parser will then parse
  6. // values arbitrarily into the overflow maps of further-down types.
  7. HTTPClientConfig HTTPClientConfig `yaml:",inline"`
  8. // Catches all undefined fields and must be empty after parsing.
  9. XXX map[string]interface{} `yaml:",inline"`
  10. }

一份完整的配置大致为:

  1. # The URL of the endpoint to query from.
  2. url: <string>
  3. # Timeout for requests to the remote read endpoint.
  4. [ remote_timeout: <duration> | default = 30s ]
  5. # Sets the `Authorization` header on every remote read request with the
  6. # configured username and password.
  7. basic_auth:
  8. [ username: <string> ]
  9. [ password: <string> ]
  10. # Sets the `Authorization` header on every remote read request with
  11. # the configured bearer token. It is mutually exclusive with `bearer_token_file`.
  12. [ bearer_token: <string> ]
  13. # Sets the `Authorization` header on every remote read request with the bearer token
  14. # read from the configured file. It is mutually exclusive with `bearer_token`.
  15. [ bearer_token_file: /path/to/bearer/token/file ]
  16. # Configures the remote read request's TLS settings.
  17. tls_config:
  18. [ <tls_config> ]
  19. # Optional proxy URL.
  20. [ proxy_url: <string> ]

注意: remote_read 属于试验阶段,慎用,因为在以后的版本中可能发生改变。