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

@@ -11,6 +11,7 @@ import (
"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 (
@@ -65,7 +66,10 @@ type Flow struct {
TriggerActions map[domain.TriggerType][]*Action
}
func (q *Queries) GetFlow(ctx context.Context, flowType domain.FlowType, orgID string, withOwnerRemoved bool) (*Flow, error) {
func (q *Queries) GetFlow(ctx context.Context, flowType domain.FlowType, orgID string, withOwnerRemoved bool) (_ *Flow, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
query, scan := prepareFlowQuery(flowType)
eq := sq.Eq{
FlowsTriggersColumnFlowType.identifier(): flowType,
@@ -87,7 +91,10 @@ func (q *Queries) GetFlow(ctx context.Context, flowType domain.FlowType, orgID s
return scan(rows)
}
func (q *Queries) GetActiveActionsByFlowAndTriggerType(ctx context.Context, flowType domain.FlowType, triggerType domain.TriggerType, orgID string, withOwnerRemoved bool) ([]*Action, error) {
func (q *Queries) GetActiveActionsByFlowAndTriggerType(ctx context.Context, flowType domain.FlowType, triggerType domain.TriggerType, orgID string, withOwnerRemoved bool) (_ []*Action, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
stmt, scan := prepareTriggerActionsQuery()
eq := sq.Eq{
FlowsTriggersColumnFlowType.identifier(): flowType,
@@ -111,7 +118,10 @@ func (q *Queries) GetActiveActionsByFlowAndTriggerType(ctx context.Context, flow
return scan(rows)
}
func (q *Queries) GetFlowTypesOfActionID(ctx context.Context, actionID string, withOwnerRemoved bool) ([]domain.FlowType, error) {
func (q *Queries) GetFlowTypesOfActionID(ctx context.Context, actionID string, withOwnerRemoved bool) (_ []domain.FlowType, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
stmt, scan := prepareFlowTypesQuery()
eq := sq.Eq{
FlowsTriggersColumnActionID.identifier(): actionID,