Skip to content

Commit f9c4de6

Browse files
addressed feedback
1 parent aa0638f commit f9c4de6

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

docs/api.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,6 @@ Following is the supported API format for writing to loki:
328328
grpcConfig: gRPC client configuration (used only for gRPC client type)
329329
keepAlive: keep alive interval
330330
keepAliveTimeout: keep alive timeout
331-
tls: TLS configuration
332-
enabled: enable TLS
333-
certFile: path to client certificate file
334-
keyFile: path to client key file
335-
caFile: path to CA certificate file
336-
serverName: server name for certificate verification
337-
insecureSkipVerify: skip certificate verification (insecure)
338331
</pre>
339332
## Write Standard Output
340333
Following is the supported API format for writing to standard output:

pkg/api/write_loki.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ func (w *WriteLoki) SetDefaults() {
9191
}
9292

9393
// Set defaults for gRPC config if gRPC client protocol is selected
94-
if w.ClientProtocol == "grpc" && w.GRPCConfig != nil {
94+
if w.ClientProtocol == "grpc" {
95+
if w.GRPCConfig == nil {
96+
w.GRPCConfig = &GRPCLokiConfig{}
97+
}
9598
w.GRPCConfig.SetDefaults()
9699
}
97100
}

pkg/pipeline/write/write_loki_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ func TestBuildGRPCLokiConfig(t *testing.T) {
452452
TenantID: "test-tenant",
453453
GRPCConfig: nil,
454454
},
455-
wantErr: true,
455+
wantErr: true, // buildGRPCLokiConfig validates directly (SetDefaults not called in this unit test)
456456
},
457457
{
458458
name: "invalid duration in gRPC config",
@@ -601,14 +601,13 @@ func TestWriteLokiValidation(t *testing.T) {
601601
errMsg: "url can't be empty",
602602
},
603603
{
604-
name: "missing gRPC config",
604+
name: "auto-created gRPC config with defaults",
605605
config: &api.WriteLoki{
606606
URL: "localhost:9095",
607607
ClientProtocol: "grpc",
608608
BatchSize: 1024,
609609
},
610-
wantErr: true,
611-
errMsg: "grpcConfig is required",
610+
wantErr: false, // SetDefaults will auto-create GRPCConfig
612611
},
613612
{
614613
name: "invalid batch size",

0 commit comments

Comments
 (0)