@@ -285,6 +285,17 @@ if test "x$enable_coverage" != xno; then
fi
AC_SUBST(GCOV_PREFIX_STRIP, `echo $(pwd)/src | tr -dc / | wc -c`)
+# blkin (lttng+zipkin) tracing?
+AC_ARG_WITH([blkin],
+ [AS_HELP_STRING([--with-blkin], [blkin (lttng + zipkin) tracing])],
+ [],
+ [with_blkin=no])
+have_blkin=no
+AS_IF([test "x$with_blkin" == "xyes"],
+ [PKG_CHECK_MODULES([BLKIN], [blkin], [have_blkin=yes])])
+AM_CONDITIONAL(WITH_BLKIN, test "x$have_blkin" == xyes)
+AM_COND_IF([WITH_BLKIN], [AC_DEFINE([WITH_BLKIN], [1], [Defined if using BlkKin])])
+
# radosgw?
AC_ARG_WITH([radosgw],
[AS_HELP_STRING([--with-radosgw], [build RADOS gateway])],
@@ -5,6 +5,7 @@ usage() {
do_autogen.sh: make a ceph build by running autogen, etc.
-h: this help message
+-b blkin tracing
-d <level> debug build
level 0: no debug
level 1: -g
@@ -30,9 +31,11 @@ debug_level=0
verbose=0
profile=0
CONFIGURE_FLAGS=""
-while getopts "d:e:hHTPjpnvO:" flag
+while getopts "bd:e:hHTPjpnvO:" flag
do
case $flag in
+ b) CONFIGURE_FLAGS="$CONFIGURE_FLAGS --with-blkin";;
+
d) debug_level=$OPTARG;;
O) CFLAGS="${CFLAGS} -O$OPTARG";;
new file mode 100644
@@ -0,0 +1,88 @@
+=========================
+ Tracing Ceph With BlkKin
+=========================
+
+Ceph can use Blkin, a library created by Marios Kogias and others,
+which enables tracking a specific request from the time it enters
+the system at higher levels till it is finally served by RADOS.
+
+In general, Blkin implements the Dapper_ tracing semantics
+in order to show the causal relationships between the different
+processing phases that an IO request may trigger. The goal is an
+end-to-end visualisation of the request's route in the system,
+accompanied by information concerning latencies in each processing
+phase. Thanks to LTTng this can happen with a minimal overhead and
+in realtime. The LTTng traces can then be visualized with Twitter's
+Zipkin_.
+
+.. _Dapper: http://static.googleusercontent.com/media/research.google.com/el//pubs/archive/36356.pdf
+.. _Zipkin: http://twitter.github.io/zipkin/
+
+Testing Blkin
+=============
+
+It's easy to test Ceph's Blkin tracing. Compile Ceph with the Blkin
+changes, then launch Ceph with the vstart script so you can see the
+possible tracepoints.::
+
+ cd src
+ OSD=3 MON=3 RGW=1 ./vstart.sh -n
+ lttng list --userspace
+
+You'll see something like the following:::
+
+ UST events:
+ -------------
+ PID: 8987 - Name: ./ceph-osd
+ zipkin:timestamp (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+ zipkin:keyval (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+ ust_baddr_statedump:soinfo (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint)
+
+ PID: 8407 - Name: ./ceph-mon
+ zipkin:timestamp (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+ zipkin:keyval (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+ ust_baddr_statedump:soinfo (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint)
+
+ ...
+
+Next, stop Ceph so that the tracepoints can be enabled.::
+
+ ./stop.sh
+
+Start up an LTTng session and enable the tracepoints.::
+
+ lttng create blkin-test
+ lttng enable-event --userspace zipkin:timestamp
+ lttng enable-event --userspace zipkin:keyval
+ lttng start
+
+Then start up Ceph again.::
+
+ OSD=3 MON=3 RGW=1 ./vstart.sh -n
+
+You may want to check that ceph is up.::
+
+ ./ceph status
+
+Now put something in usin rados, check that it made it, get it back, and remove it.::
+
+ rados put test-object-1 ./vstart.sh --pool=data
+ rados -p data ls
+ ceph osd map data test-object-1
+ rados get test-object-1 ./vstart-copy.sh --pool=data
+ md5sum vstart*
+ rados rm test-object-1 --pool=data
+
+You could also use the example in ``examples/librados/``.
+
+Then stop the LTTng session and see what was collected.::
+
+ lttng stop
+ lttng view
+
+You'll see something like:::
+
+ [13:09:07.755054973] (+?.?????????) scruffy zipkin:timestamp: { cpu_id = 5 }, { trace_name = "Main", service_name = "MOSDOp", port_no = 0, ip = "0.0.0.0", trace_id = 7492589359882233221, span_id = 2694140257089376129, parent_span_id = 0, event = "Message allocated" }
+ [13:09:07.755071569] (+0.000016596) scruffy zipkin:keyval: { cpu_id = 5 }, { trace_name = "Main", service_name = "MOSDOp", port_no = 0, ip = "0.0.0.0", trace_id = 7492589359882233221, span_id = 2694140257089376129, parent_span_id = 0, key = "Type", val = "MOSDOp" }
+ [13:09:07.755074217] (+0.000002648) scruffy zipkin:keyval: { cpu_id = 5 }, { trace_name = "Main", service_name = "MOSDOp", port_no = 0, ip = "0.0.0.0", trace_id = 7492589359882233221, span_id = 2694140257089376129, parent_span_id = 0, key = "Reqid", val = "client.4126.0:1" }
+ ...
@@ -167,6 +167,12 @@ if ENABLE_COVERAGE
EXTRALIBS += -lgcov
endif # ENABLE_COVERAGE
+if WITH_BLKIN
+AM_CPPFLAGS += -DWITH_BLKIN
+AM_CXXFLAGS += $(BLKIN_CFLAGS)
+EXTRALIBS += $(BLKIN_LIBS)
+endif
+
# Libosd always needs osdc and os
LIBOSD += $(LIBOSDC) $(LIBOS)
@@ -38,10 +38,20 @@ include tools/Makefile.am
ceph_mon_SOURCES = ceph_mon.cc
ceph_mon_LDADD = $(LIBMON) $(LIBOS) $(CEPH_GLOBAL) $(LIBCOMMON)
+if WITH_BLKIN
+ceph_mon_CPPFLAGS = -DWITH_BLKIN $(AM_CPPFLAGS)
+ceph_mon_CXXFLAGS = $(BLKIN_CFLAGS) $(AM_CXXFLAGS)
+ceph_mon_LDADD += $(BLKIN_LIBS)
+endif
bin_PROGRAMS += ceph-mon
ceph_osd_SOURCES = ceph_osd.cc
ceph_osd_LDADD = $(LIBOSD) $(CEPH_GLOBAL) $(LIBCOMMON)
+if WITH_BLKIN
+ceph_osd_CPPFLAGS = -DWITH_BLKIN $(AM_CPPFLAGS)
+ceph_osd_CXXFLAGS = $(BLKIN_CFLAGS) $(AM_CXXFLAGS)
+ceph_osd_LDADD += $(BLKIN_LIBS)
+endif
bin_PROGRAMS += ceph-osd
ceph_mds_SOURCES = ceph_mds.cc
@@ -9,6 +9,13 @@ librados_la_CXXFLAGS = ${AM_CXXFLAGS}
LIBRADOS_DEPS += libcls_lock_client.la $(LIBOSDC) $(LIBCOMMON)
librados_la_LIBADD = $(LIBRADOS_DEPS) $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS)
+
+if WITH_BLKIN
+librados_la_CPPFLAGS = -DWITH_BLKIN $(AM_CPPFLAGS)
+librados_la_CXXFLAGS += $(BLKIN_CXXFLAGS)
+librados_la_LIBADD += $(BLKIN_LIBS)
+endif
+
librados_la_LDFLAGS = ${AM_LDFLAGS} -version-info 2:0:0
if LINUX
librados_la_LDFLAGS += -export-symbols-regex '^rados_.*'
@@ -15,6 +15,12 @@ libmon_la_SOURCES = \
mon/DataHealthService.cc \
mon/ConfigKeyService.cc
libmon_la_LIBADD = $(LIBAUTH) $(LIBCOMMON) $(LIBOS)
+
+if WITH_BLKIN
+libmon_la_CXXFLAGS = $(BLKIN_CFLAGS) $(AM_CXXFLAGS)
+libmon_la_LIBADD += $(BLKIN_LIBS)
+endif
+
noinst_LTLIBRARIES += libmon.la
noinst_HEADERS += \
@@ -43,4 +49,3 @@ noinst_HEADERS += \
mon/QuorumService.h \
mon/Session.h \
mon/mon_types.h
-
@@ -7,6 +7,12 @@ libmsg_la_SOURCES = \
msg/SimpleMessenger.cc \
msg/msg_types.cc
+if WITH_BLKIN
+libmsg_la_CPPFLAGS = -DWITH_BLKIN $(AM_CPPFLAGS)
+libmsg_la_CXXFLAGS = $(BLKIN_CFLAGS) $(AM_CXXFLAGS)
+libmsg_la_LIBADD = $(BLKIN_LIBS)
+endif
+
noinst_HEADERS += \
msg/Accepter.h \
msg/DispatchQueue.h \
@@ -29,6 +29,12 @@ if WITH_LIBZFS
libos_la_SOURCES += os/ZFSFileStoreBackend.cc
endif
+if WITH_BLKIN
+libos_la_CPPFLAGS = -DWITH_BLKIN $(AM_CPPFLAGS)
+libos_la_CXXFLAGS = $(BLKIN_CFLAGS) $(AM_CXXFLAGS)
+libos_la_LIBADD = $(BLKIN_LIBS)
+endif
+
noinst_LTLIBRARIES += libos.la
noinst_HEADERS += \
@@ -20,6 +20,13 @@ libosd_la_SOURCES = \
osd/ECUtil.cc \
objclass/class_api.cc
libosd_la_LIBADD = $(LIBOSDC) $(LIBOS)
+
+if WITH_BLKIN
+libosd_la_CPPFLAGS = -DWITH_BLKIN $(AM_CPPFLAGS)
+libosd_la_CXXFLAGS = $(BLKIN_CFLAGS) $(AM_CXXFLAGS)
+libosd_la_LIBADD += $(BLKIN_LIBS)
+endif
+
noinst_LTLIBRARIES += libosd.la
noinst_HEADERS += \
@@ -4,6 +4,13 @@ libosdc_la_SOURCES = \
osdc/Filer.cc \
osdc/Striper.cc \
osdc/Journaler.cc
+
+if WITH_BLKIN
+libosdc_la_CPPFLAGS = -DWITH_BLKIN $(AM_CPPFLAGS)
+libosdc_la_CXXFLAGS = $(BLKIN_CFLAGS) $(AM_CXXFLAGS)
+libosdc_la_LIBADD = $(BLKIN_LIBS)
+endif
+
noinst_LTLIBRARIES += libosdc.la
noinst_HEADERS += \