From ebb252ed6937b4c9722005feec2668e7ef488ae7 Mon Sep 17 00:00:00 2001 From: Shaoranlaos Date: Thu, 21 Dec 2023 11:48:38 +0100 Subject: [PATCH 1/2] Update OTelSpan.java 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) --- .../elastic/apm/agent/opentelemetry/tracing/OTelSpan.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpan.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpan.java index 2fba44e39d..e107c16313 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpan.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpan.java @@ -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); From 3f51536ec3e3f2d12531ab56e36b0c3bbaf4b26f Mon Sep 17 00:00:00 2001 From: Shaoranlaos Date: Thu, 21 Dec 2023 12:30:34 +0100 Subject: [PATCH 2/2] Update CHANGELOG.asciidoc --- CHANGELOG.asciidoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index a0c8f7563f..8d7c22872e 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,6 +31,9 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: === Unreleased +===== Features +* Added support for OpenTelementry Attributes db.statement and db.user + [[release-notes-1.x]] === Java Agent version 1.x