-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Integrate network statistics to Prometheus #81712
Draft
jukkar
wants to merge
15
commits into
zephyrproject-rtos:main
Choose a base branch
from
jukkar:devel/net-stats-to-prometheus
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Integrate network statistics to Prometheus #81712
jukkar
wants to merge
15
commits into
zephyrproject-rtos:main
from
jukkar:devel/net-stats-to-prometheus
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jukkar
added
In progress
For PRs: is work in progress and should not be merged yet. For issues: Is being worked on
area: Networking
labels
Nov 21, 2024
Add function to increase the counter value with arbitrary value. Signed-off-by: Jukka Rissanen <[email protected]>
Add a test that will test the counter value add functionality. Signed-off-by: Jukka Rissanen <[email protected]>
This is similar function as add, but will add the difference of previous value and the new one. This can be used if we want to periodically update the value with a new one but don't want to keep track of the old one. Signed-off-by: Jukka Rissanen <[email protected]>
Add a test that will test the counter value set functionality. Signed-off-by: Jukka Rissanen <[email protected]>
Save same memory and store metrics into a linked list inside a collector entry. Signed-off-by: Jukka Rissanen <[email protected]>
Instead of allocating space for description and label name + value, have a const pointer for it. The data is set typically statically when the metric is defined, so there should be no need to allocate separate buffer for those strings. Signed-off-by: Jukka Rissanen <[email protected]>
Embed "struct prometheus_metric" to individual metric like counter, gauge, histogram and summary. This way we avoid having a separate base pointer in specific metrict struct. We also do not need to search the specific metric from base metric as we can simply use CONTAINER_OF() macro to get the base metric. This embedding means that the counter, gauge, histogram and summary metric define macros are changed as user does not need to create a separate "struct prometheus_metric". Convert the tests and sample to use the new macros. Remove also the static from metric creation macros so that user can decide whether it needs collector to be static or not. Signed-off-by: Jukka Rissanen <[email protected]>
Prometheus macros have changed in order to lower memory consumption. Signed-off-by: Jukka Rissanen <[email protected]>
Allow user to configure the label count from Kconfig. Signed-off-by: Jukka Rissanen <[email protected]>
When creating prometheus network statistics variables, we need to map the variables back to the collector, so add a backpointer to it. Signed-off-by: Jukka Rissanen <[email protected]>
Add collector parameter to metric creation macros so that it is possible to bind the metric to collector already at built time. Also add optional user_data to metric macro calls so that user can add optional data there. This will be used by network statistics Prometheus support in subsequent commits. Signed-off-by: Jukka Rissanen <[email protected]>
Remove the "static" from HTTP service definition macro so that user is able to add it or leave it out if needed. Signed-off-by: Jukka Rissanen <[email protected]>
Allow user to update prometheus metrics from network statistics. Signed-off-by: Jukka Rissanen <[email protected]>
Instead of requiring one big buffer for formatting the output, have a walk function that can be used to generate output by one metric at a time. Signed-off-by: Jukka Rissanen <[email protected]>
Add separate URL handling for network statistics. Signed-off-by: Jukka Rissanen <[email protected]>
jukkar
force-pushed
the
devel/net-stats-to-prometheus
branch
from
November 21, 2024 16:33
d23a476
to
20309cd
Compare
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: Networking
In progress
For PRs: is work in progress and should not be merged yet. For issues: Is being worked on
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows network statistics to be exported via Prometheus.
Some of the Prometheus APIs are changed as they did not play very well with a real life example.
The PR is still WIP and is missing these things:
Fix HTTP server so that we do not need to allocate massive buffer for the Prometheus data that is sent. The scraped data, that is to be sent out via HTTP GET request, needs to be sent in small chunks so that we do not need to allocate a large buffer for that.prometheus_format_exposition()
as it no longer works as expected