Skip to content

Commit 3a4e39c

Browse files
authored
Improve error messages for built-in configuration JSON schema
1 parent 755791d commit 3a4e39c

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

packages/otelbin/src/components/monaco-editor/JSONSchema.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,28 @@ export const schema: JSONSchemaType<IOtelConfig> = {
3838
type: "object",
3939
additionalProperties: true,
4040
errorMessage: {
41-
type: "receivers property must be yaml map/dictionary",
41+
type: "The 'receivers' entry must be a map, see https://opentelemetry.io/docs/collector/configuration/#receivers",
4242
},
4343
},
4444
processors: {
4545
type: "object",
4646
additionalProperties: true,
4747
errorMessage: {
48-
type: "processors property must be yaml map/dictionary",
48+
type: "The 'processors' entry must be a map, see https://opentelemetry.io/docs/collector/configuration/#processors",
4949
},
5050
},
5151
exporters: {
5252
type: "object",
5353
additionalProperties: true,
5454
errorMessage: {
55-
type: "exporters property must be yaml map/dictionary",
55+
type: "The 'exporters' entry must be a map, see https://opentelemetry.io/docs/collector/configuration/#exporters",
5656
},
5757
},
5858
extensions: {
5959
type: "object",
6060
additionalProperties: true,
6161
errorMessage: {
62-
type: "extensions property must be yaml map/dictionary",
62+
type: "The 'extensions' entry must be a map, see https://opentelemetry.io/docs/collector/configuration/#extensions",
6363
},
6464
},
6565
service: {
@@ -75,7 +75,7 @@ export const schema: JSONSchemaType<IOtelConfig> = {
7575
type: "array",
7676
minItems: 1,
7777
errorMessage: {
78-
minItems: "At least one receiver is required",
78+
minItems: "The pipeline must reference at least one receiver, see https://opentelemetry.io/docs/collector/configuration/#pipelines",
7979
},
8080
},
8181
processors: {
@@ -85,40 +85,40 @@ export const schema: JSONSchemaType<IOtelConfig> = {
8585
type: "array",
8686
minItems: 1,
8787
errorMessage: {
88-
minItems: "At least one exporter is required",
88+
minItems: "The pipeline must reference at least one exporter, see https://opentelemetry.io/docs/collector/configuration/#pipelines",
8989
},
9090
},
9191
},
9292
required: ["receivers", "exporters"],
9393
errorMessage: {
9494
required: {
95-
receivers: "receivers property is required",
96-
exporters: "exporters property is required",
95+
receivers: "The pipeline must reference at least one receiver, see https://opentelemetry.io/docs/collector/configuration/#pipelines",
96+
exporters: "The pipeline must reference at least one exporter, see https://opentelemetry.io/docs/collector/configuration/#pipelines",
9797
},
9898
},
9999
},
100100
errorMessage: {
101-
type: "pipelines property must be yaml map/dictionary",
101+
type: "The 'pipeline' entry must be a map, see https://opentelemetry.io/docs/collector/configuration/#pipelines",
102102
},
103103
},
104104
},
105105
required: ["pipelines"],
106106
errorMessage: {
107-
required: "pipelines property is required",
108-
type: "service property must be yaml map/dictionary",
107+
required: "At least one pipeline must be specified, see https://opentelemetry.io/docs/collector/configuration/#pipelines",
108+
type: "The 'pipeline' entry must be a map, see https://opentelemetry.io/docs/collector/configuration/#pipelines",
109109
},
110110
},
111111
connectors: {
112112
type: "object",
113113
additionalProperties: true,
114114
errorMessage: {
115-
type: "connectors property must be yaml map/dictionary",
115+
type: "The 'connectors' entry must be a map, see https://opentelemetry.io/docs/collector/configuration/#connectors",
116116
},
117117
},
118118
},
119119
errorMessage: {
120-
type: "Must be a valid OpenTelemetry Collector configuration",
121-
required: "service property is required",
120+
type: "The configuration must be a map, see https://opentelemetry.io/docs/collector/configuration",
121+
required: "The configuration must specify at least the 'receivers', 'exporters, and 'service' entries, see https://opentelemetry.io/docs/collector/configuration",
122122
},
123-
required: ["service"],
123+
required: ["service", "receivers", "exporters"],
124124
};

0 commit comments

Comments
 (0)