Skip to content

Commit

Permalink
switch to metrics interface (#13257)
Browse files Browse the repository at this point in the history
flaky test (disabled now)
  • Loading branch information
adameat authored Jan 10, 2025
1 parent 8a6d04b commit caaa1f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions ydb/library/actors/http/http_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class THttpProxy : public NActors::TActorBootstrapped<THttpProxy>, public THttpC
Become(&THttpProxy::StateWork);
}

THttpProxy(std::weak_ptr<NMonitoring::TMetricRegistry> registry)
THttpProxy(std::weak_ptr<NMonitoring::IMetricFactory> registry)
: Registry(std::move(registry))
{}

Expand Down Expand Up @@ -232,33 +232,33 @@ class THttpProxy : public NActors::TActorBootstrapped<THttpProxy>, public THttpC
const static TString urlNotFound = "not-found";
const TString& url = (sensors.Status == "404" ? urlNotFound : sensors.Url);

std::shared_ptr<NMonitoring::TMetricRegistry> registry = Registry.lock();
std::shared_ptr<NMonitoring::IMetricFactory> registry = Registry.lock();
if (registry) {
registry->Rate(
registry->Rate(NMonitoring::MakeLabels(
{
{"sensor", "count"},
{"direction", sensors.Direction},
{"peer", sensors.Host},
{"url", url},
{"status", sensors.Status}
})->Inc();
registry->HistogramRate(
}))->Inc();
registry->HistogramRate(NMonitoring::MakeLabels(
{
{"sensor", "time_us"},
{"direction", sensors.Direction},
{"peer", sensors.Host},
{"url", url},
{"status", sensors.Status}
},
}),
NMonitoring::ExplicitHistogram({1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 30000, 60000}))->Record(sensors.Time.MicroSeconds());
registry->HistogramRate(
registry->HistogramRate(NMonitoring::MakeLabels(
{
{"sensor", "time_ms"},
{"direction", sensors.Direction},
{"peer", sensors.Host},
{"url", url},
{"status", sensors.Status}
},
}),
NMonitoring::ExplicitHistogram({1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 30000, 60000}))->Record(sensors.Time.MilliSeconds());
}
}
Expand Down Expand Up @@ -287,7 +287,7 @@ class THttpProxy : public NActors::TActorBootstrapped<THttpProxy>, public THttpC
THashMap<TString, TActorId> Handlers;
THashSet<TActorId> Connections; // outgoing
std::unordered_multimap<TString, TActorId> AvailableConnections;
std::weak_ptr<NMonitoring::TMetricRegistry> Registry;
std::weak_ptr<NMonitoring::IMetricFactory> Registry;
};

TEvHttpProxy::TEvReportSensors* BuildOutgoingRequestSensors(const THttpOutgoingRequestPtr& request, const THttpIncomingResponsePtr& response) {
Expand All @@ -314,7 +314,7 @@ TEvHttpProxy::TEvReportSensors* BuildIncomingRequestSensors(const THttpIncomingR
);
}

NActors::IActor* CreateHttpProxy(std::weak_ptr<NMonitoring::TMetricRegistry> registry) {
NActors::IActor* CreateHttpProxy(std::weak_ptr<NMonitoring::IMetricFactory> registry) {
return new THttpProxy(std::move(registry));
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/library/actors/http/http_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ struct TPrivateEndpointInfo : THttpEndpointInfo {
{}
};

NActors::IActor* CreateHttpProxy(std::weak_ptr<NMonitoring::TMetricRegistry> registry = NMonitoring::TMetricRegistry::SharedInstance());
NActors::IActor* CreateHttpProxy(std::weak_ptr<NMonitoring::IMetricFactory> registry = NMonitoring::TMetricRegistry::SharedInstance());
NActors::IActor* CreateHttpAcceptorActor(const TActorId& owner, const TActorId& poller);
NActors::IActor* CreateOutgoingConnectionActor(const TActorId& owner, bool secure, const TActorId& poller);
NActors::IActor* CreateIncomingConnectionActor(
Expand Down

0 comments on commit caaa1f0

Please sign in to comment.