Should you find you have some issues that persist after verification of the sizing and resources for your Aura instance, it can be useful to troubleshoot connection or driver behaviour in order to gather some further traces.
Usually this should be considered after engaging with the support team and should not be the first element to bring within your support ticket. The first things to evaluate are that the environment and / or the configuration is not the source of issues seen.
To enable the Bolt protocol debug traces with the Go driver please follow these instructions (depending on the version)
Enabling logs - Driver version >= 4.3
package main
import (
"fmt"
"github.com/neo4j/neo4j-go-driver/v4/neo4j"
"io"
)
func main() {
creds := neo4j.BasicAuth("neo4j", "password", "")
driver, err := neo4j.NewDriver("neo4j+s://dbid1234.databases.neo4j.io:7687",
creds,
withConsoleLogger)
if err != nil { panic(err) }
defer release(driver)
// Bolt logging can be enabled per session (default is to not log anything) - regardless of driver logging configuration
session := driver.NewSession(neo4j.SessionConfig{BoltLogger: neo4j.ConsoleBoltLogger()})
defer release(session)
records, err := session.Run("RETURN 1", map[string]interface{}{})
if err != nil { panic(err) }
singleRecord, err := records.Single()
if err != nil { panic(err) }
result, _ := singleRecord.Get("1")
fmt.Printf("%v\n", result)
}
func withConsoleLogger(config *neo4j.Config) {
// one of: neo4j.ERROR, neo4j.WARNING, neo4j.INFO, neo4j.DEBUG
// alternatively: create your implementation of neo4j.Logger
config.Log = neo4j.ConsoleLogger(neo4j.DEBUG)
}
func release(closer io.Closer) {
err := closer.Close()
if err != nil { panic(err) }
}
Enabling logs - Driver before driver version < 4.3
package main
import (
"fmt"
"github.com/neo4j/neo4j-go-driver/v4/neo4j"
"io"
)
func main() {
creds := neo4j.BasicAuth("neo4j", "password", "")
driver, err := neo4j.NewDriver("neo4j://dbid1234.databases.neo4j.io:7687",
creds,
withConsoleLogger)
if err != nil { panic(err) }
defer release(driver)
session := driver.NewSession(neo4j.SessionConfig{})
defer release(session)
records, err := session.Run("RETURN 1", map[string]interface{}{})
if err != nil { panic(err) }
singleRecord, err := records.Single()
if err != nil { panic(err) }
result, _ := singleRecord.Get("1")
fmt.Printf("%v\n", result)
}
func withConsoleLogger(config *neo4j.Config) {
// one of: neo4j.ERROR, neo4j.WARNING, neo4j.INFO, neo4j.DEBUG
// alternatively: create your implementation of neo4j.Logger
config.Log = neo4j.ConsoleLogger(neo4j.DEBUG)
}
func release(closer io.Closer) {
err := closer.Close()
if err != nil { panic(err) }
}
Example traces collected:
2021-05-11 11:49:36.120 INFO [pool 1] Created
2021-05-11 11:49:36.120 INFO [driver 1] Created { target: localhost:7687 }
2021-05-11 11:49:36.120 DEBUG [session 2] Created
2021-05-11 11:49:36.120 DEBUG [pool 1] Trying to borrow connection from [localhost:7687]
2021-05-11 11:49:36.120 INFO [pool 1] Connecting to localhost:7687
2021-05-11 11:49:36.123 BOLT C: <MAGIC> 0X6060B017
2021-05-11 11:49:36.123 BOLT C: <HANDSHAKE> 0X00010304 0X00000104 0X00000004 0X00000003
2021-05-11 11:49:36.125 BOLT S: <HANDSHAKE> 0X00000104
2021-05-11 11:49:36.125 BOLT C: HELLO {"credentials":"<redacted>","principal":"neo4j","routing":null,"scheme":"basic","user_agent":"Go Driver/4.0"}
2021-05-11 11:49:36.129 BOLT S: SUCCESS {"server":"Neo4j/4.1.8","connection_id":"bolt-14","has_more":false}
2021-05-11 11:49:36.129 INFO [bolt4 bolt-14@localhost:7687] Connected
2021-05-11 11:49:36.129 BOLT [bolt-14@localhost:7687] C: RESET
2021-05-11 11:49:36.130 BOLT [bolt-14@localhost:7687] S: SUCCESS {"has_more":false}
2021-05-11 11:49:36.130 BOLT [bolt-14@localhost:7687] C: RUN "RETURN 1" {} {}
2021-05-11 11:49:36.130 BOLT [bolt-14@localhost:7687] C: PULL {"n":1000}
2021-05-11 11:49:36.135 BOLT [bolt-14@localhost:7687] S: SUCCESS {"fields":["1"],"t_first":"3","has_more":false}
2021-05-11 11:49:36.135 BOLT [bolt-14@localhost:7687] S: RECORD [1]
2021-05-11 11:49:36.135 BOLT [bolt-14@localhost:7687] S: SUCCESS {"bookmark":"FB:kcwQ3CuJEBZhSTyJ0wUTKR+KJgWQ","t_last":"1","has_more":false,"db":"neo4j"}
2021-05-11 11:49:36.135 DEBUG [pool 1] Returning connection to localhost:7687 {alive:true}
2021-05-11 11:49:36.135 DEBUG [session 2] Closed
2021-05-11 11:49:36.135 INFO [bolt4 bolt-14@localhost:7687] Close
2021-05-11 11:49:36.135 INFO [pool 1] Closed
2021-05-11 11:49:36.135 INFO [driver 1] Closed
Comments
0 comments
Please sign in to leave a comment.