MCPcopy Create free account
hub / github.com/apache/brpc / PopAnnotation

Method PopAnnotation

src/brpc/span.cpp:418–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418bool SpanInfoExtractor::PopAnnotation(
419 int64_t before_this_time, int64_t* time, std::string* annotation) {
420 for (; _sp != NULL; ++_sp) {
421 butil::StringSplitter sp_time(_sp.field(), _sp.field() + _sp.length(), ' ');
422 if (sp_time) {
423 char* endptr;
424 const int64_t anno_time = strtoll(sp_time.field(), &endptr, 10);
425 if (*endptr == ' ') {
426 if (before_this_time <= anno_time) {
427 return false;
428 }
429 *time = anno_time;
430 ++sp_time;
431 annotation->assign(
432 sp_time.field(),
433 _sp.field() + _sp.length() - sp_time.field());
434 ++_sp;
435 return true;
436 }
437 }
438 LOG(ERROR) << "Unknown annotation: "
439 << std::string(_sp.field(), _sp.length());
440 }
441 return false;
442}
443
444bool CanAnnotateSpan() {
445 return HasTlsParentSpan();

Callers 1

PrintAnnotationsFunction · 0.80

Calls 3

fieldMethod · 0.80
lengthMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected