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

@@ -13,11 +13,11 @@ import (
"sigs.k8s.io/yaml"
"github.com/zitadel/zitadel/internal/api/authz"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/query/projection"
"github.com/zitadel/zitadel/internal/telemetry/tracing"
)
type CustomTexts struct {
@@ -85,6 +85,9 @@ var (
)
func (q *Queries) CustomTextList(ctx context.Context, aggregateID, template, language string, withOwnerRemoved bool) (texts *CustomTexts, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
stmt, scan := prepareCustomTextsQuery()
eq := sq.Eq{
CustomTextColAggregateID.identifier(): aggregateID,
@@ -113,6 +116,9 @@ func (q *Queries) CustomTextList(ctx context.Context, aggregateID, template, lan
}
func (q *Queries) CustomTextListByTemplate(ctx context.Context, aggregateID, template string, withOwnerRemoved bool) (texts *CustomTexts, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
stmt, scan := prepareCustomTextsQuery()
eq := sq.Eq{
CustomTextColAggregateID.identifier(): aggregateID,
@@ -139,7 +145,10 @@ func (q *Queries) CustomTextListByTemplate(ctx context.Context, aggregateID, tem
return texts, err
}
func (q *Queries) GetDefaultLoginTexts(ctx context.Context, lang string) (*domain.CustomLoginText, error) {
func (q *Queries) GetDefaultLoginTexts(ctx context.Context, lang string) (_ *domain.CustomLoginText, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
contents, err := q.readLoginTranslationFile(ctx, lang)
if err != nil {
return nil, err
@@ -153,7 +162,10 @@ func (q *Queries) GetDefaultLoginTexts(ctx context.Context, lang string) (*domai
return loginText, nil
}
func (q *Queries) GetCustomLoginTexts(ctx context.Context, aggregateID, lang string) (*domain.CustomLoginText, error) {
func (q *Queries) GetCustomLoginTexts(ctx context.Context, aggregateID, lang string) (_ *domain.CustomLoginText, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
texts, err := q.CustomTextList(ctx, aggregateID, domain.LoginCustomText, lang, false)
if err != nil {
return nil, err
@@ -161,7 +173,10 @@ func (q *Queries) GetCustomLoginTexts(ctx context.Context, aggregateID, lang str
return CustomTextsToLoginDomain(authz.GetInstance(ctx).InstanceID(), aggregateID, lang, texts), err
}
func (q *Queries) IAMLoginTexts(ctx context.Context, lang string) (*domain.CustomLoginText, error) {
func (q *Queries) IAMLoginTexts(ctx context.Context, lang string) (_ *domain.CustomLoginText, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
contents, err := q.readLoginTranslationFile(ctx, lang)
if err != nil {
return nil, err