MCPcopy Create free account
hub / github.com/apache/trafficserver / LogsMetrics

Class LogsMetrics

include/cripts/Bundles/LogsMetrics.hpp:31–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29namespace cripts::Bundle
30{
31class LogsMetrics : public cripts::Bundle::Base
32{
33 using super_type = cripts::Bundle::Base;
34 using self_type = LogsMetrics;
35
36public:
37 LogsMetrics(cripts::Instance *inst) : _inst(inst) {}
38
39 static self_type &
40 _activate(cripts::Instance &inst)
41 {
42 auto *entry = new self_type(&inst);
43
44 inst.AddBundle(entry);
45
46 return *entry;
47 }
48
49 [[nodiscard]] const cripts::string &
50 Name() const override
51 {
52 return _name;
53 }
54
55 self_type &propstats(const cripts::string_view &label); // In LogsMetrics.cc
56
57 self_type &
58 logsample(int val)
59 {
60 NeedCallback(cripts::Callbacks::DO_REMAP);
61 _log_sample = val;
62
63 return *this;
64 }
65
66 self_type &
67 tcpinfo(bool enable = true)
68 {
69 if (enable) {
70 NeedCallback({cripts::Callbacks::DO_REMAP, cripts::Callbacks::DO_SEND_RESPONSE, cripts::Callbacks::DO_TXN_CLOSE});
71 }
72 _tcpinfo = enable;
73
74 return *this;
75 }
76
77 void doCacheLookup(cripts::Context *context) override;
78 void doSendResponse(cripts::Context *context) override;
79 void doTxnClose(cripts::Context *context) override;
80 void doRemap(cripts::Context *context) override;
81
82private:
83 static const cripts::string _name;
84 cripts::Instance *_inst; // This Bundle needs the instance for access to the instance metrics
85 cripts::string _label = ""; // Propstats label
86 int _log_sample = 0; // Log sampling
87 bool _tcpinfo = false; // Turn on TCP info logging
88};

Callers

nothing calls this directly

Calls 1

AddBundleMethod · 0.80

Tested by

no test coverage detected