Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

70 righe
2.8 KiB

  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. Package stats contains support for OpenCensus stats recording.
  17. OpenCensus allows users to create typed measures, record measurements,
  18. aggregate the collected data, and export the aggregated data.
  19. Measures
  20. A measure represents a type of data point to be tracked and recorded.
  21. For example, latency, request Mb/s, and response Mb/s are measures
  22. to collect from a server.
  23. Measure constructors such as Int64 and Float64 automatically
  24. register the measure by the given name. Each registered measure needs
  25. to be unique by name. Measures also have a description and a unit.
  26. Libraries can define and export measures. Application authors can then
  27. create views and collect and break down measures by the tags they are
  28. interested in.
  29. Recording measurements
  30. Measurement is a data point to be collected for a measure. For example,
  31. for a latency (ms) measure, 100 is a measurement that represents a 100ms
  32. latency event. Measurements are created from measures with
  33. the current context. Tags from the current context are recorded with the
  34. measurements if they are any.
  35. Recorded measurements are dropped immediately if no views are registered for them.
  36. There is usually no need to conditionally enable and disable
  37. recording to reduce cost. Recording of measurements is cheap.
  38. Libraries can always record measurements, and applications can later decide
  39. on which measurements they want to collect by registering views. This allows
  40. libraries to turn on the instrumentation by default.
  41. Exemplars
  42. For a given recorded measurement, the associated exemplar is a diagnostic map
  43. that gives more information about the measurement.
  44. When aggregated using a Distribution aggregation, an exemplar is kept for each
  45. bucket in the Distribution. This allows you to easily find an example of a
  46. measurement that fell into each bucket.
  47. For example, if you also use the OpenCensus trace package and you
  48. record a measurement with a context that contains a sampled trace span,
  49. then the trace span will be added to the exemplar associated with the measurement.
  50. When exported to a supporting back end, you should be able to easily navigate
  51. to example traces that fell into each bucket in the Distribution.
  52. */
  53. package stats // import "go.opencensus.io/stats"