Skip to content

Commit

Permalink
test initial spans
Browse files Browse the repository at this point in the history
adds marker spans which can be used to trace flag point
status in OSD i/o path.

Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
  • Loading branch information
Deepika Upadhyay committed Jan 14, 2020
1 parent 41bc0fc commit d838fe8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/osd/OpRequest.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-

#include "OpRequest.h"
#include "common/Formatter.h"
Expand All @@ -23,6 +23,10 @@
#define tracepoint(...)
#endif

#ifdef WITH_JAEGER
#include "common/tracer.h"
#endif

using std::ostream;
using std::set;
using std::string;
Expand Down Expand Up @@ -126,6 +130,14 @@ void OpRequest::mark_flag_point(uint8_t flag, const char *s) {
tracepoint(oprequest, mark_flag_point, reqid.name._type,
reqid.name._num, reqid.tid, reqid.inc, op_info.get_flags(),
flag, s, old_flags, hit_flag_points);
#ifdef WITH_JAEGER
OpRequest::marker_span = opentracing::Tracer::Global()->StartSpan(
s, {opentracing::v2::ChildOf(&(OpRequest::osd_parent_span)->context())});
OpRequest::marker_span->Log({
{"hit_flag_points", hit_flag_points},
});
OpRequest::marker_span->Finish();
#endif
}

void OpRequest::mark_flag_point_string(uint8_t flag, const string& s) {
Expand All @@ -138,6 +150,15 @@ void OpRequest::mark_flag_point_string(uint8_t flag, const string& s) {
tracepoint(oprequest, mark_flag_point, reqid.name._type,
reqid.name._num, reqid.tid, reqid.inc, op_info.get_flags(),
flag, s.c_str(), old_flags, hit_flag_points);
#ifdef WITH_JAEGER
OpRequest::marker_span = opentracing::Tracer::Global()->StartSpan(
s, {opentracing::v2::ChildOf(&(OpRequest::osd_parent_span)->context())});
OpRequest::marker_span->Log({
{"hit_flag_points", hit_flag_points},
{"mark_event", s}
});
OpRequest::marker_span->Finish();
#endif
}

bool OpRequest::filter_out(const set<string>& filters)
Expand Down
10 changes: 10 additions & 0 deletions src/osd/OpRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#include "osd/osd_op_util.h"
#include "osd/osd_types.h"
#include "common/TrackedOp.h"
#ifdef WITH_JAEGER
#include "common/tracer.h"
#endif

/**
* The OpRequest takes in a Message* and takes over a single reference
Expand Down Expand Up @@ -89,6 +92,13 @@ struct OpRequest : public TrackedOp {

bool hitset_inserted;

#ifdef WITH_JAEGER
jspan osd_parent_span;
jspan marker_span;
jspan do_op;
void set_osd_parent_span(jspan& span ) { osd_parent_span = move(span); }
#endif

template<class T>
const T* get_req() const { return static_cast<const T*>(request); }

Expand Down

0 comments on commit d838fe8

Please sign in to comment.