Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Jaeger Tracing Added #1

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fd36b14
Basic Jaeger Tracing Added
suab321321 Mar 15, 2020
b878b91
Basic Jaeger Tracing Added
suab321321 Mar 15, 2020
05e1442
Merge branch 'suab321321_jaegerTracing' of https://github.com/suab321…
suab321321 Mar 15, 2020
eeebe21
"Jaeger Tracing of Bucket List Request"
suab321321 Apr 13, 2020
f10c6f4
Tracer for object Uploading in Container added
suab321321 Apr 28, 2020
1aa2724
Removing Uneccessary code
suab321321 Apr 29, 2020
725a5a4
Error Uploading Object to Container resolved
suab321321 May 4, 2020
a3ba8d7
Converted variables into snake_case and removed non-essential code
suab321321 May 5, 2020
f605172
RGW_OP_GET_OBJ tracer and cleanup
suab321321 May 9, 2020
1ec9c76
RGW_OP_DELETE_OBJ Tracer added
suab321321 May 9, 2020
a98ce02
RGW_OP_DELETE_BUCKET Tracer Added
suab321321 May 11, 2020
1117ba5
S3 and Swift tag added
suab321321 May 12, 2020
d70d0f8
Injecting trace further deep down functions for RGW_LIST_BUCKETS
suab321321 May 14, 2020
b83e969
Added more tracer to into deep functions RGW_LIST_BUCKET
suab321321 May 15, 2020
7f68f4d
Added more traces in depth in RGWPutObj operation
suab321321 May 16, 2020
8c60410
Added more traces to in-depth functions of RGW_PUTObj
suab321321 May 17, 2020
ea7e1e0
More Tracer added in-depth fucntion RGW_DELETE_BUCKET
suab321321 May 17, 2020
2b1bb05
Added more traces in depth of RGWCreateBucket
suab321321 May 19, 2020
3a331ff
Added more in depth traces to RGW_DeleteObj
suab321321 May 19, 2020
a42be55
Tracer Added in req_state and ListBuckets tracing added
suab321321 May 21, 2020
c88c714
Tracer for ListBucket
suab321321 May 22, 2020
7d76769
DeleteContainer
suab321321 May 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/rgw/rgw_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6725,7 +6725,7 @@ int RGWDeleteObj::verify_permission()
int RGWDeleteObj::verify_permission(Jager_Tracer& tracer, const Span& parent_span)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Jager_Tracer/Jaeger_Tracer

{
Span span = tracer.child_span("rgw_op.cc RGWDeleteObj::verify_permission",parent_span);
int op_ret = get_params();
int op_ret = get_params(tracer, span);
if (op_ret) {
return op_ret;
}
Expand Down Expand Up @@ -6769,7 +6769,7 @@ int RGWDeleteObj::verify_permission(Jager_Tracer& tracer, const Span& parent_spa
return 0;
}

if (!verify_bucket_permission_no_policy(this, s, RGW_PERM_WRITE)) {
if (!verify_bucket_permission_no_policy(this, s, RGW_PERM_WRITE, tracer, span)) {
return -EACCES;
}

Expand All @@ -6791,7 +6791,7 @@ void RGWDeleteObj::pre_exec()
void RGWDeleteObj::pre_exec(Jager_Tracer& tracer,const Span& parent_span)
{
Span span = tracer.child_span("rgw_op.cc RGWDeleteObj::pre_exec",parent_span);
rgw_bucket_object_pre_exec(s);
rgw_bucket_object_pre_exec(s, tracer, span);
}

void RGWDeleteObj::execute()
Expand Down Expand Up @@ -7047,7 +7047,7 @@ void RGWDeleteObj::execute(Jager_Tracer& tracer, const Span& parent_span)

bool ver_restored = false;
op_ret = store->getRados()->swift_versioning_restore(*obj_ctx, s->bucket_owner.get_id(),
s->bucket_info, obj, ver_restored, this);
s->bucket_info, obj, ver_restored, this, tracer, span);
if (op_ret < 0) {
return;
}
Expand All @@ -7071,7 +7071,7 @@ void RGWDeleteObj::execute(Jager_Tracer& tracer, const Span& parent_span)
del_op.params.unmod_since = unmod_since;
del_op.params.high_precision_time = s->system_request; /* system request uses high precision time */

op_ret = del_op.delete_obj(s->yield);
op_ret = del_op.delete_obj(s->yield, tracer, span);
if (op_ret >= 0) {
delete_marker = del_op.result.delete_marker;
version_id = del_op.result.version_id;
Expand Down
67 changes: 62 additions & 5 deletions src/rgw/rgw_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2764,6 +2764,31 @@ int RGWRados::get_obj_head_ref(const RGWBucketInfo& bucket_info, const rgw_obj&
return 0;
}

int RGWRados::get_obj_head_ref(const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_rados_ref *ref, Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_rados.cc RGWRados::get_obj_head_ref", parent_span);
get_obj_bucket_and_oid_loc(obj, ref->obj.oid, ref->obj.loc);

rgw_pool pool;
if (!get_obj_data_pool(bucket_info.placement_rule, obj, &pool)) {
ldout(cct, 0) << "ERROR: cannot get data pool for obj=" << obj << ", probably misconfiguration" << dendl;
return -EIO;
}

ref->pool = svc.rados->pool(pool);

int r = ref->pool.open( tracer, span, RGWSI_RADOS::OpenParams()
.set_mostly_omap(false));
if (r < 0) {
ldout(cct, 0) << "ERROR: failed opening data pool (pool=" << pool << "); r=" << r << dendl;
return r;
}

ref->pool.ioctx().locator_set_key(ref->obj.loc);

return 0;
}

int RGWRados::get_raw_obj_ref(const rgw_raw_obj& obj, rgw_rados_ref *ref)
{
ref->obj = obj;
Expand Down Expand Up @@ -3461,6 +3486,18 @@ int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx,
handler);
}

int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx,
const rgw_user& user,
RGWBucketInfo& bucket_info,
rgw_obj& obj,
bool& restored, /* out */
const DoutPrefixProvider *dpp, Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_rados.cc RGWRados::swift_versioning_restore", parent_span);
return RGWRados::swift_versioning_restore(obj_ctx, user, bucket_info, obj, restored, dpp);

}

int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_size,
map<string, bufferlist>& attrs,
bool assume_noent, bool modify_tail,
Expand Down Expand Up @@ -5322,6 +5359,12 @@ int RGWRados::Object::complete_atomic_modification()
return 0;
}

int RGWRados::Object::complete_atomic_modification(Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_rados.cc int RGWRados::Object::complete_atomic_modification", parent_span);
return RGWRados::Object::complete_atomic_modification();
}

void RGWRados::update_gc_chain(rgw_obj& head_obj, RGWObjManifest& manifest, cls_rgw_obj_chain *chain)
{
RGWObjManifest::obj_iterator iter;
Expand Down Expand Up @@ -5793,7 +5836,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, Jager_Tracer& tracer,
}

rgw_rados_ref ref;
int r = store->get_obj_head_ref(target->get_bucket_info(), obj, &ref);
int r = store->get_obj_head_ref(target->get_bucket_info(), obj, &ref, tracer, span);
if (r < 0) {
return r;
}
Expand Down Expand Up @@ -5853,7 +5896,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, Jager_Tracer& tracer,
return -ENOENT;
}

r = target->prepare_atomic_modification(op, false, NULL, NULL, NULL, true, false, y);
r = target->prepare_atomic_modification(op, false, NULL, NULL, NULL, true, false, y, tracer, span);
if (r < 0)
return r;

Expand All @@ -5865,14 +5908,14 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, Jager_Tracer& tracer,
index_op.set_zones_trace(params.zones_trace);
index_op.set_bilog_flags(params.bilog_flags);

r = index_op.prepare(CLS_RGW_OP_DEL, &state->write_tag, y);
r = index_op.prepare(CLS_RGW_OP_DEL, &state->write_tag, y, tracer , span);
if (r < 0)
return r;

store->remove_rgw_head_obj(op);

auto& ioctx = ref.pool.ioctx();
r = rgw_rados_operate(ioctx, ref.obj.oid, &op, null_yield);
r = rgw_rados_operate(ioctx, ref.obj.oid, &op, null_yield, tracer, span);

/* raced with another operation, object state is indeterminate */
const bool need_invalidate = (r == -ECANCELED);
Expand All @@ -5886,7 +5929,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, Jager_Tracer& tracer,
}
r = index_op.complete_del(poolid, ioctx.get_last_version(), state->mtime, params.remove_objs);

int ret = target->complete_atomic_modification();
int ret = target->complete_atomic_modification(tracer, span);
if (ret < 0) {
ldout(store->ctx(), 0) << "ERROR: complete_atomic_modification returned ret=" << ret << dendl;
}
Expand Down Expand Up @@ -6466,6 +6509,14 @@ int RGWRados::Object::prepare_atomic_modification(ObjectWriteOperation& op, bool
return 0;
}

int RGWRados::Object::prepare_atomic_modification(ObjectWriteOperation& op, bool reset_obj, const string *ptag,
const char *if_match, const char *if_nomatch, bool removal_op,
bool modify_tail, optional_yield y, Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_rados.cc RGWRados::Object::prepare_atomic_modification", parent_span);
return RGWRados::Object::prepare_atomic_modification(op, reset_obj, ptag, if_match, if_nomatch, removal_op, modify_tail, y);
}

/**
* Set an attr on an object.
* bucket: name of the bucket holding the object
Expand Down Expand Up @@ -6918,6 +6969,12 @@ int RGWRados::Bucket::UpdateIndex::prepare(RGWModifyOp op, const string *write_t
return 0;
}

int RGWRados::Bucket::UpdateIndex::prepare(RGWModifyOp op, const string *write_tag, optional_yield y, Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_rados.cc RGWRados::Bucket::UpdateIndex::prepare", parent_span);
return RGWRados::Bucket::UpdateIndex::prepare(op, write_tag, y);
}

int RGWRados::Bucket::UpdateIndex::complete(int64_t poolid, uint64_t epoch,
uint64_t size, uint64_t accounted_size,
ceph::real_time& ut, const string& etag,
Expand Down
13 changes: 12 additions & 1 deletion src/rgw/rgw_rados.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ class RGWRados
int get_obj_head_ioctx(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::IoCtx *ioctx);
int get_obj_head_ioctx(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::IoCtx *ioctx, Jager_Tracer&, const Span&);
int get_obj_head_ref(const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_rados_ref *ref);
int get_obj_head_ref(const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_rados_ref *ref, Jager_Tracer&, const Span&);
int get_system_obj_ref(const rgw_raw_obj& obj, rgw_rados_ref *ref);
uint64_t max_bucket_id;

Expand Down Expand Up @@ -728,7 +729,10 @@ class RGWRados

int prepare_atomic_modification(librados::ObjectWriteOperation& op, bool reset_obj, const string *ptag,
const char *ifmatch, const char *ifnomatch, bool removal_op, bool modify_tail, optional_yield y);
int prepare_atomic_modification(librados::ObjectWriteOperation& op, bool reset_obj, const string *ptag,
const char *ifmatch, const char *ifnomatch, bool removal_op, bool modify_tail, optional_yield y, Jager_Tracer&, const Span&);
int complete_atomic_modification();
int complete_atomic_modification(Jager_Tracer&, const Span&);

public:
Object(RGWRados *_store, const RGWBucketInfo& _bucket_info, RGWObjectCtx& _ctx, const rgw_obj& _obj) : store(_store), bucket_info(_bucket_info),
Expand Down Expand Up @@ -996,6 +1000,7 @@ class RGWRados
}

int prepare(RGWModifyOp, const string *write_tag, optional_yield y);
int prepare(RGWModifyOp, const string *write_tag, optional_yield y, Jager_Tracer&, const Span&);
int complete(int64_t poolid, uint64_t epoch, uint64_t size,
uint64_t accounted_size, ceph::real_time& ut,
const string& etag, const string& content_type,
Expand Down Expand Up @@ -1126,7 +1131,13 @@ class RGWRados
RGWBucketInfo& bucket_info, /* in */
rgw_obj& obj, /* in */
bool& restored, /* out */
const DoutPrefixProvider *dpp); /* in/out */
const DoutPrefixProvider *dpp);/* in/out */
int swift_versioning_restore(RGWObjectCtx& obj_ctx, /* in/out */
const rgw_user& user, /* in */
RGWBucketInfo& bucket_info, /* in */
rgw_obj& obj, /* in */
bool& restored, /* out */
const DoutPrefixProvider *dpp, Jager_Tracer&, const Span&);
int copy_obj_to_remote_dest(RGWObjState *astate,
map<string, bufferlist>& src_attrs,
RGWRados::Object::Read& read_op,
Expand Down
15 changes: 15 additions & 0 deletions src/rgw/rgw_tools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool,
return 0;
}

int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool,
librados::IoCtx& ioctx, Jager_Tracer& tracer, const Span& parent_span, bool create,
bool mostly_omap)
{
Span span = tracer.child_span("rgw_tools.cc rgw_init_ioctx", parent_span);
return rgw_init_ioctx(rados, pool, ioctx, create, mostly_omap);
}

void rgw_shard_name(const string& prefix, unsigned max_shards, const string& key, string& name, int *shard_id)
{
uint32_t val = ceph_str_hash_linux(key.c_str(), key.size());
Expand Down Expand Up @@ -297,6 +305,13 @@ int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
return ioctx.operate(oid, op);
}

int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
librados::ObjectWriteOperation *op, optional_yield y, Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_tools.cc rgw_rados_operate", parent_span);
return rgw_rados_operate(ioctx, oid, op, y);
}

int rgw_rados_notify(librados::IoCtx& ioctx, const std::string& oid,
bufferlist& bl, uint64_t timeout_ms, bufferlist* pbl,
optional_yield y)
Expand Down
6 changes: 6 additions & 0 deletions src/rgw/rgw_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool,
librados::IoCtx& ioctx,
bool create = false,
bool mostly_omap = false);
int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool,
librados::IoCtx& ioctx, Jager_Tracer&, const Span&,
bool create = false,
bool mostly_omap = false);

#define RGW_NO_SHARD -1

Expand Down Expand Up @@ -100,6 +104,8 @@ int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
optional_yield y, Jager_Tracer&, const Span&);
int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
librados::ObjectWriteOperation *op, optional_yield y);
int rgw_rados_operate(librados::IoCtx& ioctx, const std::string& oid,
librados::ObjectWriteOperation *op, optional_yield y, Jager_Tracer&, const Span&);
int rgw_rados_notify(librados::IoCtx& ioctx, const std::string& oid,
bufferlist& bl, uint64_t timeout_ms, bufferlist* pbl,
optional_yield y);
Expand Down
16 changes: 16 additions & 0 deletions src/rgw/services/svc_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ int RGWSI_RADOS::open_pool_ctx(const rgw_pool& pool, librados::IoCtx& io_ctx,
params.mostly_omap);
}

int RGWSI_RADOS::open_pool_ctx(const rgw_pool& pool, librados::IoCtx& io_ctx,
Jager_Tracer& tracer, const Span& parent_span,
const OpenParams& params)
{
Span span = tracer.child_span("svc_rados.cc RGWSI_RADOS::open_pool_ctx", parent_span);
return rgw_init_ioctx(get_rados_handle(), pool, io_ctx, tracer, span,
params.create,
params.mostly_omap);
}

int RGWSI_RADOS::pool_iterate(librados::IoCtx& io_ctx,
librados::NObjectIterator& iter,
uint32_t num, vector<rgw_bucket_dir_entry>& objs,
Expand Down Expand Up @@ -289,6 +299,12 @@ int RGWSI_RADOS::Pool::open(const OpenParams& params)
return rados_svc->open_pool_ctx(pool, state.ioctx, params);
}

int RGWSI_RADOS::Pool::open( Jager_Tracer& tracer, const Span& parent_span, const OpenParams& params)
{
Span span = tracer.child_span("svc_rados.cc RGWSI_RADOS::Pool::open", parent_span);
return rados_svc->open_pool_ctx(pool, state.ioctx, tracer, span, params);
}

int RGWSI_RADOS::Pool::List::init(const string& marker, RGWAccessListFilter *filter)
{
if (ctx.initialized) {
Expand Down
4 changes: 4 additions & 0 deletions src/rgw/services/svc_rados.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class RGWSI_RADOS : public RGWServiceInstance
librados::Rados* get_rados_handle();
int open_pool_ctx(const rgw_pool& pool, librados::IoCtx& io_ctx,
const OpenParams& params = {});
int open_pool_ctx(const rgw_pool& pool, librados::IoCtx& io_ctx,
Jager_Tracer&, const Span&,
const OpenParams& params = {});
int pool_iterate(librados::IoCtx& ioctx,
librados::NObjectIterator& iter,
uint32_t num, vector<rgw_bucket_dir_entry>& objs,
Expand Down Expand Up @@ -99,6 +102,7 @@ class RGWSI_RADOS : public RGWServiceInstance
int create(const std::vector<rgw_pool>& pools, std::vector<int> *retcodes);
int lookup();
int open(const OpenParams& params = {});
int open(Jager_Tracer&, const Span&, const OpenParams& params = {});

const rgw_pool& get_pool() {
return pool;
Expand Down