Skip to content

Commit

Permalink
Add RPC logging.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 686667172
  • Loading branch information
ftsui authored and copybara-github committed Oct 16, 2024
1 parent 2183467 commit b52f297
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sharing/analytics/analytics_recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class AnalyticsRecorder {

void NewRpcCallStatus(
absl::string_view rpc_name,
nearby::sharing::analytics::proto::SharingLog::RpcCallStatus::RpcDirection
nearby::sharing::analytics::proto::SharingLog_RpcCallStatus::RpcDirection
direction,
int error_code, absl::Duration latency);

Expand Down
5 changes: 3 additions & 2 deletions sharing/internal/api/sharing_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <memory>
#include <vector>

#include "absl/status/status.h"
#include "absl/strings/string_view.h"
#include "internal/platform/clock.h"
#include "internal/platform/device_info.h"
#include "internal/platform/implementation/account_manager.h"
#include "internal/platform/task_runner.h"
Expand Down Expand Up @@ -85,7 +85,8 @@ class SharingPlatform {

virtual std::unique_ptr<SharingRpcClientFactory>
CreateSharingRpcClientFactory(
nearby::sharing::analytics::AnalyticsRecorder* analytics_recorder) = 0;
nearby::sharing::analytics::AnalyticsRecorder* analytics_recorder,
Clock* clock) = 0;

// On platforms where it is supported, tag the transferred files as
// originating from an untrusted source.
Expand Down
4 changes: 2 additions & 2 deletions sharing/nearby_sharing_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@

#include "absl/base/attributes.h"
#include "absl/functional/any_invocable.h"
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "internal/platform/clock.h"
#include "sharing/advertisement.h"
#include "sharing/attachment_container.h"
#include "sharing/internal/api/sharing_rpc_notifier.h"
#include "sharing/local_device_data/nearby_share_local_device_data_manager.h"
#include "sharing/nearby_sharing_settings.h"
#include "sharing/share_target.h"
#include "sharing/share_target_discovered_callback.h"
#include "sharing/transfer_update_callback.h"

Expand Down Expand Up @@ -255,6 +254,7 @@ class NearbySharingService {
virtual NearbyShareContactManager* GetContactManager() = 0;
virtual NearbyShareCertificateManager* GetCertificateManager() = 0;
virtual AccountManager* GetAccountManager() = 0;
virtual Clock& GetClock() = 0;
};

} // namespace sharing
Expand Down
3 changes: 2 additions & 1 deletion sharing/nearby_sharing_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ NearbySharingServiceImpl::NearbySharingServiceImpl(
analytics_recorder_(*analytics_recorder),
nearby_connections_manager_(std::move(nearby_connections_manager)),
nearby_share_client_factory_(
sharing_platform.CreateSharingRpcClientFactory(&analytics_recorder_)),
sharing_platform.CreateSharingRpcClientFactory(&analytics_recorder_,
context_->GetClock())),
profile_info_provider_(
std::make_unique<NearbyShareProfileInfoProviderImpl>(
device_info_, account_manager_)),
Expand Down
2 changes: 2 additions & 0 deletions sharing/nearby_sharing_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "absl/time/time.h"
#include "absl/types/span.h"
#include "internal/base/observer_list.h"
#include "internal/platform/clock.h"
#include "internal/platform/device_info.h"
#include "internal/platform/implementation/account_manager.h"
#include "internal/platform/task_runner.h"
Expand Down Expand Up @@ -171,6 +172,7 @@ class NearbySharingServiceImpl
NearbyShareContactManager* GetContactManager() override;
NearbyShareCertificateManager* GetCertificateManager() override;
AccountManager* GetAccountManager() override;
Clock& GetClock() override { return *context_->GetClock(); }

// NearbyConnectionsManager::IncomingConnectionListener:
void OnIncomingConnection(absl::string_view endpoint_id,
Expand Down

0 comments on commit b52f297

Please sign in to comment.