github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/server/telemetry/doc.go (about)

     1  // Copyright 2018 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  /*
    12  Package telemetry contains helpers for capturing diagnostics information.
    13  
    14  Telemetry is captured and shared with cockroach labs if enabled to help the team
    15  prioritize new and existing features or configurations. The docs include more
    16  information about this telemetry, what it includes and how to configure it.
    17  
    18  When trying to measure the usage of a given feature, the existing reporting of
    19  "scrubbed" queries -- showing the structure but not the values -- can serve as a
    20  means to measure eg. how many clusters use BACKUP or window functions, etc.
    21  However many features cannot be easily measured just from these statements,
    22  either because they are cannot be reliably inferred from a scrubbed query or
    23  are simply not involved in a SQL statement execution at all.
    24  
    25  For such features we also have light-weight `telemetry.Count("some.feature")` to
    26  track their usage. These increment in-memory counts that are then included with
    27  existing diagnostics reporting if enabled. Some notes on using these:
    28    - "some.feature" should always be a literal string constant -- it must not
    29      include any user-submitted data.
    30    - Contention-sensitive, high-volume callers should use an initial `GetCounter`
    31  		to get a Counter they can then `Inc` repeatedly instead to avoid contention
    32  		and map lookup over around the name resolution on each increment.
    33  	-	When naming a counter, by convention we use dot-separated, dashed names, eg.
    34  		`feature-area.specific-feature`.
    35  */
    36  package telemetry