From 0379c33bced17b531b05507222a701071c1b4273 Mon Sep 17 00:00:00 2001 From: Leandro Beretta Date: Fri, 12 Sep 2025 10:36:12 -0300 Subject: [PATCH 1/2] add new fields to schemas --- web/moduleMapper/schemas.ts | 43 +++++++++++++++++++++ web/src/components/forms/config/uiSchema.ts | 36 +++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/web/moduleMapper/schemas.ts b/web/moduleMapper/schemas.ts index fbad276f6..2f406a072 100644 --- a/web/moduleMapper/schemas.ts +++ b/web/moduleMapper/schemas.ts @@ -3572,6 +3572,49 @@ export const FlowCollectorSchema: RJSFSchema | any = { type: 'boolean', default: true }, + clientType: { + description: + '`clientType` specifies the protocol to use for sending flows to Loki: `http` or `grpc`.\nThis setting is independent of the Loki installation mode and allows choosing the optimal transport protocol.\ngRPC may provide better performance for high-throughput scenarios.', + type: 'string', + default: 'http', + enum: ['http', 'grpc'] + }, + grpcConfig: { + description: + '`grpcConfig` contains gRPC-specific configuration for the Loki writer.\nThis is only used when `clientType` is set to `grpc`.', + type: 'object', + properties: { + keepAlive: { + description: '`keepAlive` is the gRPC keep-alive interval.', + type: 'string', + default: '30s' + }, + keepAliveTimeout: { + description: '`keepAliveTimeout` is the gRPC keep-alive timeout.', + type: 'string', + default: '5s' + }, + maxRecvMsgSize: { + description: '`maxRecvMsgSize` is the maximum message size in bytes the gRPC client can receive. Default: 64MB.', + type: 'integer', + default: 67108864, + minimum: 1024, + maximum: 67108864 + }, + maxSendMsgSize: { + description: '`maxSendMsgSize` is the maximum message size in bytes the gRPC client can send. Default: 16MB.', + type: 'integer', + default: 16777216, + minimum: 1024, + maximum: 67108864 + }, + useStreaming: { + description: '`useStreaming` enables streaming mode for real-time log pushing when using gRPC.', + type: 'boolean', + default: false + } + } + }, mode: { description: '`mode` must be set according to the installation mode of Loki:\n- Use `LokiStack` when Loki is managed using the Loki Operator\n- Use `Monolithic` when Loki is installed as a monolithic workload\n- Use `Microservices` when Loki is installed as microservices, but without Loki Operator\n- Use `Manual` if none of the options above match your setup', diff --git a/web/src/components/forms/config/uiSchema.ts b/web/src/components/forms/config/uiSchema.ts index 4879a00b8..50909058e 100644 --- a/web/src/components/forms/config/uiSchema.ts +++ b/web/src/components/forms/config/uiSchema.ts @@ -993,6 +993,40 @@ export const FlowCollectorUISchema: UiSchema = { enable: { 'ui:title': 'Use Loki storage' }, + clientType: { + 'ui:title': 'Client type', + 'ui:description': 'Protocol to use for sending flows to Loki: http or grpc. gRPC may provide better performance for high-throughput scenarios.' + }, + grpcConfig: { + 'ui:title': 'gRPC configuration', + 'ui:description': 'gRPC-specific configuration for the Loki writer. Only used when clientType is set to grpc.', + 'ui:dependency': { + controlFieldPath: ['loki', 'clientType'], + controlFieldValue: 'grpc', + controlFieldName: 'clientType' + }, + keepAlive: { + 'ui:title': 'Keep alive', + 'ui:description': 'gRPC keep-alive interval' + }, + keepAliveTimeout: { + 'ui:title': 'Keep alive timeout', + 'ui:description': 'gRPC keep-alive timeout' + }, + maxRecvMsgSize: { + 'ui:title': 'Max receive message size', + 'ui:description': 'Maximum message size in bytes the gRPC client can receive' + }, + maxSendMsgSize: { + 'ui:title': 'Max send message size', + 'ui:description': 'Maximum message size in bytes the gRPC client can send' + }, + useStreaming: { + 'ui:title': 'Use streaming', + 'ui:description': 'Enable streaming mode for real-time log pushing when using gRPC' + }, + 'ui:order': ['keepAlive', 'keepAliveTimeout', 'maxRecvMsgSize', 'maxSendMsgSize', 'useStreaming'] + }, mode: { 'ui:title': 'Mode' }, @@ -1179,6 +1213,8 @@ export const FlowCollectorUISchema: UiSchema = { }, 'ui:order': [ 'enable', + 'clientType', + 'grpcConfig', 'mode', 'manual', 'monolithic', From d4766f2918a8718bd80c829a98f6ab5d1cc93287 Mon Sep 17 00:00:00 2001 From: Leandro Beretta Date: Fri, 12 Sep 2025 10:58:03 -0300 Subject: [PATCH 2/2] fix linting issue --- web/src/components/forms/config/uiSchema.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/components/forms/config/uiSchema.ts b/web/src/components/forms/config/uiSchema.ts index 50909058e..cdcf74135 100644 --- a/web/src/components/forms/config/uiSchema.ts +++ b/web/src/components/forms/config/uiSchema.ts @@ -995,7 +995,8 @@ export const FlowCollectorUISchema: UiSchema = { }, clientType: { 'ui:title': 'Client type', - 'ui:description': 'Protocol to use for sending flows to Loki: http or grpc. gRPC may provide better performance for high-throughput scenarios.' + 'ui:description': + 'Protocol to use for sending flows to Loki: http or grpc. gRPC may provide better performance for high-throughput scenarios.' }, grpcConfig: { 'ui:title': 'gRPC configuration',