Skip to content

Commit

Permalink
feat(telemetry): add object store media type in mete telemetry report (
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxa21 authored Jul 4, 2024
1 parent 1c3bdc3 commit c22c426
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions proto/telemetry.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ message MetaReport {

// How the cluster is deployed
TelemetryClusterType cluster_type = 7;

// The object store media type obtained from ObjectStore::store_media_type
string object_store_media_type = 8;
}

enum PlanOptimization {
Expand Down
2 changes: 2 additions & 0 deletions src/meta/node/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ pub async fn start_service_as_election_leader(
)
.await
.unwrap();
let object_store_media_type = hummock_manager.object_store_media_type();

let meta_member_srv = MetaMemberServiceImpl::new(match election_client.clone() {
None => Either::Right(address_info.clone()),
Expand Down Expand Up @@ -742,6 +743,7 @@ pub async fn start_service_as_election_leader(
Arc::new(MetaReportCreator::new(
metadata_manager.clone(),
env.meta_store().backend(),
object_store_media_type,
)),
);

Expand Down
4 changes: 4 additions & 0 deletions src/meta/src/hummock/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ impl HummockManager {
pub fn metadata_manager(&self) -> &MetadataManager {
&self.metadata_manager
}

pub fn object_store_media_type(&self) -> &'static str {
self.object_store.media_type()
}
}

async fn write_exclusive_cluster_id(
Expand Down
12 changes: 11 additions & 1 deletion src/meta/src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub struct MetaTelemetryReport {

// Get the ENV from key `TELEMETRY_CLUSTER_TYPE`
cluster_type: PbTelemetryClusterType,
object_store_media_type: &'static str,
}

impl From<MetaTelemetryJobDesc> for risingwave_pb::telemetry::StreamJobDesc {
Expand Down Expand Up @@ -117,6 +118,7 @@ impl TelemetryToProtobuf for MetaTelemetryReport {
stream_job_count: self.streaming_job_count as u32,
stream_jobs: self.job_desc.into_iter().map(|job| job.into()).collect(),
cluster_type: self.cluster_type as i32,
object_store_media_type: self.object_store_media_type.to_string(),
};
pb_report.encode_to_vec()
}
Expand All @@ -143,13 +145,19 @@ impl TelemetryInfoFetcher for MetaTelemetryInfoFetcher {
pub struct MetaReportCreator {
metadata_manager: MetadataManager,
meta_backend: MetaBackend,
object_store_media_type: &'static str,
}

impl MetaReportCreator {
pub fn new(metadata_manager: MetadataManager, meta_backend: MetaBackend) -> Self {
pub fn new(
metadata_manager: MetadataManager,
meta_backend: MetaBackend,
object_store_media_type: &'static str,
) -> Self {
Self {
metadata_manager,
meta_backend,
object_store_media_type,
}
}
}
Expand Down Expand Up @@ -204,6 +212,7 @@ impl TelemetryReportCreator for MetaReportCreator {
meta_backend: self.meta_backend,
job_desc: stream_job_desc,
cluster_type: telemetry_cluster_type_from_env_var(),
object_store_media_type: self.object_store_media_type,
})
}

Expand Down Expand Up @@ -255,6 +264,7 @@ mod test {
},
job_desc: vec![],
cluster_type: PbTelemetryClusterType::Unspecified,
object_store_media_type: "s3",
};

let pb_bytes = report.to_pb_bytes();
Expand Down
4 changes: 4 additions & 0 deletions src/object_store/src/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ impl ObjectStoreImpl {
pub fn support_streaming_upload(&self) -> bool {
dispatch_object_store_enum!(self, |store| store.inner.support_streaming_upload())
}

pub fn media_type(&self) -> &'static str {
object_store_impl_method_body!(self, media_type())
}
}

fn try_update_failure_metric<T>(
Expand Down

0 comments on commit c22c426

Please sign in to comment.