Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
Signed-off-by: LiZhenCheng9527 <[email protected]>
  • Loading branch information
LiZhenCheng9527 committed Aug 31, 2024
1 parent 423688c commit 19475c3
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions pkg/controller/telemetry/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,19 +475,6 @@ func buildPrincipal(workload *workloadapi.Workload) string {
}

func (m *MetricController) buildWorkloadMetricsToPrometheus(data requestMetric, labels workloadMetricLabels) {
// commonLabels := struct2map(labels)

// if data.state == TCP_ESTABLISHED {
// tcpConnectionOpenedInWorkload.With(commonLabels).Add(float64(1))
// }
// if data.state == TCP_CLOSTED {
// tcpConnectionClosedInWorkload.With(commonLabels).Add(float64(1))
// }
// if data.success != connection_success {
// tcpConnectionFailedInWorkload.With(commonLabels).Add(float64(1))
// }
// tcpReceivedBytesInWorkload.With(commonLabels).Add(float64(data.receivedBytes))
// tcpSentBytesInWorkload.With(commonLabels).Add(float64(data.sentBytes))
_, ok := m.metricCache.WorkloadConnReceivedBytes[labels]
if ok {
if data.state == TCP_ESTABLISHED {
Expand Down Expand Up @@ -517,19 +504,6 @@ func (m *MetricController) buildWorkloadMetricsToPrometheus(data requestMetric,
}

func (m *MetricController) buildServiceMetricsToPrometheus(data requestMetric, labels serviceMetricLabels) {
// commonLabels := struct2map(labels)

// if data.state == TCP_ESTABLISHED {
// tcpConnectionOpenedInService.With(commonLabels).Add(float64(1))
// }
// if data.state == TCP_CLOSTED {
// tcpConnectionClosedInService.With(commonLabels).Add(float64(1))
// }
// if data.success != uint32(1) {
// tcpConnectionFailedInService.With(commonLabels).Add(float64(1))
// }
// tcpReceivedBytesInService.With(commonLabels).Add(float64(data.receivedBytes))
// tcpSentBytesInService.With(commonLabels).Add(float64(data.sentBytes))
_, ok := m.metricCache.ServiceConnReceivedBytes[labels]
if ok {
if data.state == TCP_ESTABLISHED {
Expand Down Expand Up @@ -573,12 +547,10 @@ func (m *MetricController) updatePrometheusMetric() error {
sType := typ.Field(i)
sVal := val.Field(i).Interface()
workloadMap, isWorkload := sVal.(map[workloadMetricLabels]float64)
// fmt.Printf("\n ------- %v, \n%v -------- \n", workloadMap, isWorkload)
if isWorkload {
for k, v := range workloadMap {
name := sType.Name
commonLabels := struct2map(k)
// fmt.Printf("name is %v, value is: %v", name, v)
switch name {
case "WorkloadConnOpened":
tcpConnectionOpenedInWorkload.With(commonLabels).Set(float64(v))
Expand All @@ -594,7 +566,6 @@ func (m *MetricController) updatePrometheusMetric() error {
}
}
serviceMap, isService := sVal.(map[serviceMetricLabels]float64)
// fmt.Printf("\n ------- %v, \n%v -------- \n", serviceMap, isService)
if isService {
for k, v := range serviceMap {
name := sType.Name
Expand Down

0 comments on commit 19475c3

Please sign in to comment.