|
19 | 19 |
|
20 | 20 | from api.models import Provider
|
21 | 21 | from api.report.provider_map import ProviderMap
|
| 22 | +from masu.processor import is_feature_cost_3083_all_labels_enabled |
22 | 23 | from providers.provider_access import ProviderAccessor
|
23 | 24 | from reporting.models import OCPUsageLineItemDailySummary
|
24 | 25 | from reporting.provider.ocp.models import OCPCostSummaryByNodeP
|
|
34 | 35 | class OCPProviderMap(ProviderMap):
|
35 | 36 | """OCP Provider Map."""
|
36 | 37 |
|
| 38 | + @cached_property |
| 39 | + def check_unleash_for_tag_column_cost_3038(self): |
| 40 | + if is_feature_cost_3083_all_labels_enabled(self._schema_name): |
| 41 | + return "all_labels" |
| 42 | + return "pod_labels" |
| 43 | + |
37 | 44 | def __cost_model_cost(self, cost_model_rate_type=None):
|
38 | 45 | """Return ORM term for cost model cost"""
|
39 | 46 | if cost_model_rate_type:
|
@@ -165,7 +172,7 @@ def __init__(self, provider, report_type, schema_name):
|
165 | 172 | "tag_column": "pod_labels", # default for if a report type does not have a tag_column
|
166 | 173 | "report_type": {
|
167 | 174 | "costs": {
|
168 |
| - "tag_column": "all_labels", |
| 175 | + "tag_column": self.check_unleash_for_tag_column_cost_3038, |
169 | 176 | "tables": {"query": OCPUsageLineItemDailySummary},
|
170 | 177 | "aggregates": {
|
171 | 178 | "sup_raw": Sum(Value(0, output_field=DecimalField())),
|
@@ -215,7 +222,7 @@ def __init__(self, provider, report_type, schema_name):
|
215 | 222 | "sum_columns": ["cost_total", "infra_total", "sup_total"],
|
216 | 223 | },
|
217 | 224 | "costs_by_project": {
|
218 |
| - "tag_column": "all_labels", |
| 225 | + "tag_column": self.check_unleash_for_tag_column_cost_3038, |
219 | 226 | "tables": {"query": OCPUsageLineItemDailySummary},
|
220 | 227 | "aggregates": {
|
221 | 228 | "sup_raw": Sum(Value(0, output_field=DecimalField())),
|
|
0 commit comments