Skip to content

Added label: vlanid to system_interface.go - #279

Merged
bastischubert merged 1 commit into
prometheus-community:mainfrom
jseifeddine:feature/add-vlanid-label
Apr 4, 2026
Merged

Added label: vlanid to system_interface.go#279
bastischubert merged 1 commit into
prometheus-community:mainfrom
jseifeddine:feature/add-vlanid-label

Conversation

@jseifeddine

@jseifeddine jseifeddine commented Feb 9, 2024

Copy link
Copy Markdown
Contributor

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
Comment thread pkg/probe/system_interface.go Outdated
RxBytes float64 `json:"rx_bytes"`
TxErrors float64 `json:"tx_errors"`
RxErrors float64 `json:"rx_errors"`
VlanID int `json:"vlanid"`

@jseifeddine jseifeddine Feb 9, 2024

Copy link
Copy Markdown
Contributor Author

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

Comment thread pkg/probe/system_interface.go Outdated
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)

@jseifeddine jseifeddine Feb 9, 2024

Copy link
Copy Markdown
Contributor Author

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

@jseifeddine jseifeddine left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added notes

@bastischubert

Copy link
Copy Markdown
Contributor

tested with 6.4 + 7.6 - can you @jseifeddine resolve the conflict and i'm happy to merge

@jseifeddine
jseifeddine force-pushed the feature/add-vlanid-label branch 5 times, most recently from 31e6c23 to e4196c6 Compare April 2, 2026 10:18
@jseifeddine

Copy link
Copy Markdown
Contributor Author

@bastischubert thanks, done

@jseifeddine
jseifeddine force-pushed the feature/add-vlanid-label branch 6 times, most recently from c6c25c0 to b899d89 Compare April 2, 2026 11:28
Signed-off-by: Jad Seifeddine <jad.seifeddine@icloud.com>
@jseifeddine
jseifeddine force-pushed the feature/add-vlanid-label branch from b899d89 to 3a28f2d Compare April 2, 2026 11:33
@jseifeddine

jseifeddine commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

good to go now @bastischubert sorry about that

➜ jadseifeddine fortigate_exporter (feature/add-vlanid-label) ✔ golangci-lint run ./...
0 issues.

@Philldomd Philldomd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lgtm

@bastischubert bastischubert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@bastischubert
bastischubert merged commit 7b8075b into prometheus-community:main Apr 4, 2026
9 checks passed
@SuperQ

SuperQ commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

FYI, this change broke the main build. The tests do not pass.

@SuperQ SuperQ mentioned this pull request Apr 16, 2026
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.

4 participants