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)
| 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. |
| 809 | func 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 | |
| 826 | type authRecorder struct { |
| 827 | authz Authorizer |
no test coverage detected