Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose EventSinkClientInfo in metrics #5344

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/canisters/event_relay/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added

- Forward anonymised events on to the `event_sink` canister ([#5337](https://github.com/open-chat-labs/open-chat/pull/5337))
- Initial commit ([#5334](https://github.com/open-chat-labs/open-chat/pull/5334))
1 change: 1 addition & 0 deletions backend/canisters/user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added

- Track `user_registered` and `diamond_membership_payment` events ([#5342](https://github.com/open-chat-labs/open-chat/pull/5342))
- Expose `EventSinkClientInfo` in metrics ([#5344](https://github.com/open-chat-labs/open-chat/pull/5344))

## [[2.0.1047](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1047-user_index)] - 2024-02-05

Expand Down
11 changes: 9 additions & 2 deletions backend/canisters/user_index/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::timer_job_types::TimerJob;
use candid::Principal;
use canister_state_macros::canister_state;
use canister_timer_jobs::TimerJobs;
use event_sink_client::{EventSinkClient, EventSinkClientBuilder};
use event_sink_client::{EventSinkClient, EventSinkClientBuilder, EventSinkClientInfo};
use event_sink_client_cdk_runtime::CdkRuntime;
use fire_and_forget_handler::FireAndForgetHandler;
use icrc_ledger_types::icrc1::account::{Account, Subaccount};
Expand Down Expand Up @@ -176,6 +176,9 @@ impl RuntimeState {
pub fn metrics(&self) -> Metrics {
let now = self.env.now();
let canister_upgrades_metrics = self.data.canisters_requiring_upgrade.metrics();
let event_sink_client_info = self.data.event_sink_client.info();
let event_relay_canister_id = event_sink_client_info.event_sink_canister_id;

Metrics {
memory_used: utils::memory::used(),
now: self.env.now(),
Expand All @@ -202,6 +205,7 @@ impl RuntimeState {
local_user_indexes: self.data.local_index_map.iter().map(|(c, i)| (*c, i.clone())).collect(),
platform_moderators_group: self.data.platform_moderators_group,
nns_8_year_neuron: self.data.nns_8_year_neuron.clone(),
event_sink_client_info,
canister_ids: CanisterIds {
group_index: self.data.group_index_canister_id,
notifications_index: self.data.notifications_index_canister_id,
Expand All @@ -211,6 +215,7 @@ impl RuntimeState {
storage_index: self.data.storage_index_canister_id,
escrow: self.data.escrow_canister_id,
translations: self.data.translations_canister_id,
event_relay: event_relay_canister_id,
internet_identity: self.data.internet_identity_canister_id,
},
pending_modclub_submissions: self.data.pending_modclub_submissions_queue.len(),
Expand Down Expand Up @@ -448,6 +453,7 @@ pub struct Metrics {
pub local_user_indexes: Vec<(CanisterId, LocalUserIndex)>,
pub platform_moderators_group: Option<ChatId>,
pub nns_8_year_neuron: Option<NnsNeuron>,
pub event_sink_client_info: EventSinkClientInfo,
pub canister_ids: CanisterIds,
pub pending_modclub_submissions: usize,
pub reporting_metrics: ReportingMetrics,
Expand Down Expand Up @@ -495,6 +501,7 @@ pub struct CanisterIds {
pub cycles_dispenser: CanisterId,
pub storage_index: CanisterId,
pub escrow: CanisterId,
pub internet_identity: CanisterId,
pub translations: CanisterId,
pub event_relay: CanisterId,
pub internet_identity: CanisterId,
}
Loading