mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-13 07:27:43 +00:00
9341e08123
* tracing * instrument redis * add instrumentation around queue acks * adjust backoff schedules for reddit * set proper http client on reddit * populate account last message ID on upsert * pass last message id on upsert * schedule accounts in a predictable order
22 lines
628 B
Go
22 lines
628 B
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgconn"
|
|
"github.com/jackc/pgx/v4"
|
|
"go.opentelemetry.io/otel/attribute"
|
|
"go.opentelemetry.io/otel/trace"
|
|
)
|
|
|
|
type Connection interface {
|
|
Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
|
|
Query(context.Context, string, ...interface{}) (pgx.Rows, error)
|
|
QueryRow(context.Context, string, ...interface{}) pgx.Row
|
|
}
|
|
|
|
func spanWithQuery(ctx context.Context, tracer trace.Tracer, query string) (context.Context, trace.Span) {
|
|
ctx, span := tracer.Start(ctx, "db:query")
|
|
span.SetAttributes(attribute.String("db.query", query))
|
|
return ctx, span
|
|
}
|