Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
Adds OLTP proxy support (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmichael authored Nov 28, 2022
1 parent 64a957a commit 216d590
Showing 7 changed files with 106 additions and 0 deletions.
14 changes: 14 additions & 0 deletions api/v1alpha1/wavefront_types.go
Original file line number Diff line number Diff line change
@@ -145,6 +145,9 @@ type WavefrontProxy struct {
// Distributed tracing configuration
Tracing Tracing `json:"tracing,omitempty"`

// OpenTelemetry Protocol configuration
OLTP OLTP `json:"oltp,omitempty"`

// Histogram distribution configuration
Histogram Histogram `json:"histogram,omitempty"`

@@ -250,6 +253,17 @@ type HttpProxy struct {
UseHttpProxyCAcert bool `json:"-"`
}

type OLTP struct {
// GrpcPort for OLTP GRPC format data (usually 4317)
GrpcPort int `json:"grpcPort,omitempty"`

// HttpPort for OLTP format data (usually 4318)
HttpPort int `json:"httpPort,omitempty"`

// Enable resource attributes on metrics to be included. Defaults to false.
ResourceAttrsOnMetricsIncluded bool `json:"resourceAttrsOnMetricsIncluded,omitempty"`
}

type Resource struct {
// CPU is for specifying CPU requirements
// +kubebuilder:validation:Pattern:=`^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$`
16 changes: 16 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions config/crd/bases/wavefront.com_wavefronts.yaml
Original file line number Diff line number Diff line change
@@ -398,6 +398,21 @@ spec:
description: MetricPort is the primary port for Wavefront
data format metrics. Defaults to 2878.
type: integer
oltp:
description: OpenTelemetry Protocol configuration
properties:
grpcPort:
description: GrpcPort for OLTP GRPC format data (usually
4317)
type: integer
httpPort:
description: HttpPort for OLTP format data (usually 4318)
type: integer
resourceAttrsOnMetricsIncluded:
description: Enable resource attributes on metrics to
be included. Defaults to false.
type: boolean
type: object
preprocessor:
description: Preprocessor is the name of the configmap containing
a rules.yaml key with proxy preprocessing rules
21 changes: 21 additions & 0 deletions controllers/wavefront_controller_test.go
Original file line number Diff line number Diff line change
@@ -552,6 +552,27 @@ func TestReconcileProxy(t *testing.T) {
containsProxyArg(t, "--traceZipkinApplicationName zipkin", *mockKM)
})

t.Run("can create proxy with OLTP enabled", func(t *testing.T) {
r, mockKM := emptyScenario(wftest.CR(func(w *wf.Wavefront) {
w.Spec.DataExport.WavefrontProxy.OLTP = wf.OLTP{
GrpcPort: 4317,
HttpPort: 4318,
ResourceAttrsOnMetricsIncluded: true,
}
}))

_, err := r.Reconcile(context.Background(), defaultRequest())
require.NoError(t, err)

containsPortInContainers(t, "otlpGrpcListenerPorts", *mockKM, 4317)
containsPortInServicePort(t, 4317, *mockKM)

containsPortInContainers(t, "otlpHttpListenerPorts", *mockKM, 4318)
containsPortInServicePort(t, 4318, *mockKM)

containsProxyArg(t, "--otlpResourceAttrsOnMetricsIncluded true", *mockKM)
})

t.Run("can create proxy with histogram ports enabled", func(t *testing.T) {
r, mockKM := emptyScenario(wftest.CR(func(w *wf.Wavefront) {
w.Spec.DataExport.WavefrontProxy.Histogram.Port = 40000
10 changes: 10 additions & 0 deletions deploy/internal/proxy/0-wavefront-proxy-service.yaml
Original file line number Diff line number Diff line change
@@ -66,6 +66,16 @@ spec:
port: {{ .DataExport.WavefrontProxy.Histogram.DayPort }}
protocol: TCP
{{end}}
{{if .DataExport.WavefrontProxy.OLTP.GrpcPort}}
- name: oltp-grpc
port: {{ .DataExport.WavefrontProxy.OLTP.GrpcPort }}
protocol: TCP
{{end}}
{{if .DataExport.WavefrontProxy.OLTP.HttpPort}}
- name: oltp-http
port: {{ .DataExport.WavefrontProxy.OLTP.HttpPort }}
protocol: TCP
{{end}}
selector:
app.kubernetes.io/name : wavefront
app.kubernetes.io/component: proxy
11 changes: 11 additions & 0 deletions deploy/internal/proxy/1-wavefront-proxy-deployment.yaml
Original file line number Diff line number Diff line change
@@ -65,6 +65,9 @@ spec:
{{- if .DataExport.WavefrontProxy.Histogram.MinutePort }} --histogramMinuteListenerPorts {{ .DataExport.WavefrontProxy.Histogram.MinutePort }} {{- end -}}
{{- if .DataExport.WavefrontProxy.Histogram.HourPort }} --histogramHourListenerPorts {{ .DataExport.WavefrontProxy.Histogram.HourPort }} {{- end -}}
{{- if .DataExport.WavefrontProxy.Histogram.DayPort }} --histogramDayListenerPorts {{ .DataExport.WavefrontProxy.Histogram.DayPort }} {{- end -}}
{{- if .DataExport.WavefrontProxy.OLTP.GrpcPort}} --otlpGrpcListenerPorts {{ .DataExport.WavefrontProxy.OLTP.GrpcPort }} {{- end -}}
{{- if .DataExport.WavefrontProxy.OLTP.HttpPort}} --otlpHttpListenerPorts {{ .DataExport.WavefrontProxy.OLTP.HttpPort }} {{- end -}}
{{- if .DataExport.WavefrontProxy.OLTP.ResourceAttrsOnMetricsIncluded}} --otlpResourceAttrsOnMetricsIncluded true {{- end -}}
{{- if .DataExport.WavefrontProxy.Preprocessor }} --preprocessorConfigFile /etc/wavefront/preprocessor/rules.yaml {{- end -}}
{{- if .DataExport.WavefrontProxy.HttpProxy.HttpProxyHost }} --proxyHost {{ .DataExport.WavefrontProxy.HttpProxy.HttpProxyHost }} {{- end -}}
{{- if .DataExport.WavefrontProxy.HttpProxy.HttpProxyPort }} --proxyPort {{ .DataExport.WavefrontProxy.HttpProxy.HttpProxyPort }} {{- end -}}
@@ -115,6 +118,14 @@ spec:
- containerPort: {{ .DataExport.WavefrontProxy.Histogram.DayPort }}
protocol: TCP
{{- end }}
{{- if .DataExport.WavefrontProxy.OLTP.GrpcPort}}
- containerPort: {{ .DataExport.WavefrontProxy.OLTP.GrpcPort }}
protocol: TCP
{{- end }}
{{- if .DataExport.WavefrontProxy.OLTP.HttpPort}}
- containerPort: {{ .DataExport.WavefrontProxy.OLTP.HttpPort }}
protocol: TCP
{{- end }}
readinessProbe:
timeoutSeconds: 10
failureThreshold: 10
19 changes: 19 additions & 0 deletions deploy/kubernetes/scenarios/wavefront-proxy-oltp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Need to change YOUR_CLUSTER_NAME and YOUR_WAVEFRONT_URL accordingly
apiVersion: wavefront.com/v1alpha1
kind: Wavefront
metadata:
name: wavefront
namespace: observability-system
spec:
clusterName: YOUR_CLUSTER_NAME
wavefrontUrl: YOUR_WAVEFRONT_URL
dataCollection:
metrics:
enable: true
dataExport:
wavefrontProxy:
enable: true
oltp:
grpcPort: 4317
httpPort: 4318
resourceAttrsOnMetricsIncluded: true

0 comments on commit 216d590

Please sign in to comment.