fix(query): add tracing for each method (#4777)

* fix(query): add tracing for each method
This commit is contained in:
Silvan
2022-12-01 09:18:53 +01:00
committed by GitHub
parent 069b3570f5
commit 28760ab4b3
47 changed files with 519 additions and 138 deletions

View File

@@ -9,12 +9,11 @@ import (
sq "github.com/Masterminds/squirrel"
"github.com/zitadel/zitadel/internal/api/authz"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/crypto"
"github.com/zitadel/zitadel/internal/query/projection"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/query/projection"
"github.com/zitadel/zitadel/internal/telemetry/tracing"
)
var (
@@ -134,7 +133,10 @@ func (q *Queries) InitHashGenerator(ctx context.Context, generatorType domain.Se
return crypto.NewHashGenerator(cryptoConfig, algorithm), nil
}
func (q *Queries) SecretGeneratorByType(ctx context.Context, generatorType domain.SecretGeneratorType) (*SecretGenerator, error) {
func (q *Queries) SecretGeneratorByType(ctx context.Context, generatorType domain.SecretGeneratorType) (_ *SecretGenerator, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
stmt, scan := prepareSecretGeneratorQuery()
query, args, err := stmt.Where(sq.Eq{
SecretGeneratorColumnGeneratorType.identifier(): generatorType,
@@ -149,6 +151,9 @@ func (q *Queries) SecretGeneratorByType(ctx context.Context, generatorType domai
}
func (q *Queries) SearchSecretGenerators(ctx context.Context, queries *SecretGeneratorSearchQueries) (secretGenerators *SecretGenerators, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
query, scan := prepareSecretGeneratorsQuery()
stmt, args, err := queries.toQuery(query).
Where(sq.Eq{