MCPcopy Index your code
hub / github.com/exaring/otelpgx

github.com/exaring/otelpgx @v05.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release v05.5 ↗ · + Follow
31 symbols 73 edges 3 files 23 documented · 74% 6 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Go Reference

otelpgx

Provides OpenTelemetry instrumentation for the jackc/pgx library.

Requirements

  • go 1.18 (or higher)
  • pgx v5 (or higher)

Usage

Install the library:

go get github.com/exaring/otelpgx

Create the tracer as part of your connection:

cfg, err := pgxpool.ParseConfig(connString)
if err != nil {
    return nil, fmt.Errorf("create connection pool: %w", err)
}

cfg.ConnConfig.Tracer = otelpgx.NewTracer()

conn, err := pgxpool.NewWithConfig(ctx, cfg)
if err != nil {
    return nil, fmt.Errorf("connect to database: %w", err)
}

See options.go for the full list of options.

Extension points exported contracts — how you extend this code

Option (Interface)
Option specifies instrumentation configuration options.
options.go
SpanNameFunc (FuncType)
SpanNameFunc is a function that can be used to generate a span name for a SQL. The function will be called with the SQL
options.go

Core symbols most depended-on inside this repo

NewTracer
called by 11
tracer.go
recordError
called by 6
tracer.go
connectionAttributesFromConfig
called by 6
tracer.go
WithSpanNameFunc
called by 6
options.go
sqlOperationName
called by 4
tracer.go
makeParamsAttribute
called by 2
tracer.go
findOwnImportedVersion
called by 1
tracer.go
apply
called by 1
options.go

Shape

Method 14
Function 12
FuncType 2
Struct 2
Interface 1

Languages

Go100%

Modules by API surface

tracer.go19 symbols
options.go11 symbols
tracer_test.go1 symbols

For agents

$ claude mcp add otelpgx \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact