Skip to content

Commit

Permalink
feat: default the telemetry url
Browse files Browse the repository at this point in the history
  • Loading branch information
praveen-influx committed Dec 13, 2024
1 parent a043433 commit b615ffd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
16 changes: 5 additions & 11 deletions influxdb3/src/commands/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ pub const DEFAULT_DATA_DIRECTORY_NAME: &str = ".influxdb3";
/// The default bind address for the HTTP API.
pub const DEFAULT_HTTP_BIND_ADDR: &str = "0.0.0.0:8181";

pub const DEFAULT_TELMETRY_ENDPOINT: &str =
"https://brs5g5kad1.execute-api.us-east-1.amazonaws.com/v1/";

#[derive(Debug, Error)]
pub enum Error {
#[error("Cannot parse object store config: {0}")]
Expand Down Expand Up @@ -271,15 +274,6 @@ pub struct Config {
)]
pub disable_parquet_mem_cache: bool,

/// telemetry server endpoint
#[clap(
long = "telemetry-endpoint",
env = "INFLUXDB3_TELEMETRY_ENDPOINT",
default_value = "http://127.0.0.1:9999",
action
)]
pub telemetry_endpoint: String,

/// The interval on which to evict expired entries from the Last-N-Value cache, expressed as a
/// human-readable time, e.g., "20s", "1m", "1h".
#[clap(
Expand Down Expand Up @@ -501,7 +495,7 @@ pub async fn command(config: Config) -> Result<()> {
catalog.instance_id(),
num_cpus,
Some(Arc::clone(&write_buffer_impl.persisted_files())),
config.telemetry_endpoint,
DEFAULT_TELMETRY_ENDPOINT,
)
.await;

Expand Down Expand Up @@ -554,7 +548,7 @@ async fn setup_telemetry_store(
instance_id: Arc<str>,
num_cpus: usize,
persisted_files: Option<Arc<PersistedFiles>>,
telemetry_endpoint: String,
telemetry_endpoint: &'static str,
) -> Arc<TelemetryStore> {
let os = std::env::consts::OS;
let influxdb_pkg_version = env!("CARGO_PKG_VERSION");
Expand Down
6 changes: 3 additions & 3 deletions influxdb3_telemetry/src/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl TelemetrySender {
Self {
client,
full_url: base_url
.join("./v3")
.join("./telemetry")
.expect("Cannot set the telemetry request path"),
}
}
Expand Down Expand Up @@ -82,7 +82,7 @@ pub(crate) struct TelemetryPayload {
/// This function runs in the background and if any call fails
/// there is no retrying mechanism and it is ok to lose a few samples
pub(crate) async fn send_telemetry_in_background(
full_url: String,
full_url: &'static str,
store: Arc<TelemetryStore>,
duration_secs: Duration,
) -> tokio::task::JoinHandle<()> {
Expand Down Expand Up @@ -123,7 +123,7 @@ mod tests {
let client = reqwest::Client::new();
let mut mock_server = Server::new_async().await;
let mut sender = TelemetrySender::new(client, mock_server.url());
let mock = mock_server.mock("POST", "/v3").create_async().await;
let mock = mock_server.mock("POST", "/telemetry").create_async().await;
let telem_payload = create_sample_payload();

let result = sender.try_sending(&telem_payload).await;
Expand Down
4 changes: 2 additions & 2 deletions influxdb3_telemetry/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl TelemetryStore {
storage_type: Arc<str>,
cores: usize,
persisted_files: Option<Arc<dyn ParquetMetrics>>,
telemetry_endpoint: String,
telemetry_endpoint: &'static str,
) -> Arc<Self> {
debug!(
instance_id = ?instance_id,
Expand Down Expand Up @@ -308,7 +308,7 @@ mod tests {
Arc::from("Memory"),
10,
Some(parqet_file_metrics),
"http://localhost/telemetry".to_owned(),
"http://localhost/telemetry",
)
.await;
// check snapshot
Expand Down

0 comments on commit b615ffd

Please sign in to comment.