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

core: metrics: Provide capabilities for returning the count of hot reloaded in REST API and its metrics #7899

Merged
merged 4 commits into from
Sep 21, 2023

Conversation

cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Sep 6, 2023

For HTTP REST API users, there is lack of capability to confirm that the status of hot-reloading.
It would be nice to have the endpoint which can handle the request for returning the count of the hot-reloading times.

Also, we need to provide the metrics for the status of hot-reloading counts.

In this PR, I added two capabilities.
One is providing an endpoint which can handle GET method to return the count of hot-reloading.
This can be called with:

$ curl -XGET <hostname>:2020/api/v2/reload 

The other is provide a v2 metrics which includes the count of hot-reloading.
This can be called by:

$ curl -XGET <hostname>:2020/api/v2/metrics

Then, the metrics can be displayed as follows:

<snip>
2023-09-06T07:25:45.332832481Z fluentbit_hot_reloaded_times{hostname="fluent-bit-dev"} = <the number of reloaded times>
<snip>

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:

  • Example configuration file for the change
[SERVICE]
    Flush        1
    Daemon       Off
    Log_Level    info
    HTTP_Server  On
    HTTP_Listen  0.0.0.0
    HTTP_Port    2020
    Hot_Reload On

[INPUT]
    Name dummy
    Tag dummy.locals

[FILTER]
    Name record_modifier
    Match *
    Record hostname ${HOSTNAME}

[OUTPUT]
    Name  stdout
    Match *
  • 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.

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

Documentation

  • Documentation required for this feature

A documentation for newly added endpoint: fluent/fluent-bit-docs#1192
A documentation for v2 endpoint and v2 metrics: fluent/fluent-bit-docs#1193

Backporting

  • Backport to latest stable release.

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.

@cosmo0920 cosmo0920 temporarily deployed to pr September 6, 2023 07:55 — with GitHub Actions Inactive
@cosmo0920 cosmo0920 temporarily deployed to pr September 6, 2023 07:55 — with GitHub Actions Inactive
@cosmo0920 cosmo0920 temporarily deployed to pr September 6, 2023 07:55 — with GitHub Actions Inactive
@cosmo0920 cosmo0920 temporarily deployed to pr September 6, 2023 08:22 — with GitHub Actions Inactive
@cosmo0920 cosmo0920 temporarily deployed to pr September 6, 2023 08:24 — with GitHub Actions Inactive
@cosmo0920 cosmo0920 temporarily deployed to pr September 6, 2023 08:24 — with GitHub Actions Inactive
@cosmo0920 cosmo0920 temporarily deployed to pr September 6, 2023 08:24 — with GitHub Actions Inactive
@cosmo0920 cosmo0920 temporarily deployed to pr September 6, 2023 08:50 — with GitHub Actions Inactive
@patrick-stephens
Copy link
Contributor

Can we add a docs PR @cosmo0920 to cover this on both the reload page and the metrics description page?

Do we get it via Fluent Bit metrics as well, i.e. not just the webserver?

@cosmo0920
Copy link
Contributor Author

Can we add a docs PR @cosmo0920 to cover this on both the reload page and the metrics description page?

Definitely. I'll add them in fluent-bit doc.

src/flb_metrics.c Show resolved Hide resolved
@edsiper edsiper merged commit a0d34a1 into master Sep 21, 2023
45 checks passed
@edsiper edsiper deleted the cosmo0920-expose-the-count-of-hot-reloading branch September 21, 2023 04:54
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.

3 participants