Skip to content

Commit 5eb9b13

Browse files
committed
1 parent 73c76f9 commit 5eb9b13

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

analyze.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,24 @@ var directives = map[string][]uint{
10101010
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1234,
10111011
ngxStreamMainConf | ngxStreamSrvConf | ngxConfTake1234,
10121012
},
1013+
"otel_exporter": {
1014+
ngxHTTPMainConf | ngxConfBlock | ngxConfNoArgs,
1015+
},
1016+
"otel_service_name": {
1017+
ngxHTTPMainConf | ngxConfTake1,
1018+
},
1019+
"otel_span_attr": {
1020+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake2,
1021+
},
1022+
"otel_span_name": {
1023+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1,
1024+
},
1025+
"otel_trace": {
1026+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1,
1027+
},
1028+
"otel_trace_context": {
1029+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1,
1030+
},
10131031
"output_buffers": {
10141032
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake2,
10151033
},

analyze_map.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ var mapBodies = map[string]mapParameterMasks{
4141
"geoip2": {
4242
defaultMasks: ngxConf1More,
4343
},
44+
"otel_exporter": {
45+
defaultMasks: ngxConfTake1,
46+
},
4447
}
4548

4649
// analyzeMapBody validates the body of a map-like directive. Map-like directives are block directives

analyze_map_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,27 @@ func TestAnalyzeMapBody(t *testing.T) {
175175
},
176176
term: ";",
177177
},
178+
"valid otel_exporter": {
179+
mapDirective: "otel_exporter",
180+
parameter: &Directive{
181+
Directive: "endpoint",
182+
Args: []string{"localhost:4317"},
183+
Line: 5,
184+
Block: Directives{},
185+
},
186+
term: ";",
187+
},
188+
"invalid otel_exporter": {
189+
mapDirective: "otel_exporter",
190+
parameter: &Directive{
191+
Directive: "endpoint",
192+
Args: []string{"localhost:4317", "localhost:1234"},
193+
Line: 5,
194+
Block: Directives{},
195+
},
196+
term: ";",
197+
wantErr: &ParseError{What: "invalid number of parameters", BlockCtx: "otel_exporter"},
198+
},
178199
"missing semicolon": {
179200
mapDirective: "map",
180201
parameter: &Directive{

0 commit comments

Comments
 (0)