github.com/elfadel/cilium@v1.6.12/pkg/datapath/loader/metrics.go (about) 1 // Copyright 2019 Authors of Cilium 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package loader 16 17 import ( 18 "github.com/cilium/cilium/pkg/spanstat" 19 ) 20 21 // SpanStat is a statistics structure for storing metrics related to datapath 22 // load operations. 23 type SpanStat struct { 24 bpfCompilation spanstat.SpanStat 25 bpfWaitForELF spanstat.SpanStat 26 bpfWriteELF spanstat.SpanStat 27 bpfLoadProg spanstat.SpanStat 28 } 29 30 // GetMap returns a map of statistic names to stats 31 func (s *SpanStat) GetMap() map[string]*spanstat.SpanStat { 32 return map[string]*spanstat.SpanStat{ 33 "bpfCompilation": &s.bpfCompilation, 34 "bpfWaitForELF": &s.bpfWaitForELF, 35 "bpfWriteELF": &s.bpfWriteELF, 36 "bpfLoadProg": &s.bpfLoadProg, 37 } 38 }