Skip to content

Commit c3ff3e1

Browse files
committed
Fix the wording in string_list's docstring
1 parent 1c1ed76 commit c3ff3e1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

glean/src/core/metrics/types/string_list.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class StringListMetric extends Metric<string[], string[]> {
4646
*
4747
* This allows appending a string value with arbitrary content to a list.
4848
* The list is length-limited to `MAX_LIST_LENGTH`.
49-
* Strings are length-limited to `MAX_STRING_LENGTH` bytes.
49+
* Strings are length-limited to `MAX_STRING_LENGTH` characters.
5050
*/
5151
class StringListMetricType extends MetricType {
5252
constructor(meta: CommonMetricData) {
@@ -94,9 +94,9 @@ class StringListMetricType extends MetricType {
9494
*
9595
* # Note
9696
*
97-
* - If the list is already of length `MAX_LIST_LENGTH`, log an error.
98-
* - Truncates the value if it is longer than `MAX_STRING_LENGTH` bytes
99-
* and logs an error.
97+
* - If the list is already of length `MAX_LIST_LENGTH`, record an error.
98+
* - Truncates the value if it is longer than `MAX_STRING_LENGTH` characters
99+
* and records an error.
100100
*
101101
* @param value The string to add.
102102
*/
@@ -107,7 +107,7 @@ class StringListMetricType extends MetricType {
107107
}
108108

109109
const truncatedValue = await truncateStringAtBoundaryWithError(this, value, MAX_STRING_LENGTH);
110-
let currentLen = -1;
110+
let currentLen = 0;
111111

112112
const transformFn = ((value) => {
113113
return (v?: JSONValue): StringListMetric => {
@@ -131,7 +131,7 @@ class StringListMetricType extends MetricType {
131131

132132
await Context.metricsDatabase.transform(this, transformFn);
133133

134-
if (currentLen == MAX_LIST_LENGTH) {
134+
if (currentLen >= MAX_LIST_LENGTH) {
135135
await Context.errorManager.record(
136136
this,
137137
ErrorType.InvalidValue,

0 commit comments

Comments
 (0)