Files
zeekay b36a8788a5 feat: rebrand SigNoz → Hanzo O11y
Full rebrand of the SigNoz observability platform:
- Go module: github.com/SigNoz/signoz → github.com/hanzoai/o11y
- Frontend: @signozhq/* → @hanzo/o11y-*, posthog-js → @hanzo/insights
- Docker: signoz/* → ghcr.io/hanzoai/o11y*
- ClickHouse → Hanzo Datastore (hanzoai/datastore)
- Env vars: SIGNOZ_* → HANZO_*
- DB tables: signoz_* → o11y_*
- All branding, URLs, docs updated
- 2172 files changed
2026-03-12 02:10:29 -07:00

41 lines
1.2 KiB
Go

package sqlstorehook
import (
"context"
"github.com/hanzoai/o11y/pkg/factory"
"github.com/hanzoai/o11y/pkg/sqlstore"
"github.com/uptrace/bun"
"github.com/uptrace/bun/extra/bunotel"
)
type instrumentation struct {
bunOtel *bunotel.QueryHook
}
func NewInstrumentationFactory() factory.ProviderFactory[sqlstore.SQLStoreHook, sqlstore.Config] {
return factory.NewProviderFactory(factory.MustNewName("instrumentation"), NewInstrumentation)
}
func NewInstrumentation(ctx context.Context, providerSettings factory.ProviderSettings, config sqlstore.Config) (sqlstore.SQLStoreHook, error) {
return &instrumentation{
bunOtel: bunotel.NewQueryHook(
bunotel.WithFormattedQueries(true),
bunotel.WithTracerProvider(providerSettings.TracerProvider),
bunotel.WithMeterProvider(providerSettings.MeterProvider),
),
}, nil
}
func (hook *instrumentation) Init(db *bun.DB) {
hook.bunOtel.Init(db)
}
func (hook *instrumentation) BeforeQuery(ctx context.Context, event *bun.QueryEvent) context.Context {
return hook.bunOtel.BeforeQuery(ctx, event)
}
func (hook *instrumentation) AfterQuery(ctx context.Context, event *bun.QueryEvent) {
hook.bunOtel.AfterQuery(ctx, event)
}