MCPcopy Index your code
hub / github.com/coder/coder / rbacTraceAttributes

Function rbacTraceAttributes

coderd/rbac/authz.go:809–824  ·  view source on GitHub ↗

rbacTraceAttributes are the attributes that are added to all spans created by the rbac package. These attributes should help to debug slow spans.

(actor Subject, action policy.Action, objectType string, extra ...attribute.KeyValue)

Source from the content-addressed store, hash-verified

807// rbacTraceAttributes are the attributes that are added to all spans created by
808// the rbac package. These attributes should help to debug slow spans.
809func rbacTraceAttributes(actor Subject, action policy.Action, objectType string, extra ...attribute.KeyValue) trace.SpanStartOption {
810 uniqueRoleNames := actor.SafeRoleNames()
811 roleStrings := make([]string, 0, len(uniqueRoleNames))
812 for _, roleName := range uniqueRoleNames {
813 roleStrings = append(roleStrings, roleName.String())
814 }
815 return trace.WithAttributes(
816 append(extra,
817 attribute.StringSlice("subject_roles", roleStrings),
818 attribute.Int("num_subject_roles", len(actor.SafeRoleNames())),
819 attribute.Int("num_groups", len(actor.Groups)),
820 attribute.String("scope", actor.SafeScopeName()),
821 attribute.String("action", string(action)),
822 attribute.String("object_type", objectType),
823 )...)
824}
825
826type authRecorder struct {
827 authz Authorizer

Callers 3

FilterFunction · 0.85
AuthorizeMethod · 0.85
PrepareMethod · 0.85

Calls 4

SafeRoleNamesMethod · 0.80
IntMethod · 0.80
SafeScopeNameMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected