mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-23 09:46:14 -06:00
[chore]: Bump github.com/uptrace/bun/extra/bunotel from 1.2.9 to 1.2.10
Bumps [github.com/uptrace/bun/extra/bunotel](https://github.com/uptrace/bun) from 1.2.9 to 1.2.10. - [Release notes](https://github.com/uptrace/bun/releases) - [Changelog](https://github.com/uptrace/bun/blob/master/CHANGELOG.md) - [Commits](https://github.com/uptrace/bun/compare/v1.2.9...v1.2.10) --- updated-dependencies: - dependency-name: github.com/uptrace/bun/extra/bunotel dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
parent
8488ac9286
commit
78e03263ea
31 changed files with 417 additions and 204 deletions
9
vendor/github.com/uptrace/bun/extra/bunotel/option.go
generated
vendored
9
vendor/github.com/uptrace/bun/extra/bunotel/option.go
generated
vendored
|
|
@ -1,6 +1,7 @@
|
|||
package bunotel
|
||||
|
||||
import (
|
||||
"github.com/uptrace/bun"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
||||
|
|
@ -33,6 +34,14 @@ func WithFormattedQueries(format bool) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// WithSpanNameFormatter takes a function that determines the span name
|
||||
// for a given query event.
|
||||
func WithSpanNameFormatter(f func(*bun.QueryEvent) string) Option {
|
||||
return func(h *QueryHook) {
|
||||
h.spanNameFormatter = f
|
||||
}
|
||||
}
|
||||
|
||||
// WithTracerProvider returns an Option to use the TracerProvider when
|
||||
// creating a Tracer.
|
||||
func WithTracerProvider(tp trace.TracerProvider) Option {
|
||||
|
|
|
|||
22
vendor/github.com/uptrace/bun/extra/bunotel/otel.go
generated
vendored
22
vendor/github.com/uptrace/bun/extra/bunotel/otel.go
generated
vendored
|
|
@ -22,11 +22,12 @@ import (
|
|||
)
|
||||
|
||||
type QueryHook struct {
|
||||
attrs []attribute.KeyValue
|
||||
formatQueries bool
|
||||
tracer trace.Tracer
|
||||
meter metric.Meter
|
||||
queryHistogram metric.Int64Histogram
|
||||
attrs []attribute.KeyValue
|
||||
formatQueries bool
|
||||
tracer trace.Tracer
|
||||
meter metric.Meter
|
||||
queryHistogram metric.Int64Histogram
|
||||
spanNameFormatter func(*bun.QueryEvent) string
|
||||
}
|
||||
|
||||
var _ bun.QueryHook = (*QueryHook)(nil)
|
||||
|
|
@ -86,7 +87,11 @@ func (h *QueryHook) AfterQuery(ctx context.Context, event *bun.QueryEvent) {
|
|||
return
|
||||
}
|
||||
|
||||
span.SetName(operation)
|
||||
name := operation
|
||||
if h.spanNameFormatter != nil {
|
||||
name = h.spanNameFormatter(event)
|
||||
}
|
||||
span.SetName(name)
|
||||
defer span.End()
|
||||
|
||||
query := h.eventQuery(event)
|
||||
|
|
@ -106,9 +111,8 @@ func (h *QueryHook) AfterQuery(ctx context.Context, event *bun.QueryEvent) {
|
|||
attrs = append(attrs, sys)
|
||||
}
|
||||
if event.Result != nil {
|
||||
if n, _ := event.Result.RowsAffected(); n > 0 {
|
||||
attrs = append(attrs, attribute.Int64("db.rows_affected", n))
|
||||
}
|
||||
rows, _ := event.Result.RowsAffected()
|
||||
attrs = append(attrs, attribute.Int64("db.rows_affected", rows))
|
||||
}
|
||||
|
||||
switch event.Err {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue