···12121313pub use announcer::ServiceAnnouncer;
1414pub use error::DiscoveryError;
1515-pub use limits::{GlobalLimiter, Member, Normal};
1616-pub use ring::{Config as RingConfig, Ring};
1715pub use service::ServiceRegistration;
1816pub use watcher::ServiceWatcher;
···55use anyhow::Result;
6677use base64::{engine::general_purpose::STANDARD as BASE64_ENGINE, Engine};
88-pub use etcd_config_derive::{Disconfig, FeatureFlags};
98109use prost::Message;
1110
+1-2
osprey_coordinator/src/etcd_watcherd/mod.rs
···77pub mod rpc;
88mod stats;
991010-pub use self::api::{WatchHandle, Watcher, WatcherEvents};
1111-pub use self::metrics::{WatcherMetrics, WatcherMetricsGuard};
1010+pub use self::api::{WatchHandle, Watcher};
1211pub use self::watcher_impl::{
1312 key_watcher::KeyWatchEvents, recursive_key_watcher::RecursiveKeyWatchEvents,
1413};
-6
osprey_coordinator/src/etcd_watcherd/rpc/mod.rs
···11-mod proto {
22- pub mod v1 {
33- tonic::include_proto!("discord_common.etcd_watcherd.v1");
44- }
55-}
66-71pub mod client;
82pub mod server;
+1-1
osprey_coordinator/src/gcloud/kms.rs
···11use anyhow::{anyhow, Result};
22-use base64::engine::{general_purpose, Engine as _};
22+use base64::engine::Engine as _;
33use prost::Message;
44use tink_aead::subtle::AesGcm;
55use tink_core::Aead;
···11pub mod dynamic_counter;
22pub mod static_counter;
3344-pub use super::{DynamicTagKey, DynamicTagValue};
54pub use dynamic_counter::{DynamicCounter, DynamicCounterStorage};
65pub use static_counter::StaticCounter;
-1
osprey_coordinator/src/metrics/gauges/mod.rs
···22mod gauge_struct;
33pub mod static_gauge;
4455-pub use super::{DynamicTagKey, DynamicTagValue};
65pub use dynamic_gauge::{DynamicGauge, DynamicGaugeStorage};
76pub use gauge_struct::{GaugeHandleOwned, GaugeInner, Many, One};
87pub use static_gauge::StaticGauge;
···311311 let metrics = OspreyCoordinatorMetrics::new();
312312 let _worker_guard = metrics
313313 .clone()
314314- .spawn_emit_worker(new_client("smite_coordinator").unwrap());
314314+ .spawn_emit_worker(new_client("osprey_coordinator").unwrap());
315315316316 let ackable_action = proto::OspreyCoordinatorAction {
317317 ack_id: 1,
-1
osprey_coordinator/src/pigeon/mod.rs
···4747use self::utils::Error;
4848use router::Router;
49495050-pub use self::utils::Connector;
5150pub use tonic::server::NamedService;
52515352pub async fn serve<GS>(
-7
osprey_coordinator/src/proto/mod.rs
···1313 }
1414 }
15151616- pub mod labels {
1717- pub mod v1 {
1818- include!(concat!(env!("OUT_DIR"), "/osprey.rpc.labels.v1.rs"));
1919- }
2020- }
2121-2216 pub mod osprey_coordinator {
2317 pub mod bidirectional_stream {
2418 pub mod v1 {
···43374438pub use osprey::rpc::actions::v1::*;
4539pub use osprey::rpc::common::v1::*;
4646-pub use osprey::rpc::labels::v1::*;
4740pub use osprey::rpc::osprey_coordinator::bidirectional_stream::v1::*;
4841pub use osprey::rpc::osprey_coordinator::sync_action::v1 as osprey_coordinator_sync_action;
4942pub const PB_DESCRIPTOR_BYTES: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/descriptor.bin"));
+9-9
osprey_coordinator/src/pubsub.rs
···3030use tokio::time::{timeout, Duration as TokioDuration, Instant};
3131use tonic::{codegen::InterceptedService, transport::Channel};
32323333-use crate::proto::Action as SmiteProtoAction;
3333+use crate::proto::Action as OspreyProtoAction;
3434use crate::signals::exit_signal;
3535use crate::snowflake_client::SnowflakeClient;
3636use convert_case::{Case, Casing};
···4343 snowflake_client: &SnowflakeClient,
4444 metrics: &OspreyCoordinatorMetrics,
4545) -> Result<proto::OspreyCoordinatorAction> {
4646- let smite_proto_action = SmiteProtoAction::decode(message_data).unwrap();
4747- let action_id = if smite_proto_action.id == 0 {
4646+ let osprey_proto_action = OspreyProtoAction::decode(message_data).unwrap();
4747+ let action_id = if osprey_proto_action.id == 0 {
4848 metrics.action_id_snowflake_generation_proto.incr();
4949 snowflake_client.generate_id().await?
5050 } else {
5151- smite_proto_action.id
5151+ osprey_proto_action.id
5252 };
5353- let action_name = smite_proto_action
5353+ let action_name = osprey_proto_action
5454 .data
5555 .unwrap()
5656 .to_string()
···185185 } else {
186186 tracing::info!("Creating subscription client to real pubsub");
187187 let service_account =
188188- std::env::var("SMITE_COORDINATOR_SERVICE_ACCOUNT").unwrap_or("default".to_string());
188188+ std::env::var("OSPREY_COORDINATOR_SERVICE_ACCOUNT").unwrap_or("default".to_string());
189189 let client = GCPMetadataClient::new(service_account).unwrap();
190190 Connection::from_metadata_client(
191191 client,
···211211 let project_id = std::env::var("PUBSUB_SUBSCRIPTION_PROJECT_ID")
212212 .unwrap_or("discord-anti-abuse-prd".to_string());
213213214214- let subscription_id =
215215- std::env::var("PUBSUB_SUBSCRIPTION_ID").unwrap_or("smite-coordinator-test".to_string());
214214+ let subscription_id = std::env::var("PUBSUB_SUBSCRIPTION_ID")
215215+ .unwrap_or("osprey-coordinator-test".to_string());
216216217217 PubSubSubscription::new(project_id, subscription_id)
218218 };
···334334 }
335335 }
336336 }),
337337- MetricsClientBuilder::new("smite_coordinator.pull"),
337337+ MetricsClientBuilder::new("osprey_coordinator.pull"),
338338 )
339339 .gracefully_stop_on_signal(exit_signal(), Duration::from_secs(30))
340340 .await;
+9-32
osprey_coordinator/src/sync_action_rpc.rs
···33use crate::snowflake_client::SnowflakeClient;
44use crate::{
55 coordinator_metrics::OspreyCoordinatorMetrics,
66- label_service_client::LabelServiceClient,
76 priority_queue::AckableAction,
87 priority_queue::{AckOrNack, PriorityQueueSender},
98 proto::{self, osprey_coordinator_sync_action},
···2019 snowflake_client: Arc<SnowflakeClient>,
2120 priority_queue_sender: PriorityQueueSender,
2221 metrics: Arc<OspreyCoordinatorMetrics>,
2323- label_service_client: LabelServiceClient,
2422}
25232624impl SyncActionServer {
···2826 snowflake_client: Arc<SnowflakeClient>,
2927 priority_queue_sender: PriorityQueueSender,
3028 metrics: Arc<OspreyCoordinatorMetrics>,
3131- label_service_client: LabelServiceClient,
3229 ) -> SyncActionServer {
3330 SyncActionServer {
3431 snowflake_client,
3532 priority_queue_sender,
3633 metrics,
3737- label_service_client,
3834 }
3935 }
4036}
41374242-async fn create_smite_coordinator_action(
3838+async fn create_osprey_coordinator_action(
4339 ack_id: u64,
4440 action_request: &osprey_coordinator_sync_action::ProcessActionRequest,
4541 snowflake_client: &SnowflakeClient,
4646-) -> Result<(proto::OspreyCoordinatorAction, Vec<crate::proto::EntityKey>)> {
4242+) -> Result<proto::OspreyCoordinatorAction> {
4743 // generate snowflake if one is not provided, to match the behaviour in pubsub.rs
4844 let action_id = match action_request.action_id {
4945 Some(id) => match id {
···5652 if action_request.action_name.is_empty() {
5753 return Err(anyhow!("`action_name` must not be empty"));
5854 }
5959- let smite_coordinator_action = proto::OspreyCoordinatorAction {
5555+ let osprey_coordinator_action = proto::OspreyCoordinatorAction {
6056 ack_id,
6157 action_id,
6258 action_name: action_request.action_name.clone(),
···7571 ),
7672 };
77737878- Ok((
7979- smite_coordinator_action,
8080- action_request.requested_entities.clone(),
8181- ))
7474+ Ok(osprey_coordinator_action)
8275}
83768477impl SyncActionServer {
···9083 {
9184 let unvalidated_action_id = action_request.action_id;
92859393- let (smite_coordinator_action, requested_entities) = match create_smite_coordinator_action(
8686+ let osprey_coordinator_action = match create_osprey_coordinator_action(
9487 ack_id,
9588 action_request,
9689 self.snowflake_client.as_ref(),
···107100 }
108101 };
109102110110- let action_id = smite_coordinator_action.action_id;
103103+ let action_id = osprey_coordinator_action.action_id;
111104112112- let (ackable_action, acking_receiver) = AckableAction::new(smite_coordinator_action);
105105+ let (ackable_action, acking_receiver) = AckableAction::new(osprey_coordinator_action);
113106114107 let send_start_time = Instant::now();
115108 match self.priority_queue_sender.send_sync(ackable_action).await {
···132125 Ok(ack_or_nack) => match ack_or_nack {
133126 AckOrNack::Ack(verdicts) => {
134127 tracing::debug!({action_id=%action_id, ack_id=ack_id},"[rpc] acking message");
135135- let entities = match self
136136- .label_service_client
137137- .get_entities(requested_entities)
138138- .await
139139- {
140140- Ok(entities) => entities,
141141- Err(error) => {
142142- tracing::error!({error=%error},"label service call failed");
143143- self.metrics
144144- .sync_classification_failure_label_service
145145- .incr();
146146- return Err(tonic::Status::aborted("label service call failed"));
147147- }
148148- };
149128150150- let response = osprey_coordinator_sync_action::ProcessActionResponse {
151151- entities,
152152- verdicts,
153153- };
129129+ let response =
130130+ osprey_coordinator_sync_action::ProcessActionResponse { verdicts };
154131155132 self.metrics.sync_classification_result_ack.incr();
156133 self.metrics
-4
osprey_coordinator/src/tokio_utils/mod.rs
···8899mod unbounded_receiver_chunker;
10101111-pub use unbounded_receiver_chunker::{
1212- ChunkSizeConfig as UnboundedReceiverChunkSizeConfig, UnboundedReceiverChunker,
1313-};
1414-1511/// A helper struct that will invoke [`JoinHandle::abort`] when dropped.
1612#[derive(Debug)]
1713pub struct AbortOnDrop<T = ()> {
···1313 fixed64 id = 1;
14141515 // This oneof denotes the type of action this message is.
1616- // Each field name in this this oneof should match the name of an action that Smite expects.
1616+ // Each field name in this this oneof should match the name of an action that Osprey expects.
1717 oneof data {
1818 AuthSessionCreated auth_session_created = 2;
1919 AuthSessionModified auth_session_modified = 3;
···2323 UserBatchMLScore user_batch_ml_score = 7;
2424 UserBlocked user_blocked = 8;
2525 GuildJoined guild_joined = 9;
2626- SmiteAutoClusteringUser smite_auto_clustering_user = 10;
2727- SmiteAutoClusteringKey smite_auto_clustering_key = 11;
2626+ OspreyAutoClusteringUser osprey_auto_clustering_user = 10;
2727+ OspreyAutoClusteringKey osprey_auto_clustering_key = 11;
2828 HashMatcherIconMatched hash_matcher_icon_matched = 12;
2929 SafetyVisualPrediction safety_visual_prediction = 13;
3030 }
···7676 BatchMLSourceEvent source_event = 8;
7777}
78787979-message SmiteAutoClusteringUser {
7979+message OspreyAutoClusteringUser {
8080 google.protobuf.Timestamp timestamp = 1;
8181 uint64 user_id = 2;
8282 string pipeline_name = 3;
8383 string cluster_id = 4;
8484}
85858686-message SmiteAutoClusteringKey {
8686+message OspreyAutoClusteringKey {
8787 google.protobuf.Timestamp timestamp = 1;
8888 string key = 2;
8989 string value = 3;
+1-1
proto/osprey/rpc/actions/v1/guild.proto
···55import "google/protobuf/timestamp.proto";
66import "google/protobuf/wrappers.proto";
7788-// Smite representation of a guild object
88+// Osprey representation of a guild object
99message Guild {
1010 fixed64 id = 1;
1111 GuildOwner owner = 2;
-36
proto/osprey/rpc/labels/v1/service.proto
···11-syntax = "proto3";
22-33-package osprey.rpc.labels.v1;
44-55-// Mock proto file for deprecated labels functionality
66-// These are marked as DEPRECATED in sync_action service
77-// and will be removed once labels are replaced with verdicts
88-99-message EntityKey {
1010- string entity_type = 1;
1111- string entity_id = 2;
1212-}
1313-1414-message Label {
1515- string name = 1;
1616- int64 version = 2;
1717- int64 expires_at = 3;
1818-}
1919-2020-message Entity {
2121- EntityKey key = 1;
2222- repeated Label labels = 2;
2323-}
2424-2525-message GetEntityRequest {
2626- string routing_key = 1;
2727- EntityKey key = 2;
2828-}
2929-3030-message GetEntityResponse {
3131- Entity entity = 1;
3232-}
3333-3434-service LabelService {
3535- rpc GetEntity(GetEntityRequest) returns (GetEntityResponse);
3636-}