Skip to content

Commit

Permalink
Update OTelSpan.java
Browse files Browse the repository at this point in the history
Add parsing of db.statement and db.user attributes for OpenTelementy Plugin.

This will allow users to write an own Elastic APM Plugin for a not yet supported database and also add the executed statement to the span (like with the supported DBs)
  • Loading branch information
Shaoranlaos authored Dec 21, 2023
1 parent f1c5748 commit ebb252e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,13 @@ private void onSpanEnd(co.elastic.apm.agent.impl.transaction.Span s) {
type = "db";
subType = dbSystem;
String dbName = (String) attributes.get("db.name");
String dbStatement = (String) attributes.get("db.statement");
String dbUser = (String) attributes.get("db.user");
s.getContext().getDb()
.withType(subType)
.withInstance(dbName);
.withInstance(dbName)
.withStatement(dbStatement)
.withUser(dbUser);
s.getContext().getServiceTarget()
.withType(subType)
.withName(dbName);
Expand Down

0 comments on commit ebb252e

Please sign in to comment.