Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(servicegraphs): Add support for db.system.name #4656

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1319,3 +1319,4 @@ Additionally, default label `span_status` is renamed to `status_code`.
* [BUGFIX] Increase Prometheus `notfound` metric on tempo-vulture. [#301](https://github.com/grafana/tempo/pull/301)
* [BUGFIX] Return 404 if searching for a tenant id that does not exist in the backend. [#321](https://github.com/grafana/tempo/pull/321)
* [BUGFIX] Prune in-memory blocks from missing tenants. [#314](https://github.com/grafana/tempo/pull/314)
* [ENHANCEMENT] Fix db.system.name attribute not being set in servicegraphs processor. [#4656](https://github.com/grafana/tempo/pull/4656)
15 changes: 12 additions & 3 deletions modules/generator/processor/servicegraphs/servicegraphs.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (p *Processor) upsertPeerNode(e *store.Edge, spanAttr []*v1_common.KeyValue
}

// upsertDatabaseRequest handles the logic of adding a database edge on the
// graph. If we have a db.name or db.system attribute, we assume this is a
// graph. If we have a db.name or db.system or db.system.name attribute, we assume this is a
// database request. The name of the edge is determined by the following
// order:
//
Expand All @@ -300,12 +300,21 @@ func (p *Processor) upsertDatabaseRequest(e *store.Edge, resourceAttr []*v1_comm

// Check for db.system only if we don't have db.name above
if !isDatabase {
if _, ok := processor_util.FindAttributeValue(string(semconv.DBSystemKey), resourceAttr, span.Attributes); ok {
if name, ok := processor_util.FindAttributeValue(string(semconv.DBSystemKey), resourceAttr, span.Attributes); ok {
dbName = name
isDatabase = true
}
}

// If neither db.system nor db.name are present, we can't determine if this is a database request
// Check for db.system.name if neither above is found
if !isDatabase {
if name, ok := processor_util.FindAttributeValue(string(semconv.DBSystemNameKey), resourceAttr, span.Attributes); ok {
dbName = name
isDatabase = true
}
}

// If neither db.system nor db.name nor db.system.name are present, we can't determine if this is a database request
if !isDatabase {
return
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading