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                 "type": "object",
     73                 "additionalProperties": { "type": "string" }
     74               }
     75             ]
     76           }
     77         ]
     78       },
     79       {
     80         "name": "recordUserAction",
     81         "type": "function",
     82         "description": "Records an action performed by the user.",
     83         "parameters": [
     84           {"name": "name", "type": "string"}
     85         ]
     86       },
     87       {
     88         "name": "recordPercentage",
     89         "type": "function",
     90         "description": "Records a percentage value from 1 to 100.",
     91         "parameters": [
     92           {"name": "metricName", "type": "string"},
     93           {"name": "value", "type": "integer"}
     94         ]
     95       },
     96       {
     97         "name": "recordCount",
     98         "type": "function",
     99         "description": "Records a value than can range from 1 to 1,000,000.",
    100         "parameters": [
    101           {"name": "metricName", "type": "string"},
    102           {"name": "value", "type": "integer"}
    103         ]
    104       },
    105       {
    106         "name": "recordSmallCount",
    107         "type": "function",
    108         "description": "Records a value than can range from 1 to 100.",
    109         "parameters": [
    110           {"name": "metricName", "type": "string"},
    111           {"name": "value", "type": "integer"}
    112         ]
    113       },
    114       {
    115         "name": "recordMediumCount",
    116         "type": "function",
    117         "description": "Records a value than can range from 1 to 10,000.",
    118         "parameters": [
    119           {"name": "metricName", "type": "string"},
    120           {"name": "value", "type": "integer"}
    121         ]
    122       },
    123       {
    124         "name": "recordTime",
    125         "type": "function",
    126         "description": "Records an elapsed time of no more than 10 seconds.  The sample value is specified in milliseconds.",
    127         "parameters": [
    128           {"name": "metricName", "type": "string"},
    129           {"name": "value", "type": "integer"}
    130         ]
    131       },
    132       {
    133         "name": "recordMediumTime",
    134         "type": "function",
    135         "description": "Records an elapsed time of no more than 3 minutes.  The sample value is specified in milliseconds.",
    136         "parameters": [
    137           {"name": "metricName", "type": "string"},
    138           {"name": "value", "type": "integer"}
    139         ]
    140       },
    141       {
    142         "name": "recordLongTime",
    143         "type": "function",
    144         "description": "Records an elapsed time of no more than 1 hour.  The sample value is specified in milliseconds.",
    145         "parameters": [
    146           {"name": "metricName", "type": "string"},
    147           {"name": "value", "type": "integer"}
    148         ]
    149       },
    150       {
    151         "name": "recordValue",
    152         "type": "function",
    153         "description": "Adds a value to the given metric.",
    154         "parameters": [
    155           {"name": "metric", "$ref": "MetricType"},
    156           {"name": "value", "type": "integer"}
    157         ]
    158       }
    159     ],
    160     "events": []
    161   }
    162 ]
    163