Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import io.micrometer.common.KeyValue;
import io.micrometer.common.KeyValues;
import java.util.ArrayList;
import java.util.List;

public class DefaultBoltExchangeConvention implements BoltExchangeConvention {
Expand All @@ -43,12 +44,17 @@ public String getContextualName(BoltExchangeContext context) {

@Override
public KeyValues getLowCardinalityKeyValues(BoltExchangeContext context) {
return KeyValues.of(
DB_SYSTEM_NAME,
NETWORK_PROTOCOL_NAME,
boltVersion(context),
serverAddress(context),
serverPort(context));
return KeyValues.of(DB_SYSTEM_NAME, NETWORK_PROTOCOL_NAME, boltVersion(context), serverAddress(context))
.and(extraLowCardinalityKeyValues(context));
}

private KeyValues extraLowCardinalityKeyValues(BoltExchangeContext context) {
var list = new ArrayList<KeyValue>();
var serverPort = serverPort(context);
if (serverPort != null) {
list.add(serverPort);
}
return KeyValues.of(list);
}

@Override
Expand All @@ -66,8 +72,11 @@ private KeyValue serverAddress(BoltExchangeContext context) {
}

private KeyValue serverPort(BoltExchangeContext context) {
return Neo4jDriverDocumentation.BoltExchangeLowCardinalityKeyNames.SERVER_PORT.withValue(
String.valueOf(context.port()));
var port = context.port();
return port >= 0
? Neo4jDriverDocumentation.BoltExchangeLowCardinalityKeyNames.SERVER_PORT.withValue(
String.valueOf(port))
: null;
}

private KeyValue messages(BoltExchangeContext context) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<maven.deploy.skip>true</maven.deploy.skip>

<!-- Versions -->
<neo4j-bolt-connection-bom.version>8.3.0</neo4j-bolt-connection-bom.version>
<neo4j-bolt-connection-bom.version>8.4.0</neo4j-bolt-connection-bom.version>
<reactive-streams.version>1.0.4</reactive-streams.version>
<!-- Please note that when updating this dependency -->
<!-- (i.e. due to a security vulnerability or bug) that the -->
Expand Down