modulepackage
0.0.5
Repository: https://github.com/raito-io/neo4j-tracing.git
Documentation: pkg.go.dev
# README
RAITO - Neo4J Tracing
Introduction
neo4jtracing
is a go library that enables otel distribute tracing for neo4j driver v5.
Getting Started
Add this library as a dependency via go get github.com/raito-io/neo4j-tracing
Enable tracing
Tracing can be enabled by using the neo4j_tracing.Neo4jTracer
object.
The Neo4jTracer
a factory that creates neo4j.DriverWithContext
objects that are wrapped so distributed tracing can be applied.
Start using tracing is very easy. A regular neo4j driver will be created as follows:
package main
import (
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
)
func main() {
dbUri := "neo4j://localhost" // scheme://host(:port) (default port is 7687)
driver, err := neo4j.NewDriverWithContext(dbUri, neo4j.BasicAuth("neo4j", "letmein!", ""))
if err != nil {
panic(err)
}
// Do something useful
}
To enable tracing you need to create your driver by using the Neo4jTracer
object.
package main
import (
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
neo4j_tracing "github.com/raito-io/neo4j-tracing"
)
func main() {
driverFactory := neo4j_tracing.NewNeo4jTracer()
dbUri := "neo4j://localhost" // scheme://host(:port) (default port is 7687)
driver, err := driverFactory.NewDriverWithContext(dbUri, neo4j.BasicAuth("neo4j", "letmein!", ""))
if err != nil {
panic(err)
}
// Do something useful
}
Options
The following options could be used to customize the tracing behavior:
WithTracerProvider(provider)
: Specifies a custom tracer provider. By default, the global OpenTelemetry tracer provider is used.
Those options are passed as argument to the neo4j_tracing.NewNeo4jTracer()
function.
# Functions
NewExplicitTransactionTracer returns a new ExplicitTransactionTracer that wraps a neo4j.ExplicitTransaction with correct tracing details.
NewManagedTransactionTracer returns a new ManagedTransactionTracer that wraps a neo4j.ManagedTransaction with correct tracing details.
NewNeo4jTracer creates an object that will wrap neo4j drivers with a tracing object.
No description provided by the author
WithTracerProvider specifies a tracer provider to use for creating a tracer.
# Structs
BookmarkManagerTracer wraps a neo4j.BookmarkManager object so the calls can be traced with open telemetry distributed tracing.
No description provided by the author
ExplicitTransactionTracer wraps a neo4j.ExplicitTransaction object so the calls can be traced with open telemetry distributed tracing.
ManagedTransactionTracer wraps a neo4j.ManagedTransaction object so the calls can be traced with open telemetry distributed tracing.
Neo4jTracer wraps a neo4j.Tracer object so the calls can be traced with open telemetry distributed tracing.
No description provided by the author
SessionWithContextTracer wraps a neo4j.SessionWithContext object so the calls can be traced with open telemetry distributed tracing.
# Interfaces
No description provided by the author