Skip to content
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

Update VPP 19.08 #1394

Merged
merged 4 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions plugins/govppmux/vppcalls/vpp1904/vpe_vppcalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (

func init() {
var msgs []govppapi.Message
msgs = append(msgs, vpe.Messages...)
msgs = append(msgs, memclnt.Messages...)
msgs = append(msgs, vpe.AllMessages()...)
msgs = append(msgs, memclnt.AllMessages()...)

vppcalls.Versions["vpp1904"] = vppcalls.HandlerVersion{
Msgs: msgs,
Expand Down
4 changes: 2 additions & 2 deletions plugins/govppmux/vppcalls/vpp1908/vpe_vppcalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (

func init() {
var msgs []govppapi.Message
msgs = append(msgs, vpe.Messages...)
msgs = append(msgs, memclnt.Messages...)
msgs = append(msgs, vpe.AllMessages()...)
msgs = append(msgs, memclnt.AllMessages()...)

vppcalls.Versions["vpp1908"] = vppcalls.HandlerVersion{
Msgs: msgs,
Expand Down
78 changes: 40 additions & 38 deletions plugins/telemetry/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func (p *Plugin) updatePrometheus(ctx context.Context) {
p.Log.Errorf("GetRuntimeInfo failed: %v", err)
} else {
p.tracef("runtime info: %+v", runtimeInfo)
for _, thread := range runtimeInfo.Threads {
for _, thread := range runtimeInfo.GetThreads() {
for _, item := range thread.Items {
stats, ok := p.runtimeStats[item.Name]
if !ok {
Expand Down Expand Up @@ -372,7 +372,7 @@ func (p *Plugin) updatePrometheus(ctx context.Context) {
p.Log.Errorf("GetBuffersInfo failed: %v", err)
} else {
p.tracef("buffers info: %+v", buffersInfo)
for _, item := range buffersInfo.Items {
for _, item := range buffersInfo.GetItems() {
stats, ok := p.buffersStats[item.Name]
if !ok {
stats = &buffersStats{
Expand Down Expand Up @@ -409,7 +409,7 @@ func (p *Plugin) updatePrometheus(ctx context.Context) {
p.Log.Errorf("GetMemory failed: %v", err)
} else {
p.tracef("memory info: %+v", memoryInfo)
for _, thread := range memoryInfo.Threads {
for _, thread := range memoryInfo.GetThreads() {
stats, ok := p.memoryStats[thread.Name]
if !ok {
stats = &memoryStats{
Expand Down Expand Up @@ -447,7 +447,7 @@ func (p *Plugin) updatePrometheus(ctx context.Context) {
p.Log.Errorf("GetNodeCounters failed: %v", err)
} else {
p.tracef("node counters info: %+v", nodeCountersInfo)
for _, item := range nodeCountersInfo.Counters {
for _, item := range nodeCountersInfo.GetCounters() {
stats, ok := p.nodeCounterStats[item.Name]
if !ok {
stats = &nodeCounterStats{
Expand Down Expand Up @@ -476,43 +476,45 @@ func (p *Plugin) updatePrometheus(ctx context.Context) {
if err != nil {
p.Log.Errorf("GetInterfaceStats failed: %v", err)
return
}
if ifStats == nil {
p.Log.Warnf("Received nil stats from context")
return
}
p.tracef("interface stats: %+v", ifStats)
for _, item := range ifStats.Interfaces {
stats, ok := p.ifCounterStats[item.InterfaceName]
if !ok {
stats = &ifCounterStats{
name: item.InterfaceName,
metrics: map[string]prometheus.Gauge{},
}
} else {
p.tracef("interface stats: %+v", ifStats)
if ifStats == nil {
return
}
for _, item := range ifStats.Interfaces {
stats, ok := p.ifCounterStats[item.InterfaceName]
if !ok {
stats = &ifCounterStats{
name: item.InterfaceName,
metrics: map[string]prometheus.Gauge{},
}

// add gauges with corresponding labels into vectors
for k, vec := range p.ifCounterGaugeVecs {
stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{
ifCounterNameLabel: item.InterfaceName,
ifCounterIndexLabel: fmt.Sprint(item.InterfaceIndex),
})
if err != nil {
p.Log.Error(err)
// add gauges with corresponding labels into vectors
for k, vec := range p.ifCounterGaugeVecs {
stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{
ifCounterNameLabel: item.InterfaceName,
ifCounterIndexLabel: fmt.Sprint(item.InterfaceIndex),
})
if err != nil {
p.Log.Error(err)
}
}
}
}

stats.metrics[ifCounterRxPackets].Set(float64(item.RxPackets))
stats.metrics[ifCounterRxBytes].Set(float64(item.RxBytes))
stats.metrics[ifCounterRxErrors].Set(float64(item.RxErrors))
stats.metrics[ifCounterTxPackets].Set(float64(item.TxPackets))
stats.metrics[ifCounterTxBytes].Set(float64(item.TxBytes))
stats.metrics[ifCounterTxErrors].Set(float64(item.TxErrors))
stats.metrics[ifCounterDrops].Set(float64(item.Drops))
stats.metrics[ifCounterPunts].Set(float64(item.Punts))
stats.metrics[ifCounterIP4].Set(float64(item.IP4))
stats.metrics[ifCounterIP6].Set(float64(item.IP6))
stats.metrics[ifCounterRxNoBuf].Set(float64(item.RxNoBuf))
stats.metrics[ifCounterRxMiss].Set(float64(item.RxMiss))
stats.metrics[ifCounterRxPackets].Set(float64(item.RxPackets))
stats.metrics[ifCounterRxBytes].Set(float64(item.RxBytes))
stats.metrics[ifCounterRxErrors].Set(float64(item.RxErrors))
stats.metrics[ifCounterTxPackets].Set(float64(item.TxPackets))
stats.metrics[ifCounterTxBytes].Set(float64(item.TxBytes))
stats.metrics[ifCounterTxErrors].Set(float64(item.TxErrors))
stats.metrics[ifCounterDrops].Set(float64(item.Drops))
stats.metrics[ifCounterPunts].Set(float64(item.Punts))
stats.metrics[ifCounterIP4].Set(float64(item.IP4))
stats.metrics[ifCounterIP6].Set(float64(item.IP6))
stats.metrics[ifCounterRxNoBuf].Set(float64(item.RxNoBuf))
stats.metrics[ifCounterRxMiss].Set(float64(item.RxMiss))
}
}

p.tracef("update complete")
}
4 changes: 2 additions & 2 deletions plugins/telemetry/vppcalls/vpp1904/telemetry_vppcalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (

func init() {
var msgs []govppapi.Message
msgs = append(msgs, memclnt.Messages...)
msgs = append(msgs, vpe.Messages...)
msgs = append(msgs, memclnt.AllMessages()...)
msgs = append(msgs, vpe.AllMessages()...)

vppcalls.Versions["19.04"] = vppcalls.HandlerVersion{
Msgs: msgs,
Expand Down
10 changes: 8 additions & 2 deletions plugins/telemetry/vppcalls/vpp1908/telemetry_vppcalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (

func init() {
var msgs []govppapi.Message
msgs = append(msgs, memclnt.Messages...)
msgs = append(msgs, vpe.Messages...)
msgs = append(msgs, memclnt.AllMessages()...)
msgs = append(msgs, vpe.AllMessages()...)

vppcalls.Versions["19.08"] = vppcalls.HandlerVersion{
Msgs: msgs,
Expand Down Expand Up @@ -139,6 +139,8 @@ func (h *TelemetryHandler) getNodeCountersStats() (*vppcalls.NodeCounterInfo, er
errStats, err := h.stats.GetErrorStats()
if err != nil {
return nil, err
} else if errStats == nil {
return nil, nil
}

var counters []vppcalls.NodeCounter
Expand Down Expand Up @@ -227,6 +229,8 @@ func (h *TelemetryHandler) getRuntimeInfoStats() (*vppcalls.RuntimeInfo, error)
nodeStats, err := h.stats.GetNodeStats()
if err != nil {
return nil, err
} else if nodeStats == nil {
return nil, nil
}

var threads []vppcalls.RuntimeThread
Expand Down Expand Up @@ -337,6 +341,8 @@ func (h *TelemetryHandler) getBuffersInfoStats() (*vppcalls.BuffersInfo, error)
bufStats, err := h.stats.GetBufferStats()
if err != nil {
return nil, err
} else if bufStats == nil {
return nil, nil
}

var items []vppcalls.BuffersItem
Expand Down
32 changes: 32 additions & 0 deletions plugins/telemetry/vppcalls/vppcalls_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ type MemoryInfo struct {
Threads []MemoryThread `json:"threads"`
}

// GetThreads is safe getter for threads,
func (i *MemoryInfo) GetThreads() []MemoryThread {
if i == nil {
return nil
}
return i.Threads
}

// MemoryThread represents single thread memory counters
type MemoryThread struct {
ID uint `json:"id"`
Expand All @@ -63,6 +71,14 @@ type NodeCounterInfo struct {
Counters []NodeCounter `json:"counters"`
}

// GetCounters is safe getter for counters,
func (i *NodeCounterInfo) GetCounters() []NodeCounter {
if i == nil {
return nil
}
return i.Counters
}

// NodeCounter represents single node counter
type NodeCounter struct {
Value uint64 `json:"value"`
Expand All @@ -75,6 +91,14 @@ type RuntimeInfo struct {
Threads []RuntimeThread `json:"threads"`
}

// GetThreads is safe getter for threads,
func (i *RuntimeInfo) GetThreads() []RuntimeThread {
if i == nil {
return nil
}
return i.Threads
}

// RuntimeThread represents single runtime thread
type RuntimeThread struct {
ID uint `json:"id"`
Expand Down Expand Up @@ -108,6 +132,14 @@ type BuffersInfo struct {
Items []BuffersItem `json:"items"`
}

// GetItems is safe getter for items,
func (i *BuffersInfo) GetItems() []BuffersItem {
if i == nil {
return nil
}
return i.Items
}

// BuffersItem represents single buffers item
type BuffersItem struct {
ThreadID uint `json:"thread_id"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

func init() {
var msgs []govppapi.Message
msgs = append(msgs, abf.Messages...)
msgs = append(msgs, abf.AllMessages()...)

vppcalls.Versions["vpp1904"] = vppcalls.HandlerVersion{
Msgs: msgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

func init() {
var msgs []govppapi.Message
msgs = append(msgs, abf.Messages...)
msgs = append(msgs, abf.AllMessages()...)

vppcalls.Versions["vpp1908"] = vppcalls.HandlerVersion{
Msgs: msgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

func init() {
var msgs []govppapi.Message
msgs = append(msgs, acl.Messages...)
msgs = append(msgs, acl.AllMessages()...)

vppcalls.Versions["vpp1904"] = vppcalls.HandlerVersion{
Msgs: msgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

func init() {
var msgs []govppapi.Message
msgs = append(msgs, acl.Messages...)
msgs = append(msgs, acl.AllMessages()...)

vppcalls.Versions["vpp1908"] = vppcalls.HandlerVersion{
Msgs: msgs,
Expand Down
63 changes: 38 additions & 25 deletions plugins/vpp/binapi/vpp1904/abf/abf.ba.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading