Skip to content

Commit

Permalink
update tests for changed config
Browse files Browse the repository at this point in the history
Signed-off-by: Kristof Gyuracz <[email protected]>
  • Loading branch information
kristofgyuracz committed Apr 16, 2024
1 parent deace61 commit 85d96c8
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,49 @@ exporters:
endpoint: receiver-collector.example-tenant-ns.svc.cluster.local:4317
tls:
insecure: true
prometheus/message_metrics_exporter:
endpoint: 0.0.0.0:9999

processors:
attributes/exporter_name_loki-test-output:
actions:
- action: insert
key: exporter
value: loki/collector_loki-test-output
attributes/exporter_name_otlp-test-output:
actions:
- action: insert
key: exporter
value: otlp/collector_otlp-test-output
attributes/exporter_name_otlp-test-output-2:
actions:
- action: insert
key: exporter
value: otlp/collector_otlp-test-output-2
attributes/loki_exporter_loki-test-output:
actions:
- action: insert
key: loki.tenant
from_attribute: tenant_name
from_attribute: tenant
- action: insert
key: loki.attribute.labels
value: tenant_name
value: tenant
attributes/subscription_subscription-example-1:
actions:
- action: insert
key: subscription_name
key: subscription
value: subscription-example-1
attributes/subscription_subscription-example-2:
actions:
- action: insert
key: subscription_name
key: subscription
value: subscription-example-2
attributes/tenant_example-tenant:
actions:
- action: insert
key: tenant_name
key: tenant
value: example-tenant
deltatocumulative: {}
k8sattributes:
auth_type: serviceAccount
extract:
Expand Down Expand Up @@ -121,6 +140,24 @@ processors:
key: loki.resource.labels
value: k8s.pod.name, k8s.namespace.name
connectors:
count/output_metrics:
logs:
otelcollector_output_log_count:
description: The number of logs sent out from each exporter.
attributes:
- key: tenant
default_value: no_tenant
- key: subscription
default_value: no_subscription
- key: exporter
default_value: no_exporter
count/tenant_metrics:
logs:
otelcollector_tenant_log_count:
description: The number of logs from each tenant pipeline.
attributes:
- key: tenant
default_value: no_tenant
routing/subscription_example-tenant-ns_subscription-example-1_outputs:
table:
- statement: route()
Expand All @@ -147,18 +184,20 @@ service:
exporters: [routing/tenants]
logs/output_example-tenant-ns_subscription-example-1_collector_loki-test-output:
receivers: [routing/subscription_example-tenant-ns_subscription-example-1_outputs]
processors: [attributes/loki_exporter_loki-test-output, resource/loki_exporter_loki-test-output]
exporters: [loki/collector_loki-test-output]
processors: [attributes/exporter_name_loki-test-output, attributes/loki_exporter_loki-test-output, resource/loki_exporter_loki-test-output]
exporters: [loki/collector_loki-test-output, count/output_metrics]
logs/output_example-tenant-ns_subscription-example-1_collector_otlp-test-output:
receivers: [routing/subscription_example-tenant-ns_subscription-example-1_outputs]
exporters: [otlp/collector_otlp-test-output]
processors: [attributes/exporter_name_otlp-test-output]
exporters: [otlp/collector_otlp-test-output, count/output_metrics]
logs/output_example-tenant-ns_subscription-example-2_collector_otlp-test-output-2:
receivers: [routing/subscription_example-tenant-ns_subscription-example-2_outputs]
exporters: [otlp/collector_otlp-test-output-2]
processors: [attributes/exporter_name_otlp-test-output-2]
exporters: [otlp/collector_otlp-test-output-2, count/output_metrics]
logs/tenant_example-tenant:
receivers: [routing/tenants]
processors: [attributes/tenant_example-tenant]
exporters: [routing/tenant_example-tenant_subscriptions]
exporters: [routing/tenant_example-tenant_subscriptions, count/tenant_metrics]
logs/tenant_example-tenant_subscription_example-tenant-ns_subscription-example-1:
receivers: [routing/tenant_example-tenant_subscriptions]
processors: [attributes/subscription_subscription-example-1]
Expand All @@ -167,3 +206,11 @@ service:
receivers: [routing/tenant_example-tenant_subscriptions]
processors: [attributes/subscription_subscription-example-2]
exporters: [routing/subscription_example-tenant-ns_subscription-example-2_outputs]
metrics/output:
receivers: [count/output_metrics]
processors: [deltatocumulative]
exporters: [prometheus/message_metrics_exporter]
metrics/tenant:
receivers: [count/tenant_metrics]
processors: [deltatocumulative]
exporters: [prometheus/message_metrics_exporter]
19 changes: 9 additions & 10 deletions internal/controller/telemetry/otel_conf_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

"go.opentelemetry.io/collector/config/configauth"
"go.opentelemetry.io/collector/config/configopaque"
"go.opentelemetry.io/collector/config/configtls"
"golang.org/x/exp/maps"
"gopkg.in/yaml.v3"
"sigs.k8s.io/controller-runtime/pkg/log"
Expand Down Expand Up @@ -112,27 +111,27 @@ type PrometheusExporterConfig struct {

type HTTPServerConfig struct {
// Endpoint configures the listening address for the server.
Endpoint string `yaml:"endpoint"`
Endpoint string `yaml:"endpoint,omitempty"`

// TLSSetting struct exposes TLS client configuration.
TLSSetting *configtls.ServerConfig `yaml:"tls"`
TLSSetting *TLSServerConfig `yaml:"tls,omitempty"`

// CORS configures the server for HTTP cross-origin resource sharing (CORS).
CORS *CORSConfig `yaml:"cors"`
CORS *CORSConfig `yaml:"cors,omitempty"`

// Auth for this receiver
Auth *configauth.Authentication `yaml:"auth"`
Auth *configauth.Authentication `yaml:"auth,omitempty"`

// MaxRequestBodySize sets the maximum request body size in bytes
MaxRequestBodySize int64 `yaml:"max_request_body_size"`
MaxRequestBodySize int64 `yaml:"max_request_body_size,omitempty"`

// IncludeMetadata propagates the client metadata from the incoming requests to the downstream consumers
// Experimental: *NOTE* this option is subject to change or removal in the future.
IncludeMetadata bool `yaml:"include_metadata"`
IncludeMetadata bool `yaml:"include_metadata,omitempty"`

// Additional headers attached to each HTTP response sent to the client.
// Header values are opaque since they may be sensitive.
ResponseHeaders map[string]configopaque.String `yaml:"response_headers"`
ResponseHeaders map[string]configopaque.String `yaml:"response_headers,omitempty"`
}

type TLSServerConfig struct {
Expand Down Expand Up @@ -422,7 +421,7 @@ func generateCountConnectors() map[string]any {
countConnectors["count/tenant_metrics"] = map[string]any{
"logs": map[string]CountConnectorMetricInfo{
"otelcollector_tenant_log_count": {
Description: "The number of logs from each environment.",
Description: "The number of logs from each tenant pipeline.",
Attributes: []CountConnectorAttributeConfig{{
Key: "tenant",
DefaultValue: "no_tenant",
Expand All @@ -434,7 +433,7 @@ func generateCountConnectors() map[string]any {
countConnectors["count/output_metrics"] = map[string]any{
"logs": map[string]CountConnectorMetricInfo{
"otelcollector_output_log_count": {
Description: "The number of logs from each environment.",
Description: "The number of logs sent out from each exporter.",
Attributes: []CountConnectorAttributeConfig{{
Key: "tenant",
DefaultValue: "no_tenant",
Expand Down

0 comments on commit 85d96c8

Please sign in to comment.