xref: /aosp_15_r20/external/cronet/components/metrics/sampling_metrics_provider.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2016 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_METRICS_SAMPLING_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_SAMPLING_METRICS_PROVIDER_H_
7 
8 #include "components/metrics/metrics_provider.h"
9 
10 namespace metrics {
11 
12 // Provides metrics related to sampling of metrics reporting clients. In
13 // particular, the rate at which clients are sampled.
14 class SamplingMetricsProvider : public MetricsProvider {
15  public:
16   // |sampling_rate_per_mille| is the number of clients per 1000 that are in the
17   // sample.
18   explicit SamplingMetricsProvider(int sampling_rate_per_mille);
19   ~SamplingMetricsProvider() override = default;
20   SamplingMetricsProvider(const SamplingMetricsProvider&) = delete;
21   SamplingMetricsProvider operator=(const SamplingMetricsProvider&) = delete;
22 
23  private:
24   // MetricsProvider:
25   void ProvideStabilityMetrics(
26       SystemProfileProto* system_profile_proto) override;
27 
28   int sampling_rate_per_mille_;
29 };
30 
31 }  // namespace metrics
32 
33 #endif  // COMPONENTS_METRICS_SAMPLING_METRICS_PROVIDER_H_
34