...

Source file src/go.opencensus.io/stats/doc.go

Documentation: go.opencensus.io/stats

     1  // Copyright 2017, OpenCensus Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  //
    15  
    16  /*
    17  Package stats contains support for OpenCensus stats recording.
    18  
    19  OpenCensus allows users to create typed measures, record measurements,
    20  aggregate the collected data, and export the aggregated data.
    21  
    22  # Measures
    23  
    24  A measure represents a type of data point to be tracked and recorded.
    25  For example, latency, request Mb/s, and response Mb/s are measures
    26  to collect from a server.
    27  
    28  Measure constructors such as Int64 and Float64 automatically
    29  register the measure by the given name. Each registered measure needs
    30  to be unique by name. Measures also have a description and a unit.
    31  
    32  Libraries can define and export measures. Application authors can then
    33  create views and collect and break down measures by the tags they are
    34  interested in.
    35  
    36  # Recording measurements
    37  
    38  Measurement is a data point to be collected for a measure. For example,
    39  for a latency (ms) measure, 100 is a measurement that represents a 100ms
    40  latency event. Measurements are created from measures with
    41  the current context. Tags from the current context are recorded with the
    42  measurements if they are any.
    43  
    44  Recorded measurements are dropped immediately if no views are registered for them.
    45  There is usually no need to conditionally enable and disable
    46  recording to reduce cost. Recording of measurements is cheap.
    47  
    48  Libraries can always record measurements, and applications can later decide
    49  on which measurements they want to collect by registering views. This allows
    50  libraries to turn on the instrumentation by default.
    51  
    52  # Exemplars
    53  
    54  For a given recorded measurement, the associated exemplar is a diagnostic map
    55  that gives more information about the measurement.
    56  
    57  When aggregated using a Distribution aggregation, an exemplar is kept for each
    58  bucket in the Distribution. This allows you to easily find an example of a
    59  measurement that fell into each bucket.
    60  
    61  For example, if you also use the OpenCensus trace package and you
    62  record a measurement with a context that contains a sampled trace span,
    63  then the trace span will be added to the exemplar associated with the measurement.
    64  
    65  When exported to a supporting back end, you should be able to easily navigate
    66  to example traces that fell into each bucket in the Distribution.
    67  */
    68  package stats // import "go.opencensus.io/stats"
    69  

View as plain text