vector/internal_events/
api.rs

1use std::net::SocketAddr;
2
3use metrics::counter;
4use vector_lib::internal_event::InternalEvent;
5
6#[derive(Debug)]
7pub struct ApiStarted {
8    pub addr: SocketAddr,
9    pub playground: bool,
10    pub graphql: bool,
11}
12
13impl InternalEvent for ApiStarted {
14    fn emit(self) {
15        let playground = &*format!("http://{}:{}/playground", self.addr.ip(), self.addr.port());
16        let graphql = &*format!("http://{}:{}/graphql", self.addr.ip(), self.addr.port());
17        info!(
18            message="API server running.",
19            address = ?self.addr,
20            playground = %if self.playground { playground } else { "off" },
21            graphql = %if self.graphql { graphql } else { "off" }
22
23        );
24        counter!("api_started_total").increment(1);
25    }
26}