From 1e6275142e2301185bb39d1a3c5b74b480c7f201 Mon Sep 17 00:00:00 2001 From: akvlad Date: Thu, 17 Oct 2024 14:41:29 +0300 Subject: [PATCH] yaml rename; url parse update; docs fix --- common/config/qryn.go | 18 +++++++-- .../data/{qrynoss.yaml => gigapipe.yaml} | 34 ++++++++-------- destinations/data/qryn.yaml | 34 ++++++++-------- docs/backends/gigapipe.mdx | 22 ++++++----- docs/backends/qryn.mdx | 39 +++++++++++-------- 5 files changed, 82 insertions(+), 65 deletions(-) rename destinations/data/{qrynoss.yaml => gigapipe.yaml} (64%) diff --git a/common/config/qryn.go b/common/config/qryn.go index c463671b1..8386110ec 100644 --- a/common/config/qryn.go +++ b/common/config/qryn.go @@ -3,7 +3,9 @@ package config import ( "errors" "fmt" + "math/rand" "net/url" + "strings" "github.com/odigos-io/odigos/common" ) @@ -142,15 +144,23 @@ func (g *Qryn) checkConfigs(conf *qrynConf) error { } func parseURL(rawURL, apiKey, apiSecret string) (string, error) { + rawURL = strings.TrimSpace(rawURL) + if !strings.HasPrefix(rawURL, "http://") && !strings.HasPrefix(rawURL, "https://") { + rawURL = "https://" + rawURL + } u, err := url.Parse(rawURL) if err != nil { return "", err } - if u.Scheme == "" { - return parseURL(fmt.Sprintf("https://%s", rawURL), apiKey, apiSecret) + apiSecretPlaceholder := fmt.Sprintf("____%d_SECRET_PLACEHOLDER_%[1]d____", rand.Uint64()) + if apiKey != "" { + u.User = url.UserPassword(apiKey, apiSecretPlaceholder) } - - return fmt.Sprintf("%s://%s:%s@%s", u.Scheme, apiKey, apiSecret, u.Host), nil + res := u.String() + if apiKey != "" { + res = strings.ReplaceAll(res, ":"+apiSecretPlaceholder+"@", ":"+apiSecret+"@") + } + return res, nil } func (g *Qryn) maybeAddExporterName(conf *qrynConf, currentConfig *Config, processorName string, name string, diff --git a/destinations/data/qrynoss.yaml b/destinations/data/gigapipe.yaml similarity index 64% rename from destinations/data/qrynoss.yaml rename to destinations/data/gigapipe.yaml index cfd84ba42..7b71600ba 100644 --- a/destinations/data/qrynoss.yaml +++ b/destinations/data/gigapipe.yaml @@ -1,11 +1,11 @@ apiVersion: internal.odigos.io/v1beta1 kind: Destination metadata: - type: qryn-oss - displayName: qryn - category: self hosted + type: qryn + displayName: Gigapipe + category: managed spec: - image: qryn.svg + image: gigapipe.svg signals: traces: supported: true @@ -14,38 +14,40 @@ spec: logs: supported: true fields: - - name: QRYN_OSS_PASSWORD - displayName: Basic auth password + - name: QRYN_API_SECRET + displayName: API Secret componentType: input componentProps: type: password + required: true secret: true - - name: QRYN_OSS_USERNAME - displayName: Basic auth username + - name: QRYN_API_KEY + displayName: API Key componentType: input componentProps: - type: text - - name: QRYN_OSS_URL + type: password + required: true + - name: QRYN_URL displayName: API Url componentType: input componentProps: type: text required: true - - name: QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION + - name: QRYN_RESOURCE_TO_TELEMETRY_CONVERSION displayName: Convert container attributes to labels componentType: dropdown componentProps: values: - - Yes - - No + - "Yes" + - "No" required: false initialValue: Yes - - name: QRYN_OSS_ADD_EXPORTER_NAME + - name: QRYN_ADD_EXPORTER_NAME displayName: Add exporter name to labels componentType: dropdown componentProps: values: - - Yes - - No + - "Yes" + - "No" required: false initialValue: Yes diff --git a/destinations/data/qryn.yaml b/destinations/data/qryn.yaml index e8ef742ef..b1016d377 100644 --- a/destinations/data/qryn.yaml +++ b/destinations/data/qryn.yaml @@ -1,11 +1,11 @@ apiVersion: internal.odigos.io/v1beta1 kind: Destination metadata: - type: qryn - displayName: Gigapipe - category: managed + type: qryn-oss + displayName: qryn + category: self-hosted spec: - image: gigapipe.svg + image: qryn.svg signals: traces: supported: true @@ -14,40 +14,38 @@ spec: logs: supported: true fields: - - name: QRYN_API_SECRET - displayName: API Secret + - name: QRYN_OSS_PASSWORD + displayName: Basic auth password componentType: input componentProps: type: password - required: true secret: true - - name: QRYN_API_KEY - displayName: API Key + - name: QRYN_OSS_USERNAME + displayName: Basic auth username componentType: input componentProps: - type: password - required: true - - name: QRYN_URL + type: text + - name: QRYN_OSS_URL displayName: API Url componentType: input componentProps: type: text required: true - - name: QRYN_RESOURCE_TO_TELEMETRY_CONVERSION + - name: QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION displayName: Convert container attributes to labels componentType: dropdown componentProps: values: - - Yes - - No + - "Yes" + - "No" required: false initialValue: Yes - - name: QRYN_ADD_EXPORTER_NAME + - name: QRYN_OSS_ADD_EXPORTER_NAME displayName: Add exporter name to labels componentType: dropdown componentProps: values: - - Yes - - No + - "Yes" + - "No" required: false initialValue: Yes diff --git a/docs/backends/gigapipe.mdx b/docs/backends/gigapipe.mdx index 481426545..fb9f9d203 100644 --- a/docs/backends/gigapipe.mdx +++ b/docs/backends/gigapipe.mdx @@ -51,29 +51,31 @@ kubectl apply -f destination.yaml apiVersion: odigos.io/v1alpha1 kind: Destination metadata: - name: gigapipe-example + name: qryn-example namespace: odigos-system spec: data: - QRYN_URL: API Url - QRYN_API_KEY: API Key from Gigapipe - QRYN_RESOURCE_TO_TELEMETRY_CONVERSION: "Yes" if you want to see container attrs in the prometheus metrics - QRYN_ADD_EXPORTER_NAME: "Yes" if you want to see special label {"qryn_exporter": "odigos-qryn-traces/metrics/logs"} - destinationName: gigapipe + QRYN_API_KEY: + # QRYN_RESOURCE_TO_TELEMETRY_CONVERSION: + # QRYN_ADD_EXPORTER_NAME: + # Note: The commented fields above are optional. + QRYN_URL: + destinationName: qryn secretRef: - name: gigapipe-secret + name: qryn-secret signals: - TRACES - METRICS - LOGS - type: gigapipe + type: qryn + --- apiVersion: v1 data: - QRYN_API_SECRET: base64 API Secret + QRYN_API_SECRET: kind: Secret metadata: - name: gigapipe-secret + name: qryn-secret namespace: odigos-system type: Opaque ``` diff --git a/docs/backends/qryn.mdx b/docs/backends/qryn.mdx index 3176b7ab0..1a7a31080 100644 --- a/docs/backends/qryn.mdx +++ b/docs/backends/qryn.mdx @@ -43,29 +43,34 @@ kubectl apply -f destination.yaml apiVersion: odigos.io/v1alpha1 kind: Destination metadata: - name: qryn-example + name: qryn-oss-example namespace: odigos-system spec: data: - QRYN_OSS_URL: API Url - QRYN_OSS_USERNAME: Basic Auth Username - QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION: "Yes" if you want to see container attrs in the prometheus metrics - QRYN_OSS_ADD_EXPORTER_NAME: "Yes" if you want to see special label {"qryn_exporter": "odigos-qryn-traces/metrics/logs"} - destinationName: gigapipe - secretRef: - name: gigapipe-secret + QRYN_OSS_URL: + # QRYN_OSS_USERNAME: + # 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. + # secretRef: + # name: qryn-oss-secret + signals: - TRACES - METRICS - LOGS - type: gigapipe + type: qryn-oss + --- -apiVersion: v1 -data: - QRYN_OSS_PASSWORD: base64 Basic Auth password -kind: Secret -metadata: - name: qryn-secret - namespace: odigos-system -type: Opaque +# The following Secret is optional. Uncomment the entire block if you need to use it. +# apiVersion: v1 +# data: +# QRYN_OSS_PASSWORD: +# kind: Secret +# metadata: +# name: qryn-oss-secret +# namespace: odigos-system +# type: Opaque ```