Skip to content

Commit

Permalink
increase sampling rate
Browse files Browse the repository at this point in the history
Summary:
This CLI is one of the biggest CLIs logging to the `cli_tool_usage` (1) Scuba table. We have recently rolled this logging out to all machines but it was enabled on devservers, ondemands, desktops, and laptops before for almost 10 years. Because of this, we want to increase sampling for the CLIs that are running millions to billions of times a day, which this CLI is one of. The per-host continuous calling leads to more data use in the Scuba table and does not add much value. We have therefore changed the sampling rate for automation from the default of 100 to 10 000, sampling for calls by humans remain unsampled. See CLI Foundation's Observability guidelines for more information on this usage logging: https://www.internalfb.com/intern/wiki/CLI_Foundation/Guidelines_&_How_To/Observability/

If you are wondering what the `cli.py.par_telemetry` library is, it is a way of communicating with the usage logging part that is integrated in every Python binary for many years. We are here leveraging it to tell it to change the sample rate. See https://fburl.com/cli.py.par_telemetry for its documentation.

(1): https://fburl.com/scuba/cli_tool_usage/qd6bnwzj

Reviewed By: genevievehelsel

Differential Revision: D50026796

fbshipit-source-id: 6a5c241635497ff7a5cf62b18ab0228bf3c007f4
  • Loading branch information
AndreasBackx authored and facebook-github-bot committed Oct 7, 2023
1 parent caae9fb commit 178047e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions eden/fs/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
from typing import Dict, List, Optional, Set, Tuple, Type

import thrift.transport

from cli.py import par_telemetry
from eden.fs.cli.buck import get_buck_command, run_buck_command
from eden.fs.cli.telemetry import TelemetrySample
from eden.fs.cli.util import (
Expand Down Expand Up @@ -2502,6 +2504,9 @@ async def async_main(parser: argparse.ArgumentParser, args: argparse.Namespace)


def main() -> int:
# This is called hundreds of millions of times on unique hosts.
# Increase how often it's sampled.
par_telemetry.set_sample_rate(automation=10000)
parser = create_parser()
args = parser.parse_args()

Expand Down

0 comments on commit 178047e

Please sign in to comment.