Skip to content

Commit

Permalink
added log in transmission and deleted trace operation error metric
Browse files Browse the repository at this point in the history
  • Loading branch information
vineeth.peddi committed Apr 10, 2024
1 parent 0db53de commit bff6a5f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
47 changes: 0 additions & 47 deletions metrics/opsramp.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,51 +545,6 @@ func (p *OpsRampMetrics) Populate() {
p.RenewClient()
}

func ConvertLabelsToMap(labels []prompb.Label) map[string]string {
labelMap := make(map[string]string)
for _, label := range labels {
labelMap[label.Name] = label.Value
}
return labelMap
}

func (p *OpsRampMetrics) calculateTraceOperationError(metricFamilySlice []*io_prometheus_client.MetricFamily) {
var labelMap map[string]string
uniqueLabelsMap := make(map[string][]prompb.Label)
uniqueFailedMap := make(map[string]float64)
uniqueSpansMap := make(map[string]float64)
for _, metricFamily := range metricFamilySlice {
if !p.re.MatchString(metricFamily.GetName()) {
continue
}
if metricFamily.GetName() == "trace_operations_failed" {
for _, metric := range metricFamily.GetMetric() {
var labels []prompb.Label
for _, label := range metric.GetLabel() {
labels = append(labels, prompb.Label{
Name: label.GetName(),
Value: label.GetValue(),
})
}
key := "trace_operations_failed&"
labelSlice := metric.GetLabel()
sort.Slice(labelSlice, func(i, j int) bool {
return labelSlice[i].GetName()+labelSlice[i].GetValue() > labelSlice[j].GetName()+labelSlice[i].GetValue()
})
for _, label := range labelSlice {
key += label.GetName() + label.GetValue()
}
uniqueFailedMap[key] = *metric.Counter.Value
uniqueLabelsMap[key] = labels
}
}
}
for key := range uniqueLabelsMap {
labelMap = ConvertLabelsToMap(uniqueLabelsMap[key])
p.GaugeWithLabels("trace_operations_error", labelMap, uniqueFailedMap[key]/uniqueSpansMap[key])
}
}

func (p *OpsRampMetrics) Push() (int, error) {
metricsConfig := p.Config.GetMetricsConfig()

Expand Down Expand Up @@ -634,8 +589,6 @@ func (p *OpsRampMetrics) Push() (int, error) {
return -1, err
}

p.calculateTraceOperationError(metricFamilySlice)

metricFamilySlice, err = p.promRegistry.Gather()
if err != nil {
return -1, err
Expand Down
2 changes: 2 additions & 0 deletions pkg/libtrace/transmission/transmission.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ func (h *TraceProxy) tryAdd(ev *Event) bool {
h.musterLock.RLock()
defer h.musterLock.RUnlock()

h.Logger.Debug().Logf("adding event to transmission; queue length %d", len(h.muster.Work))

if h.BlockOnSend {
h.muster.Work <- ev
return true
Expand Down

0 comments on commit bff6a5f

Please sign in to comment.