From: Casey Bodley Date: Thu, 20 Aug 2015 18:03:00 +0000 (-0400) Subject: blkin: add header and initialization X-Git-Tag: v12.0.3~73^2~29 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6862811ee2cff28da006d262cb047e322d033d4b;p=ceph.git blkin: add header and initialization zipkin_trace.h is a wrapper around ztracer.hpp, which provides a stub implementation when WITH_BLKIN is not defined Signed-off-by: Casey Bodley --- diff --git a/src/common/common_init.cc b/src/common/common_init.cc index ffe4baec7974..161af4e5a402 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -124,6 +124,7 @@ void complain_about_parse_errors(CephContext *cct, void common_init_finish(CephContext *cct) { cct->init_crypto(); + ZTracer::ztrace_init(); int flags = cct->get_init_flags(); if (!(flags & CINIT_FLAG_NO_DAEMON_ACTIONS)) diff --git a/src/common/zipkin_trace.h b/src/common/zipkin_trace.h new file mode 100644 index 000000000000..94716b4ad97a --- /dev/null +++ b/src/common/zipkin_trace.h @@ -0,0 +1,69 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +#ifndef COMMON_ZIPKIN_TRACE_H +#define COMMON_ZIPKIN_TRACE_H + +#include +#include "acconfig.h" + +#ifdef WITH_BLKIN + +#include + +#else // !WITH_BLKIN + +// add stubs for noop Trace and Endpoint +struct blkin_trace_info {}; + +namespace ZTracer +{ +static inline int ztrace_init() { return 0; } + +class Endpoint { + public: + Endpoint(const char *name) {} + Endpoint(const char *ip, int port, const char *name) {} + + void copy_ip(const std::string &newip) {} + void copy_name(const std::string &newname) {} + void copy_address_from(const Endpoint *endpoint) {} + void share_address_from(const Endpoint *endpoint) {} + void set_port(int p) {} +}; + +class Trace { + public: + Trace() {} + Trace(const char *name, const Endpoint *ep, const Trace *parent = NULL) {} + Trace(const char *name, const Endpoint *ep, + const blkin_trace_info *i, bool child=false) {} + + bool valid() const { return false; } + operator bool() const { return false; } + + int init(const char *name, const Endpoint *ep, const Trace *parent = NULL) { + return 0; + } + int init(const char *name, const Endpoint *ep, + const blkin_trace_info *i, bool child=false) { + return 0; + } + + void copy_name(const std::string &newname) {} + + const blkin_trace_info* get_info() const { return NULL; } + void set_info(const blkin_trace_info *i) {} + + void keyval(const char *key, const char *val) const {} + void keyval(const char *key, int64_t val) const {} + void keyval(const char *key, const char *val, const Endpoint *ep) const {} + void keyval(const char *key, int64_t val, const Endpoint *ep) const {} + + void event(const char *event) const {} + void event(const char *event, const Endpoint *ep) const {} +}; +} // namespace ZTrace + +#endif // !WITH_BLKIN + +#endif // COMMON_ZIPKIN_TRACE_H