Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_node_exporter_metrics: collect metrics at startup(#8368) #8370

Merged
merged 1 commit into from
Jan 13, 2024

Conversation

nokute78
Copy link
Collaborator

Fixes #8368

The issue #8368 is caused by flushing metrics before updating it.
This patch is to update metrics at startup to prevent flushing empty metrics.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • [N/A] Backport to latest stable release.

Debug/Valgrind output

$ valgrind --leak-check=full bin/fluent-bit -i node_exporter_metrics -o stdout -f 1 
==17236== Memcheck, a memory error detector
==17236== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==17236== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==17236== Command: bin/fluent-bit -i node_exporter_metrics -o stdout -f 1
==17236== 
Fluent Bit v2.2.2
* Copyright (C) 2015-2024 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

____________________
< Fluent Bit v2.2.2 >
 -------------------
(snip)
[2024/01/13 09:01:00] [ info] [fluent bit] version=2.2.2, commit=6f2c553ebc, pid=17236
[2024/01/13 09:01:00] [ info] [storage] ver=1.2.0, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2024/01/13 09:01:00] [ info] [cmetrics] version=0.6.6
[2024/01/13 09:01:00] [ info] [ctraces ] version=0.4.0
[2024/01/13 09:01:00] [ info] [input:node_exporter_metrics:node_exporter_metrics.0] initializing
[2024/01/13 09:01:00] [ info] [input:node_exporter_metrics:node_exporter_metrics.0] storage_strategy='memory' (memory only)
[2024/01/13 09:01:00] [ info] [input:node_exporter_metrics:node_exporter_metrics.0] path.procfs = /proc
[2024/01/13 09:01:00] [ info] [input:node_exporter_metrics:node_exporter_metrics.0] path.sysfs  = /sys
[2024/01/13 09:01:01] [ info] [input:node_exporter_metrics:node_exporter_metrics.0] thread instance initialized
[2024/01/13 09:01:01] [ info] [output:stdout:stdout.0] worker #0 started
[2024/01/13 09:01:01] [ info] [sp] stream processor started
2024-01-13T00:01:05.988566934Z node_cpu_seconds_total{cpu="0",mode="idle"} = 3534.29
2024-01-13T00:01:05.988566934Z node_cpu_seconds_total{cpu="0",mode="iowait"} = 13.41
2024-01-13T00:01:05.988566934Z node_cpu_seconds_total{cpu="0",mode="irq"} = 0
2024-01-13T00:01:05.988566934Z node_cpu_seconds_total{cpu="0",mode="nice"} = 9.1899999999999995
2024-01-13T00:01:05.988566934Z node_cpu_seconds_total{cpu="0",mode="softirq"} = 0.040000000000000001
2024-01-13T00:01:05.988566934Z node_cpu_seconds_total{cpu="0",mode="steal"} = 0
2024-01-13T00:01:05.988566934Z node_cpu_seconds_total{cpu="0",mode="system"} = 179.81999999999999
2024-01-13T00:01:05.988566934Z node_cpu_seconds_total{cpu="0",mode="user"} = 263.85000000000002
(snip)
2024-01-13T00:01:06.031529249Z node_systemd_version{version="249.11-0ubuntu3.11"} = 249.11000000000001
^C[2024/01/13 09:01:10] [engine] caught signal (SIGINT)
[2024/01/13 09:01:10] [ warn] [engine] service will shutdown in max 5 seconds
[2024/01/13 09:01:10] [ info] [engine] service has stopped (0 pending tasks)
[2024/01/13 09:01:10] [ info] [output:stdout:stdout.0] thread worker #0 stopping...
[2024/01/13 09:01:11] [ info] [output:stdout:stdout.0] thread worker #0 stopped
==17236== 
==17236== HEAP SUMMARY:
==17236==     in use at exit: 0 bytes in 0 blocks
==17236==   total heap usage: 75,311 allocs, 75,311 frees, 2,083,706,014 bytes allocated
==17236== 
==17236== All heap blocks were freed -- no leaks are possible
==17236== 
==17236== For lists of detected and suppressed errors, rerun with: -s
==17236== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

@edsiper edsiper merged commit 78c8aa4 into fluent:master Jan 13, 2024
44 checks passed
@nokute78 nokute78 deleted the fix_8368 branch January 13, 2024 23:49
shaerpour pushed a commit to shaerpour/fluent-bit that referenced this pull request Jan 16, 2024
shaerpour pushed a commit to shaerpour/fluent-bit that referenced this pull request Jan 16, 2024
pwhelan pushed a commit that referenced this pull request Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node Exporter metrics show incorrect timestamp (1970-01-01T00:00:00.000000000Z)
2 participants