summaryrefslogtreecommitdiffstats
path: root/toolkit/components/glean/bindings/private/CustomDistribution.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/glean/bindings/private/CustomDistribution.cpp')
-rw-r--r--toolkit/components/glean/bindings/private/CustomDistribution.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/toolkit/components/glean/bindings/private/CustomDistribution.cpp b/toolkit/components/glean/bindings/private/CustomDistribution.cpp
index a5a821a558..88e96236db 100644
--- a/toolkit/components/glean/bindings/private/CustomDistribution.cpp
+++ b/toolkit/components/glean/bindings/private/CustomDistribution.cpp
@@ -33,6 +33,15 @@ void CustomDistributionMetric::AccumulateSamples(
fog_custom_distribution_accumulate_samples(mId, &aSamples);
}
+void CustomDistributionMetric::AccumulateSingleSample(uint64_t aSample) const {
+ auto hgramId = HistogramIdForMetric(mId);
+ if (hgramId) {
+ auto id = hgramId.extract();
+ Telemetry::Accumulate(id, aSample);
+ }
+ fog_custom_distribution_accumulate_single_sample(mId, aSample);
+}
+
void CustomDistributionMetric::AccumulateSamplesSigned(
const nsTArray<int64_t>& aSamples) const {
auto hgramId = HistogramIdForMetric(mId);
@@ -47,6 +56,16 @@ void CustomDistributionMetric::AccumulateSamplesSigned(
fog_custom_distribution_accumulate_samples_signed(mId, &aSamples);
}
+void CustomDistributionMetric::AccumulateSingleSampleSigned(
+ int64_t aSample) const {
+ auto hgramId = HistogramIdForMetric(mId);
+ if (hgramId) {
+ auto id = hgramId.extract();
+ Telemetry::Accumulate(id, aSample);
+ }
+ fog_custom_distribution_accumulate_single_sample_signed(mId, aSample);
+}
+
Result<Maybe<DistributionData>, nsCString>
CustomDistributionMetric::TestGetValue(const nsACString& aPingName) const {
nsCString err;
@@ -78,6 +97,10 @@ void GleanCustomDistribution::AccumulateSamples(
mCustomDist.AccumulateSamplesSigned(aSamples);
}
+void GleanCustomDistribution::AccumulateSingleSample(const int64_t aSample) {
+ mCustomDist.AccumulateSingleSampleSigned(aSample);
+}
+
void GleanCustomDistribution::TestGetValue(
const nsACString& aPingName,
dom::Nullable<dom::GleanDistributionData>& aRetval, ErrorResult& aRv) {