diff --git a/common/config/clickhouse.go b/common/config/clickhouse.go index 3ed3ad5f9..32d591c28 100644 --- a/common/config/clickhouse.go +++ b/common/config/clickhouse.go @@ -55,9 +55,8 @@ func (c *Clickhouse) ModifyConfig(dest ExporterConfigurer, currentConfig *Config exporterConfig["password"] = clickhousePassword } - createSchema, exists := dest.GetConfig()[clickhouseCreateSchema] - createSchemaBoolValue := exists && strings.ToLower(createSchema) == "create" - exporterConfig["create_schema"] = createSchemaBoolValue + createSchema := dest.GetConfig()[clickhouseCreateSchema] + exporterConfig["create_schema"] = getBooleanConfig(createSchema, "create") dbName, exists := dest.GetConfig()[clickhouseDatabaseName] if !exists { diff --git a/common/config/qryn.go b/common/config/qryn.go index 8386110ec..4de118726 100644 --- a/common/config/qryn.go +++ b/common/config/qryn.go @@ -45,7 +45,7 @@ func (g *Qryn) ModifyConfig(dest ExporterConfigurer, currentConfig *Config) erro if conf.passwordFieldName != "" { passwordPlaceholder = "${" + conf.passwordFieldName + "}" } - baseURL, err := parseURL(dest.GetConfig()[qrynHost], conf.key, passwordPlaceholder) + baseURL, err := parseURL(conf.host, conf.key, passwordPlaceholder) if err != nil { return errors.Join(err, errors.New("invalid qryn endpoint. gateway will not be configured with qryn")) } @@ -55,7 +55,7 @@ func (g *Qryn) ModifyConfig(dest ExporterConfigurer, currentConfig *Config) erro currentConfig.Exporters[rwExporterName] = GenericMap{ "endpoint": fmt.Sprintf("%s/api/v1/prom/remote/write", baseURL), "resource_to_telemetry_conversion": GenericMap{ - "enabled": dest.GetConfig()[resourceToTelemetryConversion] == "Yes", + "enabled": conf.resourceToTelemetryConversion, }, } metricsPipelineName := "metrics/qryn-" + dest.GetID() @@ -126,8 +126,8 @@ func (g *Qryn) getConfigs(dest ExporterConfigurer) qrynConf { return qrynConf{ host: dest.GetConfig()[qrynHost], key: dest.GetConfig()[qrynAPIKey], - addExporterName: dest.GetConfig()[qrynAddExporterName] == "Yes", - resourceToTelemetryConversion: dest.GetConfig()[resourceToTelemetryConversion] == "Yes", + addExporterName: getBooleanConfig(dest.GetConfig()[qrynAddExporterName], "Yes"), + resourceToTelemetryConversion: getBooleanConfig(dest.GetConfig()[resourceToTelemetryConversion], "Yes"), secretsOptional: dest.GetConfig()[qrynSecretsOptional] == "1", passwordFieldName: dest.GetConfig()[qrynPasswordFieldName], } diff --git a/common/config/qryn_oss.go b/common/config/qryn_oss.go index b09b306d5..2eada2dca 100644 --- a/common/config/qryn_oss.go +++ b/common/config/qryn_oss.go @@ -23,9 +23,19 @@ func (d QrynOssDest) GetConfig() map[string]string { conf := d.ExporterConfigurer.GetConfig() conf[qrynHost] = conf[qrynOssHost] conf[qrynAPIKey] = conf[qrynOssUsername] - conf[resourceToTelemetryConversion] = conf[qrynOssresourceToTelemetryConversion] + // Yes/No are deperecated, use true/false + if conf[qrynOssresourceToTelemetryConversion] == "true" || conf[qrynOssresourceToTelemetryConversion] == "Yes" { + conf[resourceToTelemetryConversion] = "true" + } else { + conf[resourceToTelemetryConversion] = "false" + } + // Yes/No are deperecated, use true/false + if conf[qrynOssAddExporterName] == "true" || conf[qrynOssAddExporterName] == "Yes" { + conf[qrynAddExporterName] = "true" + } else { + conf[qrynAddExporterName] = "false" + } conf[qrynSecretsOptional] = "1" - conf[qrynAddExporterName] = conf[qrynOssAddExporterName] conf[qrynPasswordFieldName] = "QRYN_OSS_PASSWORD" return conf } diff --git a/common/config/utils.go b/common/config/utils.go index c0d8aaac9..f9173bb46 100644 --- a/common/config/utils.go +++ b/common/config/utils.go @@ -92,3 +92,8 @@ func urlHostContainsPort(host string) bool { return strings.Contains(host, ":") } } + +func getBooleanConfig(currentValue string, deprecatedValue string) bool { + lowerCaseValue := strings.ToLower(currentValue) + return lowerCaseValue == "true" || lowerCaseValue == deprecatedValue +} diff --git a/destinations/data/clickhouse.yaml b/destinations/data/clickhouse.yaml index 26f9f565a..97158e01d 100644 --- a/destinations/data/clickhouse.yaml +++ b/destinations/data/clickhouse.yaml @@ -20,7 +20,7 @@ spec: componentProps: type: text required: true - placeholder: "http://host:port" + placeholder: 'http://host:port' tooltip: 'Clickhouse server address' - name: CLICKHOUSE_USERNAME displayName: Username @@ -39,14 +39,11 @@ spec: tooltip: 'If Clickhouse Authentication is used, provide the password' - name: CLICKHOUSE_CREATE_SCHEME displayName: Create Scheme - componentType: dropdown + componentType: checkbox componentProps: - values: - - Create - - Skip required: true tooltip: 'Should the destination create the schema for you?' - initialValue: Create + initialValue: true - name: CLICKHOUSE_DATABASE_NAME displayName: Database Name componentType: input diff --git a/destinations/data/gigapipe.yaml b/destinations/data/gigapipe.yaml index 7b71600ba..7c52e3d0f 100644 --- a/destinations/data/gigapipe.yaml +++ b/destinations/data/gigapipe.yaml @@ -35,19 +35,13 @@ spec: required: true - name: QRYN_RESOURCE_TO_TELEMETRY_CONVERSION displayName: Convert container attributes to labels - componentType: dropdown + componentType: checkbox componentProps: - values: - - "Yes" - - "No" required: false initialValue: Yes - name: QRYN_ADD_EXPORTER_NAME displayName: Add exporter name to labels - componentType: dropdown + componentType: checkbox componentProps: - values: - - "Yes" - - "No" required: false initialValue: Yes diff --git a/destinations/data/qryn.yaml b/destinations/data/qryn.yaml index 0397d4d61..93ac8135c 100644 --- a/destinations/data/qryn.yaml +++ b/destinations/data/qryn.yaml @@ -33,19 +33,13 @@ spec: type: text - name: QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION displayName: Convert container attributes to labels - componentType: dropdown + componentType: checkbox componentProps: - values: - - "Yes" - - "No" required: false initialValue: Yes - name: QRYN_OSS_ADD_EXPORTER_NAME displayName: Add exporter name to labels - componentType: dropdown + componentType: checkbox componentProps: - values: - - "Yes" - - "No" required: false initialValue: Yes diff --git a/docs/backends/clickhouse.mdx b/docs/backends/clickhouse.mdx index fb6e91e8c..cf89a980d 100644 --- a/docs/backends/clickhouse.mdx +++ b/docs/backends/clickhouse.mdx @@ -35,8 +35,8 @@ The benefit of this option is that you can see the value fast, without needing t The downside is that the schema may not be optimized for your specific use case, and may make changes more complicated. To use it: -- Odigos UI - When adding a new ClickHouse destination, select the `Create` Option under the `Create Scheme` field. -- Destination K8s Manifest - Set the `CLICKHOUSE_CREATE_SCHEME` setting to value `Create`. +- Odigos UI - When adding a new ClickHouse destination, select the `Create Scheme` checkbox field. +- Destination K8s Manifest - Set the `CLICKHOUSE_CREATE_SCHEME` setting to value `true`. The schema which will be used by default can be found [here](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/clickhouseexporter/example/default_ddl). @@ -54,8 +54,8 @@ This option is not recommended for production workloads: With this option, you are responsible for creating and managing the schema yourself. To use it: -- Odigos UI - In `Create Scheme` field, select the the `Skip` Option. -- Destination K8s Manifest - Set the `CLICKHOUSE_CREATE_SCHEME` setting to value `Skip`. +- Odigos UI - Unselect the `Create Scheme` checkbox field. +- Destination K8s Manifest - Set the `CLICKHOUSE_CREATE_SCHEME` setting to value `false`. The benefit of this option is that you have full control over the schema, and can optimize it for your specific use case. @@ -103,7 +103,7 @@ These are optional, keep empty if your ClickHouse server does not require authen ### Schema -- Create Schema - Set to `Skip` if you manage your own schema, or `Create` to have Odigos create the schema for you. See [Create Schema](#create-schema) for more details. +- Create Schema - Set to `false` if you manage your own schema, or `true` to have Odigos create the schema for you. See [Create Schema](#create-schema) for more details. - Database Name (Required) - The name of the Clickhouse Database where the telemetry data will be stored. The default is `otel`. The Database will not be created when not exists, so make sure you have created it before. - Table Names - Allows you to customize the names of the tables where the telemetry data will be stored. The default is `otel_traces` for traces and `otel_metrics` for metrics. @@ -140,7 +140,7 @@ metadata: namespace: odigos-system spec: data: - CLICKHOUSE_CREATE_SCHEME: + CLICKHOUSE_CREATE_SCHEME: # CLICKHOUSE_USERNAME: # Note: The commented fields above are optional. CLICKHOUSE_DATABASE_NAME: diff --git a/docs/backends/gigapipe.mdx b/docs/backends/gigapipe.mdx index fb9f9d203..ec9215049 100644 --- a/docs/backends/gigapipe.mdx +++ b/docs/backends/gigapipe.mdx @@ -56,8 +56,8 @@ metadata: spec: data: QRYN_API_KEY: - # QRYN_RESOURCE_TO_TELEMETRY_CONVERSION: - # QRYN_ADD_EXPORTER_NAME: + # QRYN_RESOURCE_TO_TELEMETRY_CONVERSION: + # QRYN_ADD_EXPORTER_NAME: # Note: The commented fields above are optional. QRYN_URL: destinationName: qryn diff --git a/docs/backends/qryn.mdx b/docs/backends/qryn.mdx index 1a7a31080..6e80ce270 100644 --- a/docs/backends/qryn.mdx +++ b/docs/backends/qryn.mdx @@ -49,8 +49,8 @@ spec: data: QRYN_OSS_URL: # QRYN_OSS_USERNAME: - # QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION: - # QRYN_OSS_ADD_EXPORTER_NAME: + # QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION: + # QRYN_OSS_ADD_EXPORTER_NAME: # Note: The commented fields above are optional. destinationName: qryn-oss # Uncomment the secretRef below if you are using the optional Secret. diff --git a/frontend/webapp/hooks/compute-platform/useComputePlatform.ts b/frontend/webapp/hooks/compute-platform/useComputePlatform.ts index 0253168f6..da943fe0c 100644 --- a/frontend/webapp/hooks/compute-platform/useComputePlatform.ts +++ b/frontend/webapp/hooks/compute-platform/useComputePlatform.ts @@ -45,6 +45,27 @@ export const useComputePlatform = (): UseComputePlatformHook => { return { ...item, type }; }), + destinations: data.computePlatform.destinations.map((item) => { + // Replace deprecated string values, with boolean values + const fields = + item.destinationType.type === 'clickhouse' + ? item.fields.replace('"CLICKHOUSE_CREATE_SCHEME":"Create"', '"CLICKHOUSE_CREATE_SCHEME":"true"').replace('"CLICKHOUSE_CREATE_SCHEME":"Skip"', '"CLICKHOUSE_CREATE_SCHEME":"false"') + : item.destinationType.type === 'qryn' + ? item.fields + .replace('"QRYN_ADD_EXPORTER_NAME":"Yes"', '"QRYN_ADD_EXPORTER_NAME":"true"') + .replace('"QRYN_ADD_EXPORTER_NAME":"No"', '"QRYN_ADD_EXPORTER_NAME":"false"') + .replace('"QRYN_RESOURCE_TO_TELEMETRY_CONVERSION":"Yes"', '"QRYN_RESOURCE_TO_TELEMETRY_CONVERSION":"true"') + .replace('"QRYN_RESOURCE_TO_TELEMETRY_CONVERSION":"No"', '"QRYN_RESOURCE_TO_TELEMETRY_CONVERSION":"false"') + : item.destinationType.type === 'qryn-oss' + ? item.fields + .replace('"QRYN_OSS_ADD_EXPORTER_NAME":"Yes"', '"QRYN_OSS_ADD_EXPORTER_NAME":"true"') + .replace('"QRYN_OSS_ADD_EXPORTER_NAME":"No"', '"QRYN_OSS_ADD_EXPORTER_NAME":"false"') + .replace('"QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION":"Yes"', '"QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION":"true"') + .replace('"QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION":"No"', '"QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION":"false"') + : item.fields; + + return { ...item, fields }; + }), }, }; }, [data]); diff --git a/frontend/webapp/hooks/destinations/useDestinationCRUD.ts b/frontend/webapp/hooks/destinations/useDestinationCRUD.ts index cc52de26d..4870b6617 100644 --- a/frontend/webapp/hooks/destinations/useDestinationCRUD.ts +++ b/frontend/webapp/hooks/destinations/useDestinationCRUD.ts @@ -75,8 +75,14 @@ export const useDestinationCRUD = (params?: Params) => { loading: cState.loading || uState.loading || dState.loading, destinations: data?.computePlatform.destinations || [], - createDestination: (destination: DestinationInput) => createDestination({ variables: { destination: { ...destination, fields: destination.fields.filter(({ value }) => value !== undefined) } } }), - updateDestination: (id: string, destination: DestinationInput) => updateDestination({ variables: { id, destination } }), - deleteDestination: (id: string) => deleteDestination({ variables: { id } }), + createDestination: (destination: DestinationInput) => { + createDestination({ variables: { destination: { ...destination, fields: destination.fields.filter(({ value }) => value !== undefined) } } }); + }, + updateDestination: (id: string, destination: DestinationInput) => { + updateDestination({ variables: { id, destination: { ...destination, fields: destination.fields.filter(({ value }) => value !== undefined) } } }); + }, + deleteDestination: (id: string) => { + deleteDestination({ variables: { id } }); + }, }; };