aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/actors/interconnect/interconnect_counters.h
blob: b5a63b45513d700ce94d9167c0b616f897a35b6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once

#include <util/system/valgrind.h>

#include "types.h"

#include "interconnect_common.h"

#include <memory>
#include <optional>

namespace NActors {

class IInterconnectMetrics {
public:
    virtual ~IInterconnectMetrics() = default;

    virtual void AddInflightDataAmount(ui64 value) = 0;
    virtual void SubInflightDataAmount(ui64 value) = 0;
    virtual void AddTotalBytesWritten(ui64 value) = 0;
    virtual void SetClockSkewMicrosec(i64 value) = 0;
    virtual void IncSessionDeaths() = 0;
    virtual void IncHandshakeFails() = 0;
    virtual void SetConnected(ui32 value) = 0;
    virtual void IncSubscribersCount() = 0;
    virtual void SubSubscribersCount(ui32 value) = 0;
    virtual void SubOutputBuffersTotalSize(ui64 value) = 0;
    virtual void AddOutputBuffersTotalSize(ui64 value) = 0;
    virtual ui64 GetOutputBuffersTotalSize() const = 0;
    virtual void IncDisconnections() = 0;
    virtual void IncUsefulWriteWakeups() = 0;
    virtual void IncSpuriousWriteWakeups() = 0;
    virtual void IncSendSyscalls() = 0;
    virtual void IncInflyLimitReach() = 0;
    virtual void IncDisconnectByReason(const TString& s) = 0;
    virtual void IncUsefulReadWakeups() = 0;
    virtual void IncSpuriousReadWakeups() = 0;
    virtual void SetPeerInfo(const TString& name, const TString& dataCenterId) = 0;
    virtual void AddInputChannelsIncomingTraffic(ui16 channel, ui64 incomingTraffic) = 0;
    virtual void IncInputChannelsIncomingEvents(ui16 channel) = 0;
    virtual void IncRecvSyscalls() = 0;
    virtual void AddTotalBytesRead(ui64 value) = 0;
    virtual void UpdatePingTimeHistogram(ui64 value) = 0;
    virtual void UpdateOutputChannelTraffic(ui16 channel, ui64 value) = 0;
    virtual void UpdateOutputChannelEvents(ui16 channel) = 0;
    TString GetHumanFriendlyPeerHostName() const {
        return HumanFriendlyPeerHostName.value_or(TString());
    }

protected:
    std::optional<TString> DataCenterId;
    std::optional<TString> HumanFriendlyPeerHostName;
};

std::unique_ptr<IInterconnectMetrics> CreateInterconnectCounters(const NActors::TInterconnectProxyCommon::TPtr& common);
std::unique_ptr<IInterconnectMetrics> CreateInterconnectMetrics(const NActors::TInterconnectProxyCommon::TPtr& common);
} // NActors