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

Method logAndMetricUpdate

plugins/prefetch/fetch.cc:622–660  ·  view source on GitHub ↗

Log format is: name-space bytes status url */

Source from the content-addressed store, hash-verified

620
621/* Log format is: name-space bytes status url */
622void
623BgFetch::logAndMetricUpdate(TSEvent event) const
624{
625 const char *status;
626
627 switch (event) {
628 case TS_EVENT_VCONN_EOS:
629 status = "EOS";
630 _state->incrementMetric(FETCH_COMPLETED);
631 break;
632 case TS_EVENT_VCONN_INACTIVITY_TIMEOUT:
633 status = "TIMEOUT";
634 _state->incrementMetric(FETCH_TIMEOOUTS);
635 break;
636 case TS_EVENT_ERROR:
637 _state->incrementMetric(FETCH_ERRORS);
638 status = "ERROR";
639 break;
640 case TS_EVENT_VCONN_READ_COMPLETE:
641 _state->incrementMetric(FETCH_COMPLETED);
642 status = "READ_COMP";
643 break;
644 default:
645 status = "UNKNOWN";
646 break;
647 }
648
649 if (dbg_ctl_log.on()) {
650 TSHRTime now = TShrtime();
651 double elapsed = static_cast<double>(now - _startTime) / 1000000.0;
652
653 PrefetchDebug("ns=%s bytes=%" PRId64 " time=%1.3lf status=%s url=%s key=%s", _config.getNameSpace().c_str(), _bytes, elapsed,
654 status, _url.c_str(), _cachekey.c_str());
655 if (_state->getLog()) {
656 TSTextLogObjectWrite(_state->getLog(), "ns=%s bytes=%" PRId64 " time=%1.3lf status=%s url=%s key=%s",
657 _config.getNameSpace().c_str(), _bytes, elapsed, status, _url.c_str(), _cachekey.c_str());
658 }
659 }
660}
661
662/**
663 * @brief Continuation to perform a background fill of a URL.

Callers 1

handlerMethod · 0.80

Calls 6

TShrtimeFunction · 0.85
TSTextLogObjectWriteFunction · 0.85
incrementMetricMethod · 0.45
onMethod · 0.45
c_strMethod · 0.45
getLogMethod · 0.45

Tested by

no test coverage detected