Skip to content

Commit b261c67

Browse files
committed
feat(iac): Enable flag for teeing otel-collector metrics to otel-router
1 parent 02074d4 commit b261c67

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
@@ -45,6 +45,8 @@ tf_vars := AWS_PROFILE=$(AWS_PROFILE) AWS_REGION=$(AWS_REGION) \
4545
$(call tfvar, AWS_REGION) \
4646
$(call tfvar, ENABLE_OTEL_ROUTER_LOGS) \
4747
$(call tfvar, OTEL_ROUTER_HTTP_PORT) \
48+
$(call tfvar, ENABLE_OTEL_ROUTER_METRICS) \
49+
$(call tfvar, OTEL_ROUTER_GRPC_PORT) \
4850
$(call tfvar, DB_MAX_OPEN_CONNECTIONS) \
4951
$(call tfvar, DB_MIN_IDLE_CONNECTIONS) \
5052
$(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
@@ -233,6 +233,9 @@ module "nomad" {
233233
enable_otel_router_logs = var.enable_otel_router_logs
234234
otel_router_http_port = var.otel_router_http_port
235235

236+
enable_otel_router_metrics = var.enable_otel_router_metrics
237+
otel_router_grpc_port = var.otel_router_grpc_port
238+
236239
db_max_open_connections = var.db_max_open_connections
237240
db_min_idle_connections = var.db_min_idle_connections
238241
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
@@ -309,6 +309,18 @@ variable "otel_router_http_port" {
309309
description = "Local otel-router Vector-compatible logs port used by Vector when otel-router log teeing is enabled."
310310
}
311311

312+
variable "enable_otel_router_metrics" {
313+
type = bool
314+
default = false
315+
description = "Enable teeing external customer metrics from otel-collector to otel-router."
316+
}
317+
318+
variable "otel_router_grpc_port" {
319+
type = number
320+
default = 4320
321+
description = "Local otel-router OTLP gRPC port used by otel-collector when otel-router metric teeing is enabled."
322+
}
323+
312324
# Feature flags
313325
variable "launch_darkly_api_key" {
314326
type = string

iac/provider-aws/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,15 @@ variable "otel_router_http_port" {
204204
default = 4321
205205
description = "Local otel-router Vector-compatible logs port used by Vector when otel-router log teeing is enabled."
206206
}
207+
208+
variable "enable_otel_router_metrics" {
209+
type = bool
210+
default = false
211+
description = "Enable teeing external customer metrics from otel-collector to otel-router."
212+
}
213+
214+
variable "otel_router_grpc_port" {
215+
type = number
216+
default = 4320
217+
description = "Local otel-router OTLP gRPC port used by otel-collector when otel-router metric teeing is enabled."
218+
}

iac/provider-gcp/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ tf_vars := \
6161
$(call tfvar, OTEL_COLLECTOR_RESOURCES_MEMORY_MB) \
6262
$(call tfvar, ENABLE_OTEL_ROUTER_LOGS) \
6363
$(call tfvar, OTEL_ROUTER_HTTP_PORT) \
64+
$(call tfvar, ENABLE_OTEL_ROUTER_METRICS) \
65+
$(call tfvar, OTEL_ROUTER_GRPC_PORT) \
6466
$(call tfvar, TEMPLATE_BUCKET_NAME) \
6567
$(call tfvar, TEMPLATE_BUCKET_LOCATION) \
6668
$(call tfvar, ENVD_TIMEOUT) \

iac/provider-gcp/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ module "nomad" {
287287
otel_collector_resources_cpu_count = var.otel_collector_resources_cpu_count
288288
enable_otel_router_logs = var.enable_otel_router_logs
289289
otel_router_http_port = var.otel_router_http_port
290+
enable_otel_router_metrics = var.enable_otel_router_metrics
291+
otel_router_grpc_port = var.otel_router_grpc_port
290292

291293
# Dashboard API
292294
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)