Skip to content

Conversation

jseifeddine
Copy link

@jseifeddine jseifeddine commented Feb 9, 2024

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.

@jseifeddine jseifeddine force-pushed the feature/add-vlanid-label branch from c8ceb13 to 3714c6d Compare February 9, 2024 11:18
RxBytes float64 `json:"rx_bytes"`
TxErrors float64 `json:"tx_errors"`
RxErrors float64 `json:"rx_errors"`
VlanID int `json:"vlanid"`
Copy link
Author

@jseifeddine jseifeddine Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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)
Copy link
Author

@jseifeddine jseifeddine Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prometheus label must be a string, so we convert it before adding to the metric

Copy link
Author

@jseifeddine jseifeddine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant