Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add additional traffic metric labels #67

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/controller/telemetry/collector_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (r *CollectorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
UpgradeStrategy: "none",
Config: otelConfig,
Mode: otelv1alpha1.ModeDaemonSet,
Image: "ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:0.97.0-axoflow2",
Image: "ghcr.io/axoflow/axoflow-otel-collector/axoflow-otel-collector:0.98.0-axoflow-1",
ServiceAccount: saName.Name,
VolumeMounts: []corev1.VolumeMount{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,30 @@ processors:
connectors:
count/output_metrics:
logs:
otelcollector_output_log_count:
telemetry_controller_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
resource_attributes:
- key: k8s.namespace.name
- key: k8s.node.name
kristofgyuracz marked this conversation as resolved.
Show resolved Hide resolved
- key: k8s.container.name
- key: k8s.pod.name
- key: k8s.pod.labels.app.kubernetes.io/name
count/tenant_metrics:
logs:
otelcollector_tenant_log_count:
telemetry_controller_tenant_log_count:
description: The number of logs from each tenant pipeline.
attributes:
- key: tenant
default_value: no_tenant
resource_attributes:
- key: k8s.namespace.name
- key: k8s.node.name
- key: k8s.container.name
- key: k8s.pod.name
- key: k8s.pod.labels.app.kubernetes.io/name
routing/subscription_example-tenant-ns_subscription-example-1_outputs:
table:
- statement: route()
Expand Down
66 changes: 49 additions & 17 deletions internal/controller/telemetry/otel_conf_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ type CountConnectorAttributeConfig struct {
}

type CountConnectorMetricInfo struct {
Description string `yaml:"description,omitempty"`
Conditions []string `yaml:"conditions,omitempty"`
Attributes []CountConnectorAttributeConfig `yaml:"attributes,omitempty"`
Description string `yaml:"description,omitempty"`
Conditions []string `yaml:"conditions,omitempty"`
Attributes []CountConnectorAttributeConfig `yaml:"attributes,omitempty"`
ResourceAttributes []CountConnectorAttributeConfig `yaml:"resource_attributes,omitempty"`
}

type DeltatoCumulativeConfig struct {
Expand Down Expand Up @@ -441,30 +442,61 @@ func generateCountConnectors() map[string]any {

countConnectors["count/tenant_metrics"] = map[string]any{
"logs": map[string]CountConnectorMetricInfo{
"otelcollector_tenant_log_count": {
"telemetry_controller_tenant_log_count": {
Description: "The number of logs from each tenant pipeline.",
Attributes: []CountConnectorAttributeConfig{{
Key: "tenant",
DefaultValue: "no_tenant",
Key: "tenant",
}},
ResourceAttributes: []CountConnectorAttributeConfig{
{
Key: "k8s.namespace.name",
},
{
Key: "k8s.node.name",
},
{
Key: "k8s.container.name",
},
{
Key: "k8s.pod.name",
},
{
Key: "k8s.pod.labels.app.kubernetes.io/name",
},
},
},
},
}

countConnectors["count/output_metrics"] = map[string]any{
"logs": map[string]CountConnectorMetricInfo{
"otelcollector_output_log_count": {
"telemetry_controller_output_log_count": {
Description: "The number of logs sent out from each exporter.",
Attributes: []CountConnectorAttributeConfig{{
Key: "tenant",
DefaultValue: "no_tenant",
}, {
Key: "subscription",
DefaultValue: "no_subscription",
}, {
Key: "exporter",
DefaultValue: "no_exporter",
}},
Attributes: []CountConnectorAttributeConfig{
{
Key: "tenant",
}, {
Key: "subscription",
}, {
Key: "exporter",
}},
ResourceAttributes: []CountConnectorAttributeConfig{
{
Key: "k8s.namespace.name",
},
{
Key: "k8s.node.name",
},
{
Key: "k8s.container.name",
},
{
Key: "k8s.pod.name",
},
{
Key: "k8s.pod.labels.app.kubernetes.io/name",
},
},
},
},
}
Expand Down
Loading