(request *FetchSpansRequest)
| 64 | } |
| 65 | |
| 66 | func (a *MetricsAggregate) extractConditions(request *FetchSpansRequest) { |
| 67 | // For metrics aggregators based on a span attribute we have to include it |
| 68 | includeAttribute := a.attr != (Attribute{}) && !request.HasAttribute(a.attr) |
| 69 | if includeAttribute { |
| 70 | request.SecondPassConditions = append(request.SecondPassConditions, Condition{ |
| 71 | Attribute: a.attr, |
| 72 | }) |
| 73 | } |
| 74 | |
| 75 | for _, b := range a.by { |
| 76 | // In the case of the AllConditions, it is enough to check that the |
| 77 | // attribute is present in any of the passes. |
| 78 | if request.AllConditions { |
| 79 | if !request.HasAttribute(b) { |
| 80 | request.SecondPassConditions = append(request.SecondPassConditions, Condition{ |
| 81 | Attribute: b, |
| 82 | }) |
| 83 | } |
| 84 | } else { |
| 85 | // In the case of AllConditions set to false, as is the case with a |
| 86 | // structural query, we need to ensure that the `by` attribute is present |
| 87 | // in the second pass conditions as well, so that we load the column and |
| 88 | // can return the appropriate values. |
| 89 | if !request.SecondPassHasAttribute(b) { |
| 90 | request.SecondPassConditions = append(request.SecondPassConditions, Condition{ |
| 91 | Attribute: b, |
| 92 | }) |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | func (a *MetricsAggregate) init(q *tempopb.QueryRangeRequest, mode AggregateMode) { |
| 99 | // Raw mode: |
nothing calls this directly
no test coverage detected