vector/internal_events/
api.rs

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