• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2020 The Android Open Source Project
3--
4-- Licensed under the Apache License, Version 2.0 (the 'License');
5-- you may not use this file except in compliance with the License.
6-- You may obtain a copy of the License at
7--
8--     https://www.apache.org/licenses/LICENSE-2.0
9--
10-- Unless required by applicable law or agreed to in writing, software
11-- distributed under the License is distributed on an 'AS IS' BASIS,
12-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-- See the License for the specific language governing permissions and
14-- limitations under the License.
15--
16
17-- Creates a view containing name-value pairs extracted from
18-- chrome_event.metadata. Some names can have multiple values:
19-- e.g. trace-category
20DROP VIEW IF EXISTS chrome_event_metadata;
21CREATE VIEW chrome_event_metadata AS
22WITH metadata (arg_set_id) AS (
23  SELECT arg_set_id
24  FROM raw
25  WHERE name = "chrome_event.metadata"
26)
27-- TODO(b/173201788): Once this is fixed, extract all the fields.
28SELECT 'os-name' AS name,
29  EXTRACT_ARG(metadata.arg_set_id, 'os-name') AS value
30FROM metadata
31UNION
32SELECT "trace-category" AS name,
33  value AS category
34FROM metadata, json_each(
35    json_extract(
36      EXTRACT_ARG(metadata.arg_set_id, "trace-config"),
37      '$.included_categories'
38    )
39  );
40