Skip to content

Commit ed716fe

Browse files
committed
feat(iac): Enable flag for teeing otel-collector metrics to otel-router
1 parent 9d4f798 commit ed716fe

12 files changed

Lines changed: 94 additions & 0 deletions

File tree

iac/modules/job-otel-collector/configs/otel-collector.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,12 @@ exporters:
457457
name: "metrics_gauge"
458458
sum:
459459
name: "metrics_sum"
460+
%{ if enable_otel_router_metrics }
461+
otlp/otel_router:
462+
endpoint: 127.0.0.1:${otel_router_grpc_port}
463+
tls:
464+
insecure: true
465+
%{ endif }
460466
service:
461467
telemetry:
462468
logs:
@@ -524,6 +530,16 @@ service:
524530
- batch/clickhouse
525531
exporters:
526532
- clickhouse
533+
%{ if enable_otel_router_metrics }
534+
metrics/external/otel_router:
535+
receivers:
536+
- otlp
537+
processors:
538+
- filter/external_metrics
539+
- batch
540+
exporters:
541+
- otlp/otel_router
542+
%{ endif }
527543
traces:
528544
receivers:
529545
- otlp

iac/modules/job-otel-collector/main.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ locals {
1212
clickhouse_port = var.clickhouse_port
1313
clickhouse_host = var.clickhouse_host
1414
clickhouse_database = var.clickhouse_database
15+
16+
enable_otel_router_metrics = var.enable_otel_router_metrics
17+
otel_router_grpc_port = var.otel_router_grpc_port
1518
},
1619
)
1720

@@ -101,6 +104,18 @@ variable "clickhouse_database" {
101104
default = ""
102105
}
103106

107+
variable "enable_otel_router_metrics" {
108+
type = bool
109+
default = false
110+
description = "Enable teeing external customer metrics from otel-collector to otel-router."
111+
}
112+
113+
variable "otel_router_grpc_port" {
114+
type = number
115+
default = 4320
116+
description = "Local otel-router OTLP gRPC port used by otel-collector when otel-router metric teeing is enabled."
117+
}
118+
104119
variable "otel_collector_config_override" {
105120
type = string
106121
default = ""

iac/provider-aws/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ tf_vars := AWS_PROFILE=$(AWS_PROFILE) AWS_REGION=$(AWS_REGION) \
4343
$(call tfvar, BUILD_SERVER_NESTED_VIRTUALIZATION) \
4444
$(call tfvar, AWS_ACCOUNT_ID) \
4545
$(call tfvar, AWS_REGION) \
46+
$(call tfvar, ENABLE_OTEL_ROUTER_METRICS) \
47+
$(call tfvar, OTEL_ROUTER_GRPC_PORT) \
4648
$(call tfvar, DB_MAX_OPEN_CONNECTIONS) \
4749
$(call tfvar, DB_MIN_IDLE_CONNECTIONS) \
4850
$(call tfvar, AUTH_DB_MAX_OPEN_CONNECTIONS) \

iac/provider-aws/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ module "nomad" {
232232

233233
enable_otel_router_logs = var.enable_otel_router_logs
234234

235+
enable_otel_router_metrics = var.enable_otel_router_metrics
236+
otel_router_grpc_port = var.otel_router_grpc_port
237+
235238
db_max_open_connections = var.db_max_open_connections
236239
db_min_idle_connections = var.db_min_idle_connections
237240
auth_db_max_open_connections = var.auth_db_max_open_connections

iac/provider-aws/nomad/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ module "otel_collector" {
4343
grafana_username = var.grafana_username
4444
consul_token = var.consul_acl_token
4545

46+
enable_otel_router_metrics = var.enable_otel_router_metrics
47+
otel_router_grpc_port = var.otel_router_grpc_port
48+
4649
clickhouse_username = var.clickhouse_username
4750
clickhouse_password = var.clickhouse_password
4851
clickhouse_port = var.clickhouse_port

iac/provider-aws/nomad/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,18 @@ variable "enable_otel_router_logs" {
303303
description = "Enable teeing non-internal customer logs from Vector to otel-router."
304304
}
305305

306+
variable "enable_otel_router_metrics" {
307+
type = bool
308+
default = false
309+
description = "Enable teeing external customer metrics from otel-collector to otel-router."
310+
}
311+
312+
variable "otel_router_grpc_port" {
313+
type = number
314+
default = 4320
315+
description = "Local otel-router OTLP gRPC port used by otel-collector when otel-router metric teeing is enabled."
316+
}
317+
306318
# Feature flags
307319
variable "launch_darkly_api_key" {
308320
type = string

iac/provider-aws/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,15 @@ variable "enable_otel_router_logs" {
198198
default = false
199199
description = "Enable teeing non-internal customer logs from Vector to otel-router."
200200
}
201+
202+
variable "enable_otel_router_metrics" {
203+
type = bool
204+
default = false
205+
description = "Enable teeing external customer metrics from otel-collector to otel-router."
206+
}
207+
208+
variable "otel_router_grpc_port" {
209+
type = number
210+
default = 4320
211+
description = "Local otel-router OTLP gRPC port used by otel-collector when otel-router metric teeing is enabled."
212+
}

iac/provider-gcp/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ tf_vars := \
5959
$(call tfvar, LOKI_RESOURCES_MEMORY_MB) \
6060
$(call tfvar, OTEL_COLLECTOR_RESOURCES_CPU_COUNT) \
6161
$(call tfvar, OTEL_COLLECTOR_RESOURCES_MEMORY_MB) \
62+
$(call tfvar, ENABLE_OTEL_ROUTER_METRICS) \
63+
$(call tfvar, OTEL_ROUTER_GRPC_PORT) \
6264
$(call tfvar, TEMPLATE_BUCKET_NAME) \
6365
$(call tfvar, TEMPLATE_BUCKET_LOCATION) \
6466
$(call tfvar, ENVD_TIMEOUT) \

iac/provider-gcp/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ module "nomad" {
286286
otel_collector_resources_memory_mb = var.otel_collector_resources_memory_mb
287287
otel_collector_resources_cpu_count = var.otel_collector_resources_cpu_count
288288
enable_otel_router_logs = var.enable_otel_router_logs
289+
enable_otel_router_metrics = var.enable_otel_router_metrics
290+
otel_router_grpc_port = var.otel_router_grpc_port
289291

290292
# Dashboard API
291293
dashboard_api_count = var.dashboard_api_count

iac/provider-gcp/nomad/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ module "otel_collector" {
322322
grafana_username = data.google_secret_manager_secret_version.grafana_username.secret_data
323323
consul_token = var.consul_acl_token_secret
324324

325+
enable_otel_router_metrics = var.enable_otel_router_metrics
326+
otel_router_grpc_port = var.otel_router_grpc_port
327+
325328
clickhouse_username = var.clickhouse_username
326329
clickhouse_password = random_password.clickhouse_password.result
327330
clickhouse_port = var.clickhouse_server_port.port

0 commit comments

Comments
 (0)