Added label: vlanid to system_interface.go#279
Open
jseifeddine wants to merge 1 commit intoprometheus-community:mainfrom
Open
Added label: vlanid to system_interface.go#279jseifeddine wants to merge 1 commit intoprometheus-community:mainfrom
jseifeddine wants to merge 1 commit intoprometheus-community:mainfrom
Conversation
c8ceb13 to
3714c6d
Compare
jseifeddine
commented
Feb 9, 2024
| RxBytes float64 `json:"rx_bytes"` | ||
| TxErrors float64 `json:"tx_errors"` | ||
| RxErrors float64 `json:"rx_errors"` | ||
| VlanID int `json:"vlanid"` |
Author
There was a problem hiding this comment.
json:"vlanid" is an int, I tried keeping as string (for Prometheus metric label), but:
Error: json: cannot unmarshal number into Go struct field ifResult.Results.vlanid of type string
jseifeddine
commented
Feb 9, 2024
| m = append(m, prometheus.MustNewConstMetric(mRxB, prometheus.CounterValue, ir.RxBytes, v.VDOM, ir.Name, ir.Alias, ir.Interface)) | ||
| m = append(m, prometheus.MustNewConstMetric(mTxErr, prometheus.CounterValue, ir.TxErrors, v.VDOM, ir.Name, ir.Alias, ir.Interface)) | ||
| m = append(m, prometheus.MustNewConstMetric(mRxErr, prometheus.CounterValue, ir.RxErrors, v.VDOM, ir.Name, ir.Alias, ir.Interface)) | ||
| vlan_string := strconv.Itoa(ir.VlanID) |
Author
There was a problem hiding this comment.
Prometheus label must be a string, so we convert it before adding to the metric
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in 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.
Feature add for issue #249
@bluecmd please review 🔢
We have this tested and working in our environment for the last ~6 months, no issues to date.