JDBC spans report the whole host list as the host for multi-host connection URLs
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 70/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- java
- Bereich
- observability
Rechercherichtung
Das Issue nennt ConnectionMetaData.parse und zeigt PostgreSQL- und H2-URLs mit mehreren Hosts, nennt aber keine Quell- oder Testdateien. Suche zunächst den Code für das Parsen von URLs und die vorhandenen Tests für MySQL und MariaDB mit mehreren Hosts. Prüfe anschließend, wie Hosts und Ports in PostgreSQL und H2 geparst werden. Als abgeschlossen gilt die Arbeit, wenn für die Beispiele im Issue der erste Host und sein Port angegeben werden und Tests beide URL-Formate abdecken.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
The JDBC plugin parses the connection URL that DatabaseMetaData.getURL() returns to fill the destination and database fields of JDBC spans. When the URL lists more than one host, as in PostgreSQL failover/load balancing URLs or H2 cluster URLs, the parser treats the full comma-separated host list as a single host.
For example, jdbc:postgresql://myhost1:666,myhost2:777/database produces:
- host:
myhost1:666,myhost2:777(expectedmyhost1) - port:
5432, the default (expected666)
jdbc:h2:tcp://server1:9101,server2:9102/~/sample produces host server1:9101,server2:9102 and port -1.
The PostgreSQL driver returns the original connection URL from getURL(), so every span on such a connection reports this host and port in destination.address, destination.port and the service target. The MySQL and MariaDB parsers already use the first host of a multi-host URL.
Steps to reproduce
- Connect to PostgreSQL with a multi-host URL, for example
jdbc:postgresql://host1:5432,host2:5432/db?targetServerType=primary. - Run a query while a transaction is active.
- Inspect the JDBC span:
destination.addressishost1:5432,host2:5432.
The same result is visible in a unit test:
ConnectionMetaData metadata = ConnectionMetaData.parse("jdbc:postgresql://myhost1:666,myhost2:777/database").build();
metadata.getHost(); // "myhost1:666,myhost2:777"
metadata.getPort(); // 5432
Expected behavior
The agent uses the first host and its port, as it already does for MySQL and MariaDB multi-host URLs.
Environment
- Agent version: current
main(1.57.2-SNAPSHOT) - Drivers: PostgreSQL JDBC (multi-host URLs), H2 (cluster URLs)
- Vorherrschende Sprache
- Java
- Sterne
- 592
- Forks
- 340
- Ø Merge
- 2 T. 17 Std.
- Gemergte PRs (30 T.)
- 17
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus elastic/apm-agent-java
-
Spring MVC View instrumentation incorrectly matches static render overloads (EasyPOI)Evtl. wieder frei @VelpulaGangavardhan hat das vor 21 Tagen übernommen, und es ist kein Pull Request offen. Offenagent-java community triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
elastic/apm-agent-java#4594 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent-java
Schwierigkeit 2/5 1-2 Tage Anfängerfreundlichkeit 62/100
elastic/apm-agent-java#2844 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Improve docs and add error log related to illegal activation of transactionEvtl. vergeben @AzazelSensei hat das vor 58 Tagen übernommen. Offendocs good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
elastic/apm-agent-java#850 · 4 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Log4j 2.7 log correlation calls ThreadContext.removeAll, which was introduced in 2.8Evtl. vergeben @Anshuman-Prakash hat das vor 18 Tagen übernommen. Offenagent-java community triage
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
elastic/apm-agent-java#4593 ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent-java community triage
elastic/apm-agent-java#4573 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in elastic/apm-agent-java
Ähnliche Issues
-
Good First Issue
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
hiero-ledger/hiero-sdk-java#3044 ·
Maintainer antworten meist innerhalb von 1 Tag
-
A second build without clean fails in resources-optimizer-maven-plugin because minified files are minified againEvtl. vergeben @papegaaij hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
hermes-queue
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
chrisalunlloyd2-sudo/mindpalace#337 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
flutter/flutter-intellij#9221 ·
Maintainer antworten meist innerhalb von 1 Tag