mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:27:42 +00:00
fix(query): add tracing for each method (#4777)
* fix(query): add tracing for each method
This commit is contained in:
@@ -10,10 +10,10 @@ import (
|
||||
|
||||
"github.com/zitadel/zitadel/internal/api/authz"
|
||||
"github.com/zitadel/zitadel/internal/database"
|
||||
"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"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -110,7 +110,10 @@ type ProjectGrantSearchQueries struct {
|
||||
Queries []SearchQuery
|
||||
}
|
||||
|
||||
func (q *Queries) ProjectGrantByID(ctx context.Context, shouldTriggerBulk bool, id string, withOwnerRemoved bool) (*ProjectGrant, error) {
|
||||
func (q *Queries) ProjectGrantByID(ctx context.Context, shouldTriggerBulk bool, id string, withOwnerRemoved bool) (_ *ProjectGrant, err error) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
if shouldTriggerBulk {
|
||||
projection.ProjectGrantProjection.Trigger(ctx)
|
||||
}
|
||||
@@ -133,7 +136,10 @@ func (q *Queries) ProjectGrantByID(ctx context.Context, shouldTriggerBulk bool,
|
||||
return scan(row)
|
||||
}
|
||||
|
||||
func (q *Queries) ProjectGrantByIDAndGrantedOrg(ctx context.Context, id, grantedOrg string, withOwnerRemoved bool) (*ProjectGrant, error) {
|
||||
func (q *Queries) ProjectGrantByIDAndGrantedOrg(ctx context.Context, id, grantedOrg string, withOwnerRemoved bool) (_ *ProjectGrant, err error) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
stmt, scan := prepareProjectGrantQuery()
|
||||
eq := sq.Eq{
|
||||
ProjectGrantColumnGrantID.identifier(): id,
|
||||
@@ -154,6 +160,9 @@ func (q *Queries) ProjectGrantByIDAndGrantedOrg(ctx context.Context, id, granted
|
||||
}
|
||||
|
||||
func (q *Queries) SearchProjectGrants(ctx context.Context, queries *ProjectGrantSearchQueries, withOwnerRemoved bool) (projects *ProjectGrants, err error) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
query, scan := prepareProjectGrantsQuery()
|
||||
eq := sq.Eq{
|
||||
ProjectGrantColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||
@@ -180,6 +189,9 @@ func (q *Queries) SearchProjectGrants(ctx context.Context, queries *ProjectGrant
|
||||
}
|
||||
|
||||
func (q *Queries) SearchProjectGrantsByProjectIDAndRoleKey(ctx context.Context, projectID, roleKey string, withOwnerRemoved bool) (projects *ProjectGrants, err error) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
searchQuery := &ProjectGrantSearchQueries{
|
||||
SearchRequest: SearchRequest{},
|
||||
Queries: make([]SearchQuery, 2),
|
||||
|
Reference in New Issue
Block a user