Log format is: name-space bytes status url */
| 620 | |
| 621 | /* Log format is: name-space bytes status url */ |
| 622 | void |
| 623 | BgFetch::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. |
no test coverage detected