Skip to content

Commit

Permalink
optimize: Document description of data source
Browse files Browse the repository at this point in the history
Signed-off-by: 孙林耀 <[email protected]>
  • Loading branch information
MicroOps-cn committed Sep 16, 2022
1 parent 50b73dc commit ec52ff1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 33 deletions.
37 changes: 20 additions & 17 deletions README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ collects:
datasource:
- type: "file"
name: <string> # datasource name
max_content_length: <int> # The maximum read length, in bytes, When the value of "read_mode" is stream, it defaults to 0 (unlimited),otherwise the default value is 102400000
line_max_content_length: <int> # The maximum read length per line,in bytes,0 means unlimited, defaults: 102400000

relabel_configs: [ <relabel_config>, ... ] # reference: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
timeout: <duration> # The default is "30s", which cannot be less than "1ms", reference: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#duration
read_mode: <string> # read mode, The value can be: "stream","line" or "full", defaults: "full"
url: "../examples/weather.xml"
line_separator: [<string>,...] # The value can be string、[string,...], Line separator, default: "\n"
end_of: # Message end flag. When this flag is read, it will stop reading and close the connection. The message is line buffered, so The end_of value of cannot be multiple rows.
end_of: # The message end flag, when read, will stop reading and close the connection. It is only valid when "read_mode" is line. The message is line buffered, so the value of "end_of" cannot be multiple lines.
max_content_length: <int> # The maximum read length, in bytes. If the "read_mode" value is stream, the default value is 0 (unlimited), otherwise the default value is 102400000
min_content_length: <int> # Read the minimum length in bytes. The default value is 0 (unlimited). Only read_ Valid when the mode is full.
line_max_content_length: <int> # The maximum number of bytes read per line. 0 is unlimited, and the default is 102400000. Only in read_ Valid when the mode is line or stream.
line_separator: [<string>,...] # Line separator. The value type can be string, [string,...], and the default is "\n". Only valid when "read_mode" is line or stream.
```
#### http
Expand All @@ -128,8 +128,6 @@ datasource:
datasource:
- type: "http"
name: <string> # datasource name
max_content_length: <int> # The maximum read length, in bytes, When the value of "read_mode" is stream, it defaults to 0 (unlimited),otherwise the default value is 102400000
line_max_content_length: <int> # The maximum read length per line,in bytes,0 means unlimited, defaults: 102400000
relabel_configs: [ <relabel_config>, ... ] # reference: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
timeout: <duration> # The default is "30s", which cannot be less than "1ms", reference: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#duration
read_mode: <string> # read mode, The value can be: "stream","line" or "full", defaults: "full"
Expand Down Expand Up @@ -160,8 +158,11 @@ datasource:
headers: { <string>: <string>, ... } # custom HTTP request headers
method: <string> #HTTP request method, example: GET/POST/PUT...
valid_status_codes: [ <number>,... ] # valid status code,default to 200~299.
line_separator: [<string>,...] # The value can be string、[string,...], Line separator, default: "\n"
end_of: # Message end flag. When this flag is read, it will stop reading and close the connection. The message is line buffered, so The end_of value of cannot be multiple rows.
end_of: # The message end flag, when read, will stop reading and close the connection. It is only valid when "read_mode" is line. The message is line buffered, so the value of "end_of" cannot be multiple lines.
max_content_length: <int> # The maximum read length, in bytes. If the "read_mode" value is stream, the default value is 0 (unlimited), otherwise the default value is 102400000
min_content_length: <int> # Read the minimum length in bytes. The default value is 0 (unlimited). Only read_ Valid when the mode is full.
line_max_content_length: <int> # The maximum number of bytes read per line. 0 is unlimited, and the default is 102400000. Only in read_ Valid when the mode is line or stream.
line_separator: [<string>,...] # Line separator. The value type can be string, [string,...], and the default is "\n". Only valid when "read_mode" is line or stream.
```
#### tcp
Expand All @@ -170,8 +171,6 @@ datasource:
datasource:
- type: "tcp"
name: <string> # datasource name
max_content_length: <int> # The maximum read length, in bytes, When the value of "read_mode" is stream, it defaults to 0 (unlimited),otherwise the default value is 102400000
line_max_content_length: <int> # The maximum read length per line,in bytes,0 means unlimited, defaults: 102400000
relabel_configs: [ <relabel_config>, ... ] # reference: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
timeout: <duration> # The default is "30s", which cannot be less than "1ms", reference: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#duration
read_mode: <string> # read mode, The value can be: "stream","line" or "full", defaults: "full"
Expand All @@ -186,8 +185,11 @@ datasource:
delay: <duration>
max_connect_time: <duration> # The maximum time to establish a connection (excluding data transmission). If the connection is not established successfully after this time, a failure will be returned. Default to 3s
max_transfer_time: <duration> # Maximum message transmission time. If the message transmission exceeds this time, it will stop reading and close the connection. Default to 3s
line_separator: [<string>,...] # The value can be string、[string,...], Line separator, default: "\n"
end_of: # Message end flag. When this flag is read, it will stop reading and close the connection. The message is line buffered, so The end_of value of cannot be multiple rows.
end_of: # The message end flag, when read, will stop reading and close the connection. It is only valid when "read_mode" is line. The message is line buffered, so the value of "end_of" cannot be multiple lines.
max_content_length: <int> # The maximum read length, in bytes. If the "read_mode" value is stream, the default value is 0 (unlimited), otherwise the default value is 102400000
min_content_length: <int> # Read the minimum length in bytes. The default value is 0 (unlimited). Only read_ Valid when the mode is full.
line_max_content_length: <int> # The maximum number of bytes read per line. 0 is unlimited, and the default is 102400000. Only in read_ Valid when the mode is line or stream.
line_separator: [<string>,...] # Line separator. The value type can be string, [string,...], and the default is "\n". Only valid when "read_mode" is line or stream.
```
Note: `end_of` and `max_transfer_time` is used to control closing the connection (message transmission is completed).
Expand All @@ -201,8 +203,6 @@ use `end_of` to control and increase the value of `max_transfer_time`.
datasource:
- type: "udp"
name: <string> # datasource name
max_content_length: <int> # The maximum read length, in bytes, When the value of "read_mode" is stream, it defaults to 0 (unlimited),otherwise the default value is 102400000
line_max_content_length: <int> # The maximum read length per line,in bytes,0 means unlimited, defaults: 102400000
relabel_configs: [ <relabel_config>, ... ] # reference: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
timeout: <duration> # The default is "30s", which cannot be less than "1ms", reference: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#duration
read_mode: <string> # read mode, The value can be: "stream","line" or "full", defaults: "full"
Expand All @@ -215,8 +215,11 @@ datasource:
delay: <duration>
max_connect_time: <duration> # The maximum time to establish a connection (excluding data transmission). If the connection is not established successfully after this time, a failure will be returned. Default to 3s
max_transfer_time: <duration> # Maximum message transmission time. If the message transmission exceeds this time, it will stop reading and close the connection. Default to 3s
line_separator: [<string>,...] # The value can be string、[string,...], Line separator, default: "\n"
end_of: # Message end flag. When this flag is read, it will stop reading and close the connection. The message is line buffered, so The end_of value of cannot be multiple rows.
end_of: # The message end flag, when read, will stop reading and close the connection. It is only valid when "read_mode" is line. The message is line buffered, so the value of "end_of" cannot be multiple lines.
max_content_length: <int> # The maximum read length, in bytes. If the "read_mode" value is stream, the default value is 0 (unlimited), otherwise the default value is 102400000
min_content_length: <int> # Read the minimum length in bytes. The default value is 0 (unlimited). Only read_ Valid when the mode is full.
line_max_content_length: <int> # The maximum number of bytes read per line. 0 is unlimited, and the default is 102400000. Only in read_ Valid when the mode is line or stream.
line_separator: [<string>,...] # Line separator. The value type can be string, [string,...], and the default is "\n". Only valid when "read_mode" is line or stream.
```

Note: UDP does not support TLS temporarily
Expand Down
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ datasource:
timeout: <duration> # 默认为30s,不能小于1ms,参考https://prometheus.io/docs/prometheus/latest/configuration/configuration/#duration
read_mode: <string> # 读取模式,stream | line | full,默认为full
url: "../examples/weather.xml"
end_of: # 报文结束标志,当读取到该标志,则会停止继续读取并关闭连接。报文为行缓冲,所以end_of的值不能为多行。
max_content_length: <int> # 读取最大长度,单位为字节, 如果"read_mode"值为stream, 该值默认为0 (不限制),否则默认值为 102400000
line_max_content_length: <int> # 每行最大读取量字节数,0为不限制,默认为: 102400000
line_separator: [<string>,...] # 行分隔符, 值类型可以为 string、[string,...], 默认为: "\n"
end_of: # 报文结束标志,当读取到该标志,则会停止继续读取并关闭连接,只有在read_mode为line的时候有效。报文为行缓冲,所以end_of的值不能为多行。
max_content_length: <int> # 读取最大长度,单位为字节,如果"read_mode"值为stream, 该值默认为0 (不限制),否则默认值为 102400000
min_content_length: <int> # 读取最小长度,单位为字节,默认值为0 (不限制),只有在read_mode为full的时候有效。
line_max_content_length: <int> # 每行最大读取量字节数,0为不限制,默认为: 102400000。只有在read_mode为line、stream时有效。
line_separator: [<string>,...] # 行分隔符, 值类型可以为 string、[string,...], 默认为: "\n"。只有在read_mode为line、stream时有效。
```
#### http
Expand Down Expand Up @@ -151,10 +152,11 @@ datasource:
headers: { <string>: <string>, ... } # 自定义HTTP头
method: <string> #HTTP请求方法 GET/POST/PUT...
valid_status_codes: [ <number>,... ] # 有效的状态码,默认为200~299
line_separator: [<string>,...] # 行分隔符, 值类型可以为 string、[string,...], 默认为: "\n"
end_of: # 报文结束标志,当读取到该标志,则会停止继续读取并关闭连接。报文为行缓冲,所以end_of的值不能为多行。
max_content_length: <int> # 读取最大长度,单位为字节, 如果"read_mode"值为stream, 该值默认为0 (不限制),否则默认值为 102400000
line_max_content_length: <int> # 每行最大读取量字节数,0为不限制,默认为: 102400000
end_of: # 报文结束标志,当读取到该标志,则会停止继续读取并关闭连接,只有在read_mode为line的时候有效。报文为行缓冲,所以end_of的值不能为多行。
max_content_length: <int> # 读取最大长度,单位为字节,如果"read_mode"值为stream, 该值默认为0 (不限制),否则默认值为 102400000
min_content_length: <int> # 读取最小长度,单位为字节,默认值为0 (不限制),只有在read_mode为full的时候有效。
line_max_content_length: <int> # 每行最大读取量字节数,0为不限制,默认为: 102400000。只有在read_mode为line、stream时有效。
line_separator: [<string>,...] # 行分隔符, 值类型可以为 string、[string,...], 默认为: "\n"。只有在read_mode为line、stream时有效。
```
#### tcp
Expand All @@ -174,10 +176,11 @@ datasource:
delay: <duration> # 发送后等待时间,默认为0,延迟总和不得大于timeout,参考https://prometheus.io/docs/prometheus/latest/configuration/configuration/#duration
max_connect_time: <duration> # 最大建立连接的时长(不包含数据传输),如果超过该时间连接仍未建立成功,会返回失败。默认为3秒
max_transfer_time: <duration> # 报文传输最大时长,报文传输超过该时长,会停止继续读取并关闭连接。
line_separator: [<string>,...] # 行分隔符, 值类型可以为 string、[string,...], 默认为: "\n"
end_of: # 报文结束标志,当读取到该标志,则会停止继续读取并关闭连接。报文为行缓冲,所以end_of的值不能为多行。
max_content_length: <int> # 读取最大长度,单位为字节, 如果"read_mode"值为stream, 该值默认为0 (不限制),否则默认值为 102400000
line_max_content_length: <int> # 每行最大读取量字节数,0为不限制,默认为: 102400000
end_of: # 报文结束标志,当读取到该标志,则会停止继续读取并关闭连接,只有在read_mode为line的时候有效。报文为行缓冲,所以end_of的值不能为多行。
max_content_length: <int> # 读取最大长度,单位为字节,如果"read_mode"值为stream, 该值默认为0 (不限制),否则默认值为 102400000
min_content_length: <int> # 读取最小长度,单位为字节,默认值为0 (不限制),只有在read_mode为full的时候有效。
line_max_content_length: <int> # 每行最大读取量字节数,0为不限制,默认为: 102400000。只有在read_mode为line、stream时有效。
line_separator: [<string>,...] # 行分隔符, 值类型可以为 string、[string,...], 默认为: "\n"。只有在read_mode为line、stream时有效。
```
注:end_of和max_transfer_time用来控制关闭连接(报文传输完成)。当匹配到end_of的标志,或传输时间达到max_transfer_time的值,会关闭连接,停止接收数据,但不会抛出异常。
Expand All @@ -200,10 +203,11 @@ datasource:
max_connect_time: <duration> # 最大建立连接的时长(不包含数据传输),如果超过该时间连接仍未建立成功,会返回失败。默认为3秒
max_transfer_time: <duration> # 报文传输最大时长,报文传输超过该时长,会停止继续读取并关闭连接。
end_of: # 报文结束标志,当读取到该标志,则会停止继续读取并关闭连接。报文为行缓冲,所以end_of的值不能为多行。
line_separator: [<string>,...] # 行分隔符, 值类型可以为 string、[string,...], 默认为: "\n"
end_of: # 报文结束标志,当读取到该标志,则会停止继续读取并关闭连接。报文为行缓冲,所以end_of的值不能为多行。
max_content_length: <int> # 读取最大长度,单位为字节, 如果"read_mode"值为stream, 该值默认为0 (不限制),否则默认值为 102400000
line_max_content_length: <int> # 每行最大读取量字节数,0为不限制,默认为: 102400000
end_of: # 报文结束标志,当读取到该标志,则会停止继续读取并关闭连接,只有在read_mode为line的时候有效。报文为行缓冲,所以end_of的值不能为多行。
max_content_length: <int> # 读取最大长度,单位为字节,如果"read_mode"值为stream, 该值默认为0 (不限制),否则默认值为 102400000
min_content_length: <int> # 读取最小长度,单位为字节,默认值为0 (不限制),只有在read_mode为full的时候有效。
line_max_content_length: <int> # 每行最大读取量字节数,0为不限制,默认为: 102400000。只有在read_mode为line、stream时有效。
line_separator: [<string>,...] # 行分隔符, 值类型可以为 string、[string,...], 默认为: "\n"。只有在read_mode为line、stream时有效。
```
注: udp暂不支持TLS
Expand Down

0 comments on commit ec52ff1

Please sign in to comment.