Skip to content

Commit

Permalink
yaml rename; url parse update; docs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
akvlad committed Oct 17, 2024
1 parent a64b679 commit 1e62751
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 65 deletions.
18 changes: 14 additions & 4 deletions common/config/qryn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package config
import (
"errors"
"fmt"
"math/rand"
"net/url"
"strings"

"github.com/odigos-io/odigos/common"
)
Expand Down Expand Up @@ -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,
Expand Down
34 changes: 18 additions & 16 deletions destinations/data/qrynoss.yaml → destinations/data/gigapipe.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
34 changes: 16 additions & 18 deletions destinations/data/qryn.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
22 changes: 12 additions & 10 deletions docs/backends/gigapipe.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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: <API Key>
# QRYN_RESOURCE_TO_TELEMETRY_CONVERSION: <Convert container attributes to labels [Yes, No]>
# QRYN_ADD_EXPORTER_NAME: <Add exporter name to labels [Yes, No]>
# Note: The commented fields above are optional.
QRYN_URL: <API 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: <base64 API Secret>
kind: Secret
metadata:
name: gigapipe-secret
name: qryn-secret
namespace: odigos-system
type: Opaque
```
39 changes: 22 additions & 17 deletions docs/backends/qryn.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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: <API Url>
# QRYN_OSS_USERNAME: <Basic auth username>
# QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION: <Convert container attributes to labels [Yes, No]>
# QRYN_OSS_ADD_EXPORTER_NAME: <Add exporter name to labels [Yes, No]>
# 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: <base64 Basic auth password>
# kind: Secret
# metadata:
# name: qryn-oss-secret
# namespace: odigos-system
# type: Opaque
```

0 comments on commit 1e62751

Please sign in to comment.