OLD | NEW |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """URL endpoint for adding new histograms to the dashboard.""" | 5 """URL endpoint for adding new histograms to the dashboard.""" |
6 | 6 |
7 import json | 7 import json |
8 import sys | 8 import sys |
9 | 9 |
10 from google.appengine.api import taskqueue | 10 from google.appengine.api import taskqueue |
11 from google.appengine.ext import ndb | 11 from google.appengine.ext import ndb |
12 | 12 |
13 from dashboard import add_point_queue | 13 from dashboard import add_point_queue |
14 from dashboard.api import api_request_handler | 14 from dashboard.api import api_request_handler |
15 from dashboard.common import datastore_hooks | 15 from dashboard.common import datastore_hooks |
16 from dashboard.common import stored_object | 16 from dashboard.common import stored_object |
17 from dashboard.models import histogram | 17 from dashboard.models import histogram |
18 from tracing.value import histogram as histogram_module | 18 from tracing.value import histogram as histogram_module |
19 from tracing.value import histogram_set | 19 from tracing.value import histogram_set |
20 from tracing.value.diagnostics import diagnostic | 20 from tracing.value.diagnostics import diagnostic |
21 from tracing.value.diagnostics import reserved_infos | 21 from tracing.value.diagnostics import reserved_infos |
22 | 22 |
23 | 23 # TODO(#3718): Use names along with types to create sparse diagnostics, add here |
| 24 # owners and bug components as sparse level diagnostics |
24 SUITE_LEVEL_SPARSE_DIAGNOSTIC_TYPES = set( | 25 SUITE_LEVEL_SPARSE_DIAGNOSTIC_TYPES = set( |
25 [histogram_module.BuildbotInfo, histogram_module.DeviceInfo, | 26 [histogram_module.BuildbotInfo, histogram_module.DeviceInfo]) |
26 histogram_module.Ownership]) | |
27 HISTOGRAM_LEVEL_SPARSE_DIAGNOSTIC_TYPES = set( | 27 HISTOGRAM_LEVEL_SPARSE_DIAGNOSTIC_TYPES = set( |
28 [histogram_module.TelemetryInfo]) | 28 [histogram_module.TelemetryInfo]) |
29 SPARSE_DIAGNOSTIC_TYPES = SUITE_LEVEL_SPARSE_DIAGNOSTIC_TYPES.union( | 29 SPARSE_DIAGNOSTIC_TYPES = SUITE_LEVEL_SPARSE_DIAGNOSTIC_TYPES.union( |
30 HISTOGRAM_LEVEL_SPARSE_DIAGNOSTIC_TYPES) | 30 HISTOGRAM_LEVEL_SPARSE_DIAGNOSTIC_TYPES) |
31 | 31 |
32 | 32 |
33 TASK_QUEUE_NAME = 'histograms-queue' | 33 TASK_QUEUE_NAME = 'histograms-queue' |
34 | 34 |
35 | 35 |
36 def _CheckRequest(condition, msg): | 36 def _CheckRequest(condition, msg): |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return revision_info.chromium_commit_position[0] | 220 return revision_info.chromium_commit_position[0] |
221 | 221 |
222 | 222 |
223 def InlineDenseSharedDiagnostics(histograms): | 223 def InlineDenseSharedDiagnostics(histograms): |
224 # TODO(eakuefner): Delete inlined diagnostics from the set | 224 # TODO(eakuefner): Delete inlined diagnostics from the set |
225 for hist in histograms: | 225 for hist in histograms: |
226 diagnostics = hist.diagnostics | 226 diagnostics = hist.diagnostics |
227 for diag in diagnostics.itervalues(): | 227 for diag in diagnostics.itervalues(): |
228 if type(diag) not in SPARSE_DIAGNOSTIC_TYPES: | 228 if type(diag) not in SPARSE_DIAGNOSTIC_TYPES: |
229 diag.Inline() | 229 diag.Inline() |
OLD | NEW |