forked from vectordotdev/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.rs
More file actions
27 lines (23 loc) · 822 Bytes
/
api.rs
File metadata and controls
27 lines (23 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use std::net::SocketAddr;
use metrics::counter;
use vector_lib::NamedInternalEvent;
use vector_lib::internal_event::InternalEvent;
#[derive(Debug, NamedInternalEvent)]
pub struct ApiStarted {
pub addr: SocketAddr,
pub playground: bool,
pub graphql: bool,
}
impl InternalEvent for ApiStarted {
fn emit(self) {
let playground = &*format!("http://{}:{}/playground", self.addr.ip(), self.addr.port());
let graphql = &*format!("http://{}:{}/graphql", self.addr.ip(), self.addr.port());
info!(
message="API server running.",
address = ?self.addr,
playground = %if self.playground { playground } else { "off" },
graphql = %if self.graphql { graphql } else { "off" }
);
counter!("api_started_total").increment(1);
}
}