cuelang.org/go@v0.10.1/internal/golangorgx/telemetry/counter/doc.go (about)

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package counter implements a simple counter system for collecting
     6  // totally public telemetry data.
     7  //
     8  // There are two kinds of counters, simple counters and stack counters.
     9  // Simple counters are created by New(<counter-name>).
    10  // Stack counters are created by NewStack(<counter-name>, depth).
    11  // Both are incremented by calling Inc().
    12  //
    13  // Counter files are stored in LocalDir(). Their content can be accessed
    14  // by Parse().
    15  //
    16  // Simple counters are very cheap. Stack counters are more
    17  // expensive, as they require parsing the stack.
    18  // (Stack counters are implemented as a set of regular counters whose names
    19  // are the concatenation of the name and the stack trace. There is an upper
    20  // limit on the size of this name, about 4K bytes. If the name is too long
    21  // the stack will be truncated and "truncated" appended.)
    22  //
    23  // When counter files expire they are turned into reports by the upload package.
    24  // The first time any counter file is created for a user, a random
    25  // day of the week is selected on which counter files will expire.
    26  // For the first week, that day is more than 7 days (but not more than
    27  // two weeks) in the future.
    28  // After that the counter files expire weekly on the same day of
    29  // the week.
    30  package counter