From 5bf4ca7111ac58fc1cacffab950d2dec8ba71fdb Mon Sep 17 00:00:00 2001 From: fmassot Date: Tue, 16 Jan 2024 18:43:00 +0100 Subject: [PATCH] Add telemetry. --- quickwit/quickwit-lambda/src/indexer/ingest.rs | 7 +++++++ quickwit/quickwit-lambda/src/searcher/search.rs | 9 +++++++++ quickwit/quickwit-telemetry/src/payload.rs | 1 + 3 files changed, 17 insertions(+) diff --git a/quickwit/quickwit-lambda/src/indexer/ingest.rs b/quickwit/quickwit-lambda/src/indexer/ingest.rs index c75de49e5ab..e1a37bec90f 100644 --- a/quickwit/quickwit-lambda/src/indexer/ingest.rs +++ b/quickwit/quickwit-lambda/src/indexer/ingest.rs @@ -48,6 +48,7 @@ use quickwit_proto::indexing::CpuCapacity; use quickwit_proto::metastore::{CreateIndexRequest, MetastoreError, MetastoreService}; use quickwit_proto::types::{NodeId, PipelineUid}; use quickwit_storage::StorageResolver; +use quickwit_telemetry::payload::{QuickwitFeature, QuickwitTelemetryInfo, TelemetryEvent}; use tracing::{debug, info, instrument}; use super::environment::{CONFIGURATION_TEMPLATE, DISABLE_MERGE, INDEX_CONFIG_URI, INDEX_ID}; @@ -186,6 +187,12 @@ pub async fn ingest(args: IngestArgs) -> anyhow::Result { ..Default::default() }; let runtimes_config = RuntimesConfig::default(); + let services: HashSet = + HashSet::from_iter([QuickwitService::Indexer.as_str().to_string()]); + let telemetry_info = + QuickwitTelemetryInfo::new(services, HashSet::from_iter([QuickwitFeature::AwsLambda])); + let _telemetry_handle_opt = quickwit_telemetry::start_telemetry_loop(telemetry_info); + quickwit_telemetry::send_telemetry_event(TelemetryEvent::RunCommand).await; start_actor_runtimes( runtimes_config, &HashSet::from_iter([QuickwitService::Indexer]), diff --git a/quickwit/quickwit-lambda/src/searcher/search.rs b/quickwit/quickwit-lambda/src/searcher/search.rs index 1868c9243f2..3d0e0d249f9 100644 --- a/quickwit/quickwit-lambda/src/searcher/search.rs +++ b/quickwit/quickwit-lambda/src/searcher/search.rs @@ -17,9 +17,11 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +use std::collections::HashSet; use std::net::{Ipv4Addr, SocketAddr}; use std::sync::Arc; +use quickwit_config::service::QuickwitService; use quickwit_config::SearcherConfig; use quickwit_proto::metastore::MetastoreServiceClient; use quickwit_proto::search::{SearchRequest, SearchResponse}; @@ -29,6 +31,7 @@ use quickwit_search::{ }; use quickwit_serve::{search_request_from_api_request, SearchRequestQueryString}; use quickwit_storage::StorageResolver; +use quickwit_telemetry::payload::{QuickwitFeature, QuickwitTelemetryInfo, TelemetryEvent}; use tokio::sync::OnceCell; use tracing::debug; @@ -104,6 +107,12 @@ pub async fn search(args: SearchArgs) -> anyhow::Result { debug!(args=?args, "lambda-search"); let (node_config, storage_resolver, metastore) = load_node_config(CONFIGURATION_TEMPLATE).await?; + let services: HashSet = + HashSet::from_iter([QuickwitService::Searcher.as_str().to_string()]); + let telemetry_info = + QuickwitTelemetryInfo::new(services, HashSet::from_iter([QuickwitFeature::AwsLambda])); + let _telemetry_handle_opt = quickwit_telemetry::start_telemetry_loop(telemetry_info); + quickwit_telemetry::send_telemetry_event(TelemetryEvent::RunCommand).await; let search_request = search_request_from_api_request(vec![INDEX_ID.clone()], args.query)?; debug!(search_request=?search_request, "search-request"); let search_response: SearchResponse = single_node_search( diff --git a/quickwit/quickwit-telemetry/src/payload.rs b/quickwit/quickwit-telemetry/src/payload.rs index 4d2f193e460..17082f5bea9 100644 --- a/quickwit/quickwit-telemetry/src/payload.rs +++ b/quickwit/quickwit-telemetry/src/payload.rs @@ -124,6 +124,7 @@ pub enum QuickwitFeature { Jaeger, Otlp, PostgresqMetastore, + AwsLambda, } fn hashed_host_username() -> String {