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
1 change: 1 addition & 0 deletions src/rgw/rgw_asio_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ void handle_connection(boost::asio::io_context& context,
std::string span_name;
auto time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
span_name = std::ctime(&time);
span_name = "rgw_asio_frontend "+span_name;
Span span=tracer.new_span(span_name.c_str());
if(root_span == nullptr)
root_span=tracer.new_span(span_name.c_str());
Expand Down
21 changes: 17 additions & 4 deletions src/rgw/rgw_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2980,6 +2980,19 @@ int RGWListBuckets::verify_permission()
return 0;
}

int RGWListBuckets::verify_permission(Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_op.cc RGWListBuckets::verify_permission", parent_span);
rgw::Partition partition = rgw::Partition::aws;

Choose a reason for hiding this comment

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

can you remove non-jaeger changes in the further cleanups, it would make work easier for reviewer, hence better focus on feedback.

rgw::Service service = rgw::Service::s3;

if (!verify_user_permission(this, s, ARN(partition, service, "", s->user->get_tenant(), "*"), rgw::IAM::s3ListAllMyBuckets)) {
return -EACCES;
}

return 0;
}

int RGWGetUsage::verify_permission()
{
if (s->auth.identity->is_anonymous()) {
Expand All @@ -2999,7 +3012,7 @@ void RGWListBuckets::execute(Jager_Tracer& tracer,const Span& parent_span)

const uint64_t max_buckets = s->cct->_conf->rgw_list_buckets_max_chunk;

op_ret = get_params();
op_ret = get_params(tracer, span);
if (op_ret < 0) {
goto send_end;
}
Expand All @@ -3023,7 +3036,7 @@ void RGWListBuckets::execute(Jager_Tracer& tracer,const Span& parent_span)

rgw::sal::RGWRadosUser user(store, s->user->get_id());

op_ret = user.list_buckets(marker, end_marker, read_count, should_get_stats(), buckets);
op_ret = user.list_buckets(marker, end_marker, read_count, should_get_stats(), buckets, tracer, span);

if (op_ret < 0) {
/* hmm.. something wrong here.. the user was authenticated, so it
Expand Down Expand Up @@ -3072,7 +3085,7 @@ void RGWListBuckets::execute(Jager_Tracer& tracer,const Span& parent_span)
map<string, rgw::sal::RGWBucket*>::reverse_iterator riter = m.rbegin();
marker = riter->first;

handle_listing_chunk(std::move(buckets));
handle_listing_chunk(std::move(buckets), tracer, span);
}
} while (is_truncated && !done);

Expand Down Expand Up @@ -3664,7 +3677,7 @@ void RGWListBucket::execute(Jager_Tracer& tracer,const Span& parent_span)
list_op.params.list_versions = list_versions;
list_op.params.allow_unordered = allow_unordered;

op_ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated, s->yield);
op_ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated, tracer, span, s->yield);
if (op_ret >= 0) {
next_marker = list_op.get_next_marker();
}
Expand Down
10 changes: 10 additions & 0 deletions src/rgw/rgw_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -793,20 +793,30 @@ class RGWListBuckets : public RGWOp {
}

int verify_permission() override;
int verify_permission(Jager_Tracer&, const Span&) override;
void execute(Jager_Tracer&,const Span&) override;
void execute() override;

virtual int get_params() = 0;
virtual int get_params(Jager_Tracer&, const Span&) = 0;
virtual void handle_listing_chunk(rgw::sal::RGWBucketList&& buckets) {
/* The default implementation, used by e.g. S3, just generates a new
* part of listing and sends it client immediately. Swift can behave
* differently: when the reverse option is requested, all incoming
* instances of RGWBucketList are buffered and finally reversed. */
return send_response_data(buckets);
}
virtual void handle_listing_chunk(rgw::sal::RGWBucketList&& buckets, Jager_Tracer& tracer, const Span& parent_span) {
/* The default implementation, used by e.g. S3, just generates a new
* part of listing and sends it client immediately. Swift can behave
* differently: when the reverse option is requested, all incoming
* instances of RGWBucketList are buffered and finally reversed. */
return send_response_data(buckets, tracer, parent_span);
}
virtual void send_response_begin(bool has_buckets) = 0;
virtual void send_response_begin(bool has_buckets, Jager_Tracer&, const Span&, Span&) = 0;
virtual void send_response_data(rgw::sal::RGWBucketList& buckets) = 0;
virtual void send_response_data(rgw::sal::RGWBucketList& buckets, Jager_Tracer&, const Span&) = 0;
virtual void send_response_end() = 0;
virtual void send_response_end(Span, const Span&) = 0;
void send_response() override {}
Expand Down
59 changes: 59 additions & 0 deletions src/rgw/rgw_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,21 @@ int RGWRados::Bucket::List::list_objects_ordered(
return 0;
} // list_objects_ordered

int RGWRados::Bucket::List::list_objects_ordered(
int64_t max_p,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
bool *is_truncated, Jager_Tracer& tracer, const Span& parent_span,
optional_yield y)
{
Span span = tracer.child_span("rgw_rados RGWRados::Bucket::List::list_objects_ordered", parent_span);
return RGWRados::Bucket::List::list_objects_ordered(
max_p,
result,
common_prefixes,
is_truncated,
y);
}

/**
* Get listing of the objects in a bucket and allow the results to be out
Expand Down Expand Up @@ -2142,6 +2157,19 @@ int RGWRados::Bucket::List::list_objects_unordered(int64_t max_p,
return 0;
} // list_objects_unordered

int RGWRados::Bucket::List::list_objects_unordered(int64_t max_p,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
bool *is_truncated, Jager_Tracer& tracer, const Span& parent_span,
optional_yield y)
{
Span span = tracer.child_span("rgw_rados.cc RGWRados::Bucket::List::list_objects_unordered", parent_span);
return RGWRados::Bucket::List::list_objects_unordered(max_p,
result,
common_prefixes,
is_truncated,
y);
}

/**
* create a rados pool, associated meta info
Expand Down Expand Up @@ -2275,6 +2303,37 @@ int RGWRados::create_bucket(const RGWUserInfo& owner, rgw_bucket& bucket,
return -ENOENT;
}

int RGWRados::create_bucket(const RGWUserInfo& owner, rgw_bucket& bucket,
const string& zonegroup_id,
const rgw_placement_rule& placement_rule,
const string& swift_ver_location,
const RGWQuotaInfo * pquota_info,
map<std::string, bufferlist>& attrs,
RGWBucketInfo& info,
obj_version *pobjv,
obj_version *pep_objv,
real_time creation_time,
rgw_bucket *pmaster_bucket,
uint32_t *pmaster_num_shards,
Jager_Tracer& tracer, const Span& parent_span,
bool exclusive)
{
Span span = tracer.child_span("rgw_rados.cc RGWRados::create_bucket", parent_span);
return RGWRados::create_bucket(owner, bucket,
zonegroup_id,
placement_rule,
swift_ver_location,
pquota_info,
attrs,
info,
pobjv,
pep_objv,
creation_time,
pmaster_bucket,
pmaster_num_shards,
exclusive);
}

bool RGWRados::get_obj_data_pool(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_pool *pool)
{
return rgw_get_obj_data_pool(svc.zone->get_zonegroup(), svc.zone->get_zone_params(), placement_rule, obj, pool);
Expand Down
38 changes: 38 additions & 0 deletions src/rgw/rgw_rados.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,20 @@ class RGWRados
rgw_bucket *master_bucket,
uint32_t *master_num_shards,
bool exclusive = true);
int create_bucket(const RGWUserInfo& owner, rgw_bucket& bucket,
const string& zonegroup_id,
const rgw_placement_rule& placement_rule,
const string& swift_ver_location,
const RGWQuotaInfo * pquota_info,
map<std::string,bufferlist>& attrs,
RGWBucketInfo& bucket_info,
obj_version *pobjv,
obj_version *pep_objv,
ceph::real_time creation_time,
rgw_bucket *master_bucket,
uint32_t *master_num_shards,
Jager_Tracer&, const Span&,
bool exclusive = true);

RGWCoroutinesManagerRegistry *get_cr_registry() { return cr_registry; }

Expand Down Expand Up @@ -1001,11 +1015,21 @@ class RGWRados
map<string, bool> *common_prefixes,
bool *is_truncated,
optional_yield y);
int list_objects_ordered(int64_t max,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
bool *is_truncated, Jager_Tracer&, const Span&,
optional_yield y);
int list_objects_unordered(int64_t max,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
bool *is_truncated,
optional_yield y);
int list_objects_unordered(int64_t max,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
bool *is_truncated, Jager_Tracer&, const Span&,
optional_yield y);

public:

Expand Down Expand Up @@ -1043,6 +1067,20 @@ class RGWRados
is_truncated, y);
}
}

int list_objects(int64_t max,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
bool *is_truncated,Jager_Tracer& tracer, const Span& parent_span,
optional_yield y) {
if (params.allow_unordered) {
return list_objects_unordered(max, result, common_prefixes,
is_truncated, tracer, parent_span, y);
} else {
return list_objects_ordered(max, result, common_prefixes,
is_truncated, tracer, parent_span, y);
}
}
rgw_obj_key& get_next_marker() {
return next_marker;
}
Expand Down
9 changes: 8 additions & 1 deletion src/rgw/rgw_rest_s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ void RGWListBuckets_ObjStore_S3::send_response_begin(bool has_buckets)

void RGWListBuckets_ObjStore_S3::send_response_begin(bool has_buckets, Jager_Tracer& tracer, const Span& parent_span, Span& span)
{
span = tracer.child_span("rgw_rest_s3.cc RGWListBuckets_ObjStore_S3::send_response", parent_span);
span = tracer.child_span("rgw_rest_s3.cc RGWListBuckets_ObjStore_S3::send_response_begin", parent_span);
RGWListBuckets_ObjStore_S3::send_response_begin(has_buckets);
}

Expand All @@ -1226,6 +1226,12 @@ void RGWListBuckets_ObjStore_S3::send_response_data(rgw::sal::RGWBucketList& buc
rgw_flush_formatter(s, s->formatter);
}

void RGWListBuckets_ObjStore_S3::send_response_data(rgw::sal::RGWBucketList& buckets, Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_rest_s3.cc RGWListBuckets_ObjStore_S3::send_response_data", parent_span);
RGWListBuckets_ObjStore_S3::send_response_data(buckets);
}

void RGWListBuckets_ObjStore_S3::send_response_end()
{
if (sent_data) {
Expand All @@ -1239,6 +1245,7 @@ void RGWListBuckets_ObjStore_S3::send_response_end(Span span, const Span& parent
{
parent_span->SetTag("operation_gateway", "s3");
RGWListBuckets_ObjStore_S3::send_response_end();
span->Finish();
}

int RGWGetUsage_ObjStore_S3::get_params()
Expand Down
6 changes: 6 additions & 0 deletions src/rgw/rgw_rest_s3.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,15 @@ class RGWListBuckets_ObjStore_S3 : public RGWListBuckets_ObjStore {
limit = -1; /* no limit */
return 0;
}
int get_params(Jager_Tracer& tracer, const Span& parent_span) override {
Span span = tracer.child_span("rgw_rest_s3.h RGWListBuckets_ObjStore_S3::get_params", parent_span);
limit = -1; /* no limit */
return 0;
}
void send_response_begin(bool has_buckets) override;
void send_response_begin(bool has_buckets, Jager_Tracer&, const Span&, Span&) override;
void send_response_data(rgw::sal::RGWBucketList& buckets) override;
void send_response_data(rgw::sal::RGWBucketList& buckets, Jager_Tracer& tracer, const Span& parent_span) override;
void send_response_end() override;
void send_response_end(Span,const Span&) override;
};
Expand Down
26 changes: 25 additions & 1 deletion src/rgw/rgw_rest_swift.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ int RGWListBuckets_ObjStore_SWIFT::get_params()
return 0;
}

int RGWListBuckets_ObjStore_SWIFT::get_params(Jager_Tracer& tracer, const Span& parent_span){
Span span = tracer.child_span("rgw_rest_swift.cc RGWListBuckets_ObjStore_SWIFT::get_params", parent_span);
return RGWListBuckets_ObjStore_SWIFT::get_params();
}

static void dump_account_metadata(struct req_state * const s,
const RGWUsageStats& global_stats,
const std::map<std::string, RGWUsageStats> &policies_stats,
Expand Down Expand Up @@ -194,7 +199,7 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_begin(bool has_buckets)

void RGWListBuckets_ObjStore_SWIFT::send_response_begin(bool has_buckets, Jager_Tracer& tracer, const Span& parent_span, Span& span)
{
span = tracer.child_span("rgw_rest_swift.cc RGWListBuckets_ObjStore_SWIFT::send_response", parent_span);
span = tracer.child_span("rgw_rest_swift.cc RGWListBuckets_ObjStore_SWIFT::send_response_begin", parent_span);
RGWListBuckets_ObjStore_SWIFT::send_response_begin(has_buckets);
}

Expand All @@ -209,6 +214,18 @@ void RGWListBuckets_ObjStore_SWIFT::handle_listing_chunk(rgw::sal::RGWBucketList
}
}

void RGWListBuckets_ObjStore_SWIFT::handle_listing_chunk(rgw::sal::RGWBucketList&& buckets, Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_rest_swift.cc RGWListBuckets_ObjStore_SWIFT::handle_listing_chunk", parent_span);
if (wants_reversed) {
/* Just store in the reversal buffer. Its content will be handled later,
* in send_response_end(). */
reverse_buffer.emplace(std::begin(reverse_buffer), std::move(buckets));
} else {
return send_response_data(buckets, tracer, span);
}
}

void RGWListBuckets_ObjStore_SWIFT::send_response_data(rgw::sal::RGWBucketList& buckets)
{
if (! sent_data) {
Expand All @@ -227,6 +244,12 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_data(rgw::sal::RGWBucketList&
}
}

void RGWListBuckets_ObjStore_SWIFT::send_response_data(rgw::sal::RGWBucketList& buckets, Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_rest_swift.cc RGWListBuckets_ObjStore_SWIFT::send_response_data", parent_span);
RGWListBuckets_ObjStore_SWIFT::send_response_data(buckets);
}

void RGWListBuckets_ObjStore_SWIFT::dump_bucket_entry(const rgw::sal::RGWBucket& obj)
{
s->formatter->open_object_section("container");
Expand Down Expand Up @@ -303,6 +326,7 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_end(Span span, const Span& par
{
parent_span->SetTag("operation_gateway", "swift");
RGWListBuckets_ObjStore_SWIFT::send_response_end();
span->Finish();
}

int RGWListBucket_ObjStore_SWIFT::get_params()
Expand Down
3 changes: 3 additions & 0 deletions src/rgw/rgw_rest_swift.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ class RGWListBuckets_ObjStore_SWIFT : public RGWListBuckets_ObjStore {
~RGWListBuckets_ObjStore_SWIFT() override {}

int get_params() override;
int get_params(Jager_Tracer&, const Span&) override;
void handle_listing_chunk(rgw::sal::RGWBucketList&& buckets) override;
void handle_listing_chunk(rgw::sal::RGWBucketList&& buckets, Jager_Tracer&, const Span&) override;
void send_response_begin(bool has_buckets) override;
void send_response_begin(bool has_buckets, Jager_Tracer&, const Span&, Span&) override;
void send_response_data(rgw::sal::RGWBucketList& buckets) override;
void send_response_data(rgw::sal::RGWBucketList& buckets, Jager_Tracer&, const Span&) override;
void send_response_data_reversed(rgw::sal::RGWBucketList& buckets);
void dump_bucket_entry(const rgw::sal::RGWBucket& obj);
void send_response_end() override;
Expand Down
22 changes: 22 additions & 0 deletions src/rgw/rgw_sal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,28 @@ int RGWRadosUser::list_buckets(const string& marker, const string& end_marker,
return 0;
}

int RGWRadosUser::list_buckets(const string& marker, const string& end_marker,
uint64_t max, bool need_stats, RGWBucketList &buckets, Jager_Tracer& tracer, const Span& parent_span)
{
Span span = tracer.child_span("rgw_sal.cc RGWRadosUser::list_buckets", parent_span);
RGWUserBuckets ulist;
bool is_truncated = false;
int ret;

ret = store->ctl()->user->list_buckets(info.user_id, marker, end_marker, max,
need_stats, &ulist, &is_truncated, tracer, span);
if (ret < 0)
return ret;

buckets.set_truncated(is_truncated);
for (const auto& ent : ulist.get_buckets()) {
RGWRadosBucket *rb = new RGWRadosBucket(this->store, *this, ent.second);
buckets.add(rb);
}

return 0;
}

RGWBucketList::~RGWBucketList()
{
for (auto itr = buckets.begin(); itr != buckets.end(); itr++) {
Expand Down
2 changes: 2 additions & 0 deletions src/rgw/rgw_sal.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class RGWRadosUser : public RGWUser {

int list_buckets(const string& marker, const string& end_marker,
uint64_t max, bool need_stats, RGWBucketList& buckets);
int list_buckets(const string& marker, const string& end_marker,
uint64_t max, bool need_stats, RGWBucketList& buckets, Jager_Tracer&, const Span&);
RGWBucket* add_bucket(rgw_bucket& bucket, ceph::real_time creation_time);

/* Placeholders */
Expand Down
Loading