Skip to content

Commit

Permalink
fix servicegraph bug(orgin open-telemetry#32019)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frapschen committed Apr 7, 2024
1 parent dfb29e3 commit 5b57c79
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
3 changes: 1 addition & 2 deletions connector/servicegraphconnector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,9 @@ func (p *serviceGraphConnector) aggregateMetricsForEdge(e *store.Edge) {
p.seriesMutex.Lock()
defer p.seriesMutex.Unlock()
p.updateSeries(metricKey, dimensions)
p.updateCountMetrics(metricKey)
if e.Failed {
p.updateErrorMetrics(metricKey)
} else {
p.updateCountMetrics(metricKey)
}
p.updateDurationMetrics(metricKey, e.ServerLatencySec, e.ClientLatencySec)
}
Expand Down
7 changes: 4 additions & 3 deletions connector/servicegraphconnector/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ func TestConnectorConsume(t *testing.T) {
assert.NoError(t, err)

err = pmetrictest.CompareMetrics(expectedMetrics, actualMetrics,
pmetrictest.IgnoreMetricsOrder(),
pmetrictest.IgnoreMetricDataPointsOrder(),
pmetrictest.IgnoreResourceMetricsOrder(),
pmetrictest.IgnoreResourceMetricsOrder(), pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreTimestamp())
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreTimestamp(),
)
require.NoError(t, err)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ resourceMetrics:
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
isMonotonic: true
- name: traces_service_graph_request_total
sum:
aggregationTemporality: 2
dataPoints:
- asInt: "1"
attributes:
- key: client
value:
stringValue: foo
- key: connection_type
value:
stringValue: ""
- key: failed
value:
boolValue: true
- key: server
value:
stringValue: bar
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
isMonotonic: true
- name: traces_service_graph_request_failed_total
sum:
aggregationTemporality: 2
Expand Down

0 comments on commit 5b57c79

Please sign in to comment.