Home | History | Annotate | Download | only in api
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 [
      6   {
      7     "namespace": "metricsPrivate",
      8     "description": "none",
      9     "types": [
     10       {
     11         "id": "MetricType",
     12         "type":  "object",
     13         "description": "Describes the type of metric that is to be collected.",
     14         "properties": {
     15           "metricName": {"type": "string", "description": "A unique name within the extension for the metric."},
     16           "type": {
     17             "type": "string",
     18             "enum": ["histogram-log", "histogram-linear"],
     19             "description": "The type of metric, such as 'histogram-log' or 'histogram-linear'."
     20           },
     21           "min": {"type": "integer", "description": "The minimum sample value to be recoded.  Must be greater than zero."},
     22           "max": {"type": "integer", "description": "The maximum sample value to be recoded."},
     23           "buckets": {"type": "integer", "description": "The number of buckets to use when separating the recorded values."}
     24         }
     25       }
     26     ],
     27     "functions": [
     28       {
     29         "name": "getIsCrashReportingEnabled",
     30         "description": "Returns true if the user opted in to sending crash reports.",
     31         "type": "function",
     32         "parameters": [
     33           {
     34             "name": "callback",
     35             "type": "function",
     36             "optional": false,
     37             "parameters": [
     38               { "name": "is_enabled", "type": "boolean" }
     39             ]
     40           }
     41         ]
     42       },
     43       {
     44         "name": "getFieldTrial",
     45         "description": "Returns the group name chosen for the named trial, or the empty string if the trial does not exist or is not enabled.",
     46         "type": "function",
     47         "parameters": [
     48           {"name": "name", "type": "string"},
     49           {
     50             "name": "callback",
     51             "type": "function",
     52             "optional": false,
     53             "parameters": [
     54               { "name": "group", "type": "string" }
     55             ]
     56           }
     57         ]
     58       },
     59       {
     60         "name": "getVariationParams",
     61         "description": "Returns variation parameters for the named trial if available, or undefined otherwise.",
     62         "type": "function",
     63         "parameters": [
     64           {"name": "name", "type": "string"},
     65           {
     66             "name": "callback",
     67             "type": "function",
     68             "optional": false,
     69             "parameters": [
     70               {
     71                 "name": "params",
     72                 "optional": true,
     73                 "type": "object",
     74                 "additionalProperties": { "type": "string" }
     75               }
     76             ]
     77           }
     78         ]
     79       },
     80       {
     81         "name": "recordUserAction",
     82         "type": "function",
     83         "description": "Records an action performed by the user.",
     84         "parameters": [
     85           {"name": "name", "type": "string"}
     86         ]
     87       },
     88       {
     89         "name": "recordPercentage",
     90         "type": "function",
     91         "description": "Records a percentage value from 1 to 100.",
     92         "parameters": [
     93           {"name": "metricName", "type": "string"},
     94           {"name": "value", "type": "integer"}
     95         ]
     96       },
     97       {
     98         "name": "recordCount",
     99         "type": "function",
    100         "description": "Records a value than can range from 1 to 1,000,000.",
    101         "parameters": [
    102           {"name": "metricName", "type": "string"},
    103           {"name": "value", "type": "integer"}
    104         ]
    105       },
    106       {
    107         "name": "recordSmallCount",
    108         "type": "function",
    109         "description": "Records a value than can range from 1 to 100.",
    110         "parameters": [
    111           {"name": "metricName", "type": "string"},
    112           {"name": "value", "type": "integer"}
    113         ]
    114       },
    115       {
    116         "name": "recordMediumCount",
    117         "type": "function",
    118         "description": "Records a value than can range from 1 to 10,000.",
    119         "parameters": [
    120           {"name": "metricName", "type": "string"},
    121           {"name": "value", "type": "integer"}
    122         ]
    123       },
    124       {
    125         "name": "recordTime",
    126         "type": "function",
    127         "description": "Records an elapsed time of no more than 10 seconds.  The sample value is specified in milliseconds.",
    128         "parameters": [
    129           {"name": "metricName", "type": "string"},
    130           {"name": "value", "type": "integer"}
    131         ]
    132       },
    133       {
    134         "name": "recordMediumTime",
    135         "type": "function",
    136         "description": "Records an elapsed time of no more than 3 minutes.  The sample value is specified in milliseconds.",
    137         "parameters": [
    138           {"name": "metricName", "type": "string"},
    139           {"name": "value", "type": "integer"}
    140         ]
    141       },
    142       {
    143         "name": "recordLongTime",
    144         "type": "function",
    145         "description": "Records an elapsed time of no more than 1 hour.  The sample value is specified in milliseconds.",
    146         "parameters": [
    147           {"name": "metricName", "type": "string"},
    148           {"name": "value", "type": "integer"}
    149         ]
    150       },
    151       {
    152         "name": "recordSparseValue",
    153         "type": "function",
    154         "description": "Increments the count associated with |value| in the sparse histogram defined by the |metricName|.",
    155         "parameters": [
    156           {"name": "metricName", "type": "string"},
    157           {"name": "value", "type": "integer"}
    158         ]
    159       },
    160       {
    161         "name": "recordValue",
    162         "type": "function",
    163         "description": "Adds a value to the given metric.",
    164         "parameters": [
    165           {"name": "metric", "$ref": "MetricType"},
    166           {"name": "value", "type": "integer"}
    167         ]
    168       }
    169     ],
    170     "events": []
    171   }
    172 ]
    173