Description
Component(s)
connector/servicegraphconnector
What happened?
Description
Metrics for spans with extra dimensions configured are incorrectly being aggregated together despite the dimension values being different.
Steps to Reproduce
Add 2 additional test spans to testdata/extra-dimensions-queue-db-trace.yaml with new trace ID and different values for messaging.system and db.system (e.g. not-kafka, and not-postgres).
Expected Result
Resulting metric values for traces_service_graph_request_total should be 2 datapoints with value 1 and the unique attribute set for kafka/not-kafka + postgres/not-postgres.
Actual Result
Resulting metric values for traces_service_graph_request_total is 1 datapoint with value 2 and the single attribute set of kafka + postgres.
Collector version
v0.120.0
Environment information
Environment
OS: Mac
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
Log output
Additional context
Think the lookup statement in L617 doesn't take the server_ and client_ prefix into account. Something like this seems to fix:
for _, dimName := range p.config.Dimensions {
for _, kind := range []string{clientKind, serverKind} {
dim, ok := edgeDimensions[kind+"_"+dimName]
if !ok {
continue
}
metricKey.WriteString(metricKeySeparator + kind + "_" + dimName + "_" + dim)
}
}