-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add Prometheus support v2 #342
Open
SchumacherFM
wants to merge
76
commits into
volkszaehler:master
Choose a base branch
from
SchumacherFM:feature/prometheus
base: master
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.
Open
Add Prometheus support v2 #342
SchumacherFM
wants to merge
76
commits into
volkszaehler:master
from
SchumacherFM:feature/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
SchumacherFM
force-pushed
the
feature/prometheus
branch
2 times, most recently
from
April 14, 2024 07:29
0142575
to
2b9f08a
Compare
SchumacherFM
force-pushed
the
feature/prometheus
branch
from
July 7, 2024 18:54
89e3f6c
to
a8d9193
Compare
If you open this project in GoLand, it will create a .idea/ directory which could have been tracked by Git.
Some metrics are implemented in handler.go and scan.go. Each metrics is accessible via global variable. Helper method UpdateMeasurementMetric adds flexibility to updating specific measurement without hardcoding Prometheus Metric in certain places.
When using newGaugeOpts/newCounterOpts, all objects will share the same namespace "mbmd"
…auges of measurements Instead of creating a new counter/gauges for a measurement by hand, we simply just add a newly added measurement to the appropriate counterVeh/gaugesVeh map. This also means that everytime a new measurement in meters.Measurement is introduced, the maps in prometheus.go need to be updated as well.
Instead of actively managing and storing each measurement in gauges and counters map respectively, in measurements.go, each entry in `iec` is assigned a PrometheusMetricType. When prometheus_metrics.Init is called, the appropriate prometheus.Metric will be initialized and will still be stored in gauges/counters map, but its content now dynamically changes based on meters.Measurements actually enum entries, making meters.Measurements the single instance of responsibility for handling metric types.
Instead of creating only one instance of each Prometheus metric measurement, each metric will now differ in each device's manufacturer
Each static metrics is now categorized by interface `collectable`. `collectable.Collect()` will be called when all static metrics are registered to the default Prometheus registry.
When using `prometheus.MustRegister(...)`, the app will panic if a slice entry is nil. Meanwhile fail fast isn't bad, the stack trace doesn't provide enough/precise information about the panic. `prometheus.Register(prometheus.Collector)` however returns an error object which makes it much easier to troubleshoot metric registrations.
This allows us to pass a measurement's timestamp and using setters on gauges.
# Conflicts: # go.mod # go.sum
remove collectors for device, handlers, publishers and sockets as they are superfluous and uninteresting.
reduces the name FQ name of measurement und moves the unit with its abbreviation into the label/value section.
because contains code gen programs
it does not make sense and make grafana implementation more difficult. Ot it's me ;-)
use direct map access instead of iterating over it.
than previous value, if set. if the current value is lower than we skip that value
SchumacherFM
force-pushed
the
feature/prometheus
branch
from
August 3, 2024 08:34
a8d9193
to
af4e8bf
Compare
hello @andig, is there any interest in merging that code? I aware of your lack of time. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
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 is a refactored version of #195 by @kereis
This PR runs at the moment at my home with SolarEdge SE10K, SE17K and the Meter.
IMHO #195 can be closed.
Waiting for your review(s).