@@ -82,15 +82,6 @@ defmodule Electric.Application do
8282
8383 slot_name = Keyword . get ( opts , :slot_name , "electric_slot_#{ replication_stream_id } " )
8484
85- telemetry_opts = [
86- instance_id: Electric . instance_id ( ) ,
87- system_metrics_poll_interval: Electric.Config . get_env ( :system_metrics_poll_interval ) ,
88- statsd_host: Electric.Config . get_env ( :telemetry_statsd_host ) ,
89- prometheus?: not is_nil ( Electric.Config . get_env ( :prometheus_port ) ) ,
90- call_home_telemetry?: Electric.Config . get_env ( :call_home_telemetry? ) ,
91- otel_metrics?: not is_nil ( Application . get_env ( :otel_metric_exporter , :otlp_endpoint ) )
92- ]
93-
9485 Keyword . merge (
9586 core_configuration ( opts ) ,
9687 connection_opts: get_env! ( opts , :connection_opts ) ,
@@ -101,7 +92,7 @@ defmodule Electric.Application do
10192 ] ,
10293 pool_opts: [ pool_size: get_env ( opts , :db_pool_size ) ] ,
10394 chunk_bytes_threshold: get_env ( opts , :chunk_bytes_threshold ) ,
104- telemetry_opts: telemetry_opts
95+ telemetry_opts: telemetry_opts ( opts )
10596 )
10697 end
10798
@@ -170,7 +161,7 @@ defmodule Electric.Application do
170161
171162 defp application_telemetry do
172163 if Code . ensure_loaded? ( Electric.Telemetry.ApplicationTelemetry ) do
173- [ { Electric.Telemetry.ApplicationTelemetry , [ ] } ]
164+ [ { Electric.Telemetry.ApplicationTelemetry , telemetry_opts ( ) } ]
174165 else
175166 [ ]
176167 end
@@ -211,4 +202,15 @@ defmodule Electric.Application do
211202 [ ]
212203 end
213204 end
205+
206+ defp telemetry_opts ( opts \\ [ ] ) do
207+ [
208+ instance_id: Electric . instance_id ( ) ,
209+ system_metrics_poll_interval: get_env ( opts , :system_metrics_poll_interval ) ,
210+ statsd_host: get_env ( opts , :telemetry_statsd_host ) ,
211+ prometheus?: not is_nil ( get_env ( opts , :prometheus_port ) ) ,
212+ call_home_telemetry?: get_env ( opts , :call_home_telemetry? ) ,
213+ otel_metrics?: not is_nil ( Application . get_env ( :otel_metric_exporter , :otlp_endpoint ) )
214+ ]
215+ end
214216end
0 commit comments