[Config Validator][Source Generator][Logger] Remove string_buffer_max from Metrics Definition

Remove the definition of string_buffer_max from metric definition.
The definition of string_buffer_max has been moved under the report
definition. This change was made in fxr/670282 and fxr/669683.

Bug: 79464
Change-Id: I01757bc599052071cdf76dd9a667815b182e78b4
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/670422
Reviewed-by: Laura Peskin <pesk@google.com>
Commit-Queue: Andrew Hwang <anhwang@google.com>
diff --git a/src/bin/config_parser/src/config_validator/metric_definitions.go b/src/bin/config_parser/src/config_validator/metric_definitions.go
index d785e8f..315e632 100644
--- a/src/bin/config_parser/src/config_validator/metric_definitions.go
+++ b/src/bin/config_parser/src/config_validator/metric_definitions.go
@@ -434,9 +434,6 @@
 	if m.StringCandidateFile == "" {
 		return fmt.Errorf("no string_candidate_file specified for metric of type STRING")
 	}
-	if m.StringBufferMax == 0 {
-		return fmt.Errorf("no string_buffer_max specified for metric of type STRING")
-	}
 
 	return nil
 }
diff --git a/src/bin/config_parser/src/config_validator/metric_definitions_test.go b/src/bin/config_parser/src/config_validator/metric_definitions_test.go
index 30c3e6b..e89b05b 100644
--- a/src/bin/config_parser/src/config_validator/metric_definitions_test.go
+++ b/src/bin/config_parser/src/config_validator/metric_definitions_test.go
@@ -511,12 +511,6 @@
 	if err := validateMetricDefinition(m); err == nil {
 		t.Error("Accepted STRING metric definition with string_candidate_file not set.")
 	}
-
-	m = makeValidStringMetric()
-	m.StringBufferMax = 0
-	if err := validateMetricDefinition(m); err == nil {
-		t.Error("Accepted STRING metric definition with string_buffer_max not set.")
-	}
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -945,7 +939,6 @@
 func makeValidStringMetric() config.MetricDefinition {
 	m := makeValidCobalt11BaseMetric(config.MetricDefinition_STRING)
 	m.StringCandidateFile = "some_file"
-	m.StringBufferMax = 10
 	return m
 }
 
diff --git a/src/bin/config_parser/src/source_generator/json.go b/src/bin/config_parser/src/source_generator/json.go
index ffedd6e..71e7e7c 100644
--- a/src/bin/config_parser/src/source_generator/json.go
+++ b/src/bin/config_parser/src/source_generator/json.go
@@ -46,7 +46,6 @@
 	Units               string       `json:"metric_units"`
 	UnitsOther          string       `json:"metric_units_other"`
 	StringCandidateFile string       `json:"string_candidate_file"`
-	StringBufferMax     uint32       `json:"string_buffer_max"`
 	ProtoName           string       `json:"proto_name"`
 	ReplacementMetricId uint32       `json:"replacement_metric_id"`
 	Reports             []jsonReport `json:"reports"`
@@ -212,7 +211,6 @@
 		Units:               metric.GetMetricUnits().String(),
 		UnitsOther:          metric.GetMetricUnitsOther(),
 		StringCandidateFile: metric.GetStringCandidateFile(),
-		StringBufferMax:     metric.GetStringBufferMax(),
 		ProtoName:           metric.GetProtoName(),
 		ReplacementMetricId: metric.GetReplacementMetricId(),
 		Reports:             reports,
diff --git a/src/bin/config_parser/src/source_generator/json_test.go b/src/bin/config_parser/src/source_generator/json_test.go
index 55f8d5c..926db9c 100644
--- a/src/bin/config_parser/src/source_generator/json_test.go
+++ b/src/bin/config_parser/src/source_generator/json_test.go
@@ -172,7 +172,6 @@
 	}
 	metricUnitOther := "test_metric_unit"
 	candidateFile := "test_candidate_file_string"
-	stringBufferMax := uint32(1234)
 	protoName := "test_proto_name"
 	replacementId := uint32(12345)
 
@@ -189,7 +188,6 @@
 		MetricUnits:         config.MetricUnits_NANOSECONDS,
 		MetricUnitsOther:    metricUnitOther,
 		StringCandidateFile: candidateFile,
-		StringBufferMax:     stringBufferMax,
 		ProtoName:           protoName,
 		ReplacementMetricId: replacementId,
 		Reports:             reports,
@@ -208,7 +206,6 @@
 		Units:               "NANOSECONDS",
 		UnitsOther:          metricUnitOther,
 		StringCandidateFile: candidateFile,
-		StringBufferMax:     stringBufferMax,
 		ProtoName:           protoName,
 		ReplacementMetricId: replacementId,
 		Reports:             emptyReports,
diff --git a/src/bin/config_parser/src/source_generator/source_generator_test_files/golden.cb.json b/src/bin/config_parser/src/source_generator/source_generator_test_files/golden.cb.json
index f2e0b51..734c073 100644
--- a/src/bin/config_parser/src/source_generator/source_generator_test_files/golden.cb.json
+++ b/src/bin/config_parser/src/source_generator/source_generator_test_files/golden.cb.json
@@ -21,7 +21,6 @@
               "metric_units": "METRIC_UNITS_OTHER",
               "metric_units_other": "",
               "string_candidate_file": "",
-              "string_buffer_max": 0,
               "proto_name": "",
               "replacement_metric_id": 0,
               "reports": [
@@ -81,7 +80,6 @@
               "metric_units": "METRIC_UNITS_OTHER",
               "metric_units_other": "",
               "string_candidate_file": "",
-              "string_buffer_max": 0,
               "proto_name": "",
               "replacement_metric_id": 0,
               "reports": [
@@ -126,7 +124,6 @@
               "metric_units": "METRIC_UNITS_OTHER",
               "metric_units_other": "",
               "string_candidate_file": "",
-              "string_buffer_max": 0,
               "proto_name": "",
               "replacement_metric_id": 0,
               "reports": [
@@ -163,7 +160,6 @@
               "metric_units": "METRIC_UNITS_OTHER",
               "metric_units_other": "",
               "string_candidate_file": "",
-              "string_buffer_max": 0,
               "proto_name": "",
               "replacement_metric_id": 0,
               "reports": null
@@ -180,7 +176,6 @@
               "metric_units": "METRIC_UNITS_OTHER",
               "metric_units_other": "",
               "string_candidate_file": "",
-              "string_buffer_max": 0,
               "proto_name": "",
               "replacement_metric_id": 0,
               "reports": [
@@ -223,7 +218,6 @@
               "metric_units": "METRIC_UNITS_OTHER",
               "metric_units_other": "",
               "string_candidate_file": "",
-              "string_buffer_max": 0,
               "proto_name": "",
               "replacement_metric_id": 0,
               "reports": null
@@ -246,7 +240,6 @@
               "metric_units": "METRIC_UNITS_OTHER",
               "metric_units_other": "",
               "string_candidate_file": "",
-              "string_buffer_max": 0,
               "proto_name": "",
               "replacement_metric_id": 0,
               "reports": null
diff --git a/src/logger/test_registries/cobalt1.1_migration_registry.yaml b/src/logger/test_registries/cobalt1.1_migration_registry.yaml
index 19612ae..dae8bef 100644
--- a/src/logger/test_registries/cobalt1.1_migration_registry.yaml
+++ b/src/logger/test_registries/cobalt1.1_migration_registry.yaml
@@ -93,7 +93,6 @@
     metric_name: event_component_count_new
     metric_type: STRING
     string_candidate_file: file
-    string_buffer_max: 5
     metric_semantics: [USAGE_COUNTING]
     metric_dimensions: *dimensions
     reports:
diff --git a/src/logger/test_registries/cobalt1.1_test_registry.yaml b/src/logger/test_registries/cobalt1.1_test_registry.yaml
index adca8de..d2ddd2c 100644
--- a/src/logger/test_registries/cobalt1.1_test_registry.yaml
+++ b/src/logger/test_registries/cobalt1.1_test_registry.yaml
@@ -95,7 +95,6 @@
     metric_semantics: [USAGE_COUNTING]
     # No metric dimensions defined.
     string_candidate_file: application_names.txt
-    string_buffer_max: 30
     reports:
       - report_name: "Component_Histogram"
         id: 1