@@ -94,6 +94,7 @@ use edgezero_core::http::{
9494use edgezero_core:: router:: RouterService ;
9595use error_stack:: Report ;
9696use trusted_server_core:: auction:: endpoints:: handle_auction;
97+ use trusted_server_core:: auction:: AuctionTelemetrySink ;
9798use trusted_server_core:: auction:: { build_orchestrator, AuctionOrchestrator } ;
9899use trusted_server_core:: constants:: { COOKIE_SHAREDID , COOKIE_TS_EIDS } ;
99100use trusted_server_core:: ec:: batch_sync:: handle_batch_sync;
@@ -147,6 +148,7 @@ pub(crate) struct AppState {
147148 pub ( crate ) orchestrator : Arc < AuctionOrchestrator > ,
148149 pub ( crate ) registry : Arc < IntegrationRegistry > ,
149150 pub ( crate ) default_kv_store : Arc < dyn PlatformKvStore > ,
151+ pub ( crate ) auction_telemetry_sink : Arc < dyn AuctionTelemetrySink > ,
150152}
151153
152154/// Build the application state, loading settings and constructing all per-application components.
@@ -173,13 +175,15 @@ pub(crate) fn build_state_from_settings(
173175 let orchestrator = build_orchestrator ( & settings) ?;
174176 let registry = IntegrationRegistry :: new ( & settings) ?;
175177
178+ let auction_telemetry_sink = crate :: tinybird:: auction_sink_from_settings ( & settings) ;
176179 let default_kv_store = Arc :: new ( UnavailableKvStore ) as Arc < dyn PlatformKvStore > ;
177180
178181 Ok ( Arc :: new ( AppState {
179182 settings : Arc :: new ( settings) ,
180183 orchestrator : Arc :: new ( orchestrator) ,
181184 registry : Arc :: new ( registry) ,
182185 default_kv_store,
186+ auction_telemetry_sink,
183187 } ) )
184188}
185189
@@ -254,6 +258,7 @@ fn build_per_request_services(state: &AppState, ctx: &RequestContext) -> Runtime
254258 . backend ( Arc :: new ( FastlyPlatformBackend ) )
255259 . http_client ( Arc :: new ( FastlyPlatformHttpClient ) )
256260 . geo ( Arc :: new ( FastlyPlatformGeo ) )
261+ . auction_telemetry_sink ( Arc :: clone ( & state. auction_telemetry_sink ) )
257262 . client_info ( client_info)
258263 . build ( )
259264}
@@ -1352,6 +1357,9 @@ mod tests {
13521357 let default_kv_store =
13531358 Arc :: new ( crate :: platform:: UnavailableKvStore ) as Arc < dyn super :: PlatformKvStore > ;
13541359 let state = Arc :: new ( super :: AppState {
1360+ auction_telemetry_sink : Arc :: new (
1361+ trusted_server_core:: auction:: NoopAuctionTelemetrySink ,
1362+ ) ,
13551363 settings : Arc :: new ( settings) ,
13561364 orchestrator : Arc :: new ( orchestrator) ,
13571365 registry : Arc :: new ( registry) ,
0 commit comments