fluent / fluent-bit

Fast and Lightweight Logs and Metrics processor for Linux, BSD, OSX and Windows
https://fluentbit.io
Apache License 2.0
5.64k stars 1.54k forks source link

Discrepancy Between Default storage_metrics Setting in Code and Documentation #9014

Open GarupanOjisan opened 1 month ago

GarupanOjisan commented 1 month ago

Bug Report

Describe the bug

There is a discrepancy between the default value of the storage_metrics setting in the code (flb_config.c#L280) and the official documentation. In the code, storage_metrics is set to FLB_TRUE by default, while the documentation states that the default value is Off.

To Reproduce

  1. Use the following config.

fluent-bit.yaml

service:
  http_server: on
  1. Run fluent-bit 3.0.7
docker run --rm -it -p 2020:2020 -v $(pwd)/fluent-bit.yaml:/fluent-bit/etc/fluent-bit.yaml fluent/fluent-bit:3.0.7 -c /fluent-bit/etc/fluent-bit.yaml
  1. Fetch the metrics with curl, then the storage metrics are returned while storage.metrics is not set (the default value is Off ).
curl http://localhost:2020/api/v2/metrics/prometheus
# HELP fluentbit_uptime Number of seconds that Fluent Bit has been running.
# TYPE fluentbit_uptime counter
fluentbit_uptime{hostname="52da66687fce"} 14
# HELP fluentbit_process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE fluentbit_process_start_time_seconds gauge
fluentbit_process_start_time_seconds{hostname="52da66687fce"} 1719471663
# HELP fluentbit_build_info Build version information.
# TYPE fluentbit_build_info gauge
fluentbit_build_info{hostname="52da66687fce",version="3.0.7",os="linux"} 1719471663
# HELP fluentbit_hot_reloaded_times Collect the count of hot reloaded times.
# TYPE fluentbit_hot_reloaded_times gauge
fluentbit_hot_reloaded_times{hostname="52da66687fce"} 0
# HELP fluentbit_storage_chunks Total number of chunks in the storage layer.
# TYPE fluentbit_storage_chunks gauge
fluentbit_storage_chunks 0
# HELP fluentbit_storage_mem_chunks Total number of memory chunks.
# TYPE fluentbit_storage_mem_chunks gauge
fluentbit_storage_mem_chunks 0
# HELP fluentbit_storage_fs_chunks Total number of filesystem chunks.
# TYPE fluentbit_storage_fs_chunks gauge
fluentbit_storage_fs_chunks 0
# HELP fluentbit_storage_fs_chunks_up Total number of filesystem chunks up in memory.
# TYPE fluentbit_storage_fs_chunks_up gauge
fluentbit_storage_fs_chunks_up 0
# HELP fluentbit_storage_fs_chunks_down Total number of filesystem chunks down.
# TYPE fluentbit_storage_fs_chunks_down gauge
fluentbit_storage_fs_chunks_down 0

On the other hand, if I explicitly set storage.metrics to Off, the storage metrics will no longer exported.

service:
  http_server: on
  storage.metrics: Off

Expected behavior

If no value is set for storage.metrics, it is expected that the storage metrics will not be exported, as stated in the documentation.

curl http://localhost:2020/api/v2/metrics/prometheus
# HELP fluentbit_uptime Number of seconds that Fluent Bit has been running.
# TYPE fluentbit_uptime counter
fluentbit_uptime{hostname="5f9da872910b"} 5
# HELP fluentbit_process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE fluentbit_process_start_time_seconds gauge
fluentbit_process_start_time_seconds{hostname="5f9da872910b"} 1719472051
# HELP fluentbit_build_info Build version information.
# TYPE fluentbit_build_info gauge
fluentbit_build_info{hostname="5f9da872910b",version="3.0.7",os="linux"} 1719472051
# HELP fluentbit_hot_reloaded_times Collect the count of hot reloaded times.
# TYPE fluentbit_hot_reloaded_times gauge
fluentbit_hot_reloaded_times{hostname="5f9da872910b"} 0

Screenshots

Your Environment

service:
  http_server: on

Additional context

patrick-stephens commented 1 month ago

Please send a docs PR