(a traceql.Attribute)
| 126 | } |
| 127 | |
| 128 | func (s *span) AttributeFor(a traceql.Attribute) (traceql.Static, bool) { |
| 129 | find := func(a traceql.Attribute, attrs []attrVal) *traceql.Static { |
| 130 | if len(attrs) == 1 { |
| 131 | if attrs[0].a == a { |
| 132 | return &attrs[0].s |
| 133 | } |
| 134 | return nil |
| 135 | } |
| 136 | if len(attrs) == 2 { |
| 137 | if attrs[0].a == a { |
| 138 | return &attrs[0].s |
| 139 | } |
| 140 | if attrs[1].a == a { |
| 141 | return &attrs[1].s |
| 142 | } |
| 143 | return nil |
| 144 | } |
| 145 | |
| 146 | for i := range attrs { |
| 147 | if attrs[i].a == a { |
| 148 | return &attrs[i].s |
| 149 | } |
| 150 | } |
| 151 | return nil |
| 152 | } |
| 153 | findName := func(s string, attrs []attrVal) *traceql.Static { |
| 154 | if len(attrs) == 1 { |
| 155 | if attrs[0].a.Name == s { |
| 156 | return &attrs[0].s |
| 157 | } |
| 158 | return nil |
| 159 | } |
| 160 | if len(attrs) == 2 { |
| 161 | if attrs[0].a.Name == s { |
| 162 | return &attrs[0].s |
| 163 | } |
| 164 | if attrs[1].a.Name == s { |
| 165 | return &attrs[1].s |
| 166 | } |
| 167 | return nil |
| 168 | } |
| 169 | |
| 170 | for i := range attrs { |
| 171 | if attrs[i].a.Name == s { |
| 172 | return &attrs[i].s |
| 173 | } |
| 174 | } |
| 175 | return nil |
| 176 | } |
| 177 | |
| 178 | switch a.Scope { |
| 179 | case traceql.AttributeScopeResource: |
| 180 | if len(s.resourceAttrs) > 0 { |
| 181 | if attr := find(a, s.resourceAttrs); attr != nil { |
| 182 | return *attr, true |
| 183 | } |
| 184 | } |
| 185 | return traceql.StaticNil, false |
nothing calls this directly
no test coverage detected