Skip to content
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
2 changes: 1 addition & 1 deletion Dockerfile_CDAC
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2019-present Intel Corporation

# Stage bess-build: fetch BESS dependencies & pre-reqs
FROM docker.io/cdac5gc/bess_build:260417 AS bess-build
FROM docker.io/cdac5gc/bess_build:260518 AS bess-build
ARG CPU=native
ARG BESS_COMMIT=cdacmaster
ENV PLUGINS_DIR=plugins
Expand Down
13 changes: 10 additions & 3 deletions pfcpiface/bess.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ func (b *bess) SessionStats(pc *PfcpNodeCollector, ch chan<- prometheus.Metric)
}

// Prepare session stats.
createStats := func(preResp, postResp *pb.FlowMeasureReadResponse) {
createStats := func(preResp, postResp *pb.FlowMeasureReadResponse, direction string) {
for i := 0; i < len(postResp.Statistics); i++ {
var pre *pb.FlowMeasureReadResponse_Statistic

Expand Down Expand Up @@ -605,6 +605,13 @@ func (b *bess) SessionStats(pc *PfcpNodeCollector, ch chan<- prometheus.Metric)
pdrString,
ueIpString,
)
ch <- prometheus.MustNewConstMetric(
pc.ueTrafficBytes, // New descriptor
prometheus.CounterValue, // Counter type
float64(post.TotalBytes),
ueIpString, // Label: ue_ip
direction, // Label: direction
)
ch <- prometheus.MustNewConstMetric(
pc.sessionRxPackets,
prometheus.GaugeValue,
Expand Down Expand Up @@ -650,8 +657,8 @@ func (b *bess) SessionStats(pc *PfcpNodeCollector, ch chan<- prometheus.Metric)
}
}

createStats(&qosStatsInResp, &postUlQosStatsResp)
createStats(&qosStatsInResp, &postDlQosStatsResp)
createStats(&qosStatsInResp, &postUlQosStatsResp, "uplink")
createStats(&qosStatsInResp, &postDlQosStatsResp, "downlink")

return
}
Expand Down
8 changes: 8 additions & 0 deletions pfcpiface/metrics/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ type Session struct {
Duration float64
}

type UETraffic struct {
NodeID string
UEIP string
Direction string // "uplink" or "downlink"
Bytes uint64
}

func NewSession(nodeID string) *Session {
return &Session{
NodeID: nodeID,
Expand All @@ -51,5 +58,6 @@ func (s *Session) Delete() {
type InstrumentPFCP interface {
SaveMessages(m *Message)
SaveSessions(s *Session)
SaveUEThroughput(t *UETraffic)
Stop() error
}
18 changes: 18 additions & 0 deletions pfcpiface/metrics/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ type Service struct {

sessions *prometheus.GaugeVec
sessionDuration *prometheus.HistogramVec

ueThroughput *prometheus.CounterVec
}

func NewPrometheusService() (*Service, error) {
Expand Down Expand Up @@ -68,12 +70,23 @@ func NewPrometheusService() (*Service, error) {
return nil, err
}

ueThroughput := prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "upf_ue_throughput_bytes",
Help: "Total bytes transferred per UE",
}, []string{"node_id", "ue_ip", "direction"})

if err := prometheus.Register(ueThroughput); err != nil {
return nil, err
}

s := &Service{
msgCount: msgCount,
msgDuration: msgDuration,

sessions: sessions,
sessionDuration: sessionDuration,

ueThroughput: ueThroughput,
}

return s, nil
Expand All @@ -94,11 +107,16 @@ func (s *Service) SaveSessions(sess *Session) {
s.sessionDuration.WithLabelValues(sess.NodeID).Observe(sess.Duration)
}

func (s *Service) SaveUEThroughput(t *UETraffic) {
s.ueThroughput.WithLabelValues(t.NodeID, t.UEIP, t.Direction).Add(float64(t.Bytes))
}

func (s *Service) Stop() error {
prometheus.Unregister(s.msgCount)
prometheus.Unregister(s.msgDuration)
prometheus.Unregister(s.sessions)
prometheus.Unregister(s.sessionDuration)
prometheus.Unregister(s.ueThroughput)

return nil
}
5 changes: 5 additions & 0 deletions pfcpiface/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ type PfcpNodeCollector struct {
sessionRxPackets *prometheus.Desc
sessionDroppedPackets *prometheus.Desc
sessionTxBytes *prometheus.Desc
ueTrafficBytes *prometheus.Desc
}

func NewPFCPNodeCollector(node *PFCPNode) *PfcpNodeCollector {
Expand All @@ -148,6 +149,10 @@ func NewPFCPNodeCollector(node *PFCPNode) *PfcpNodeCollector {
"Shows the total number of packets received for a given session in UPF",
[]string{"fseid", "pdr", "ue_ip"}, nil,
),
ueTrafficBytes: prometheus.NewDesc(prometheus.BuildFQName("upf", "ue", "traffic_bytes"),
"Total bytes transferred per UE and direction",
[]string{"ue_ip", "direction"}, nil,
),
sessionDroppedPackets: prometheus.NewDesc(prometheus.BuildFQName("upf", "session", "dropped_packets"),
"Shows the number of packets dropped for a given session in UPF",
[]string{"fseid", "pdr", "ue_ip"}, nil,
Expand Down
Loading