mirror of
https://github.com/SigNoz/signoz.git
synced 2026-02-26 10:22:35 +00:00
## 📄 Summary
- Instead of relying on JWT for session management, we are adding another token system: opaque. This gives the benefits of expiration and revocation.
- We are now ensuring that emails are regex checked throughout the backend.
- Support has been added for OIDC protocol
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package sqlstorehook
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SigNoz/signoz/pkg/factory"
|
|
"github.com/SigNoz/signoz/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)
|
|
}
|