|
17 | 17 | #include "steppable_command_context.h" |
18 | 18 | #include "executors.h" |
19 | 19 |
|
| 20 | +#include <daemon/buckets.h> |
20 | 21 | #include <daemon/connection.h> |
21 | 22 | #include <daemon/cookie.h> |
22 | 23 | #include <daemon/front_end_thread.h> |
23 | 24 | #include <daemon/memcached.h> |
24 | 25 | #include <daemon/stats.h> |
25 | 26 | #include <logger/logger.h> |
| 27 | +#include <platform/histogram.h> |
| 28 | +#include <platform/scope_timer.h> |
| 29 | +#include <utilities/hdrhistogram.h> |
26 | 30 |
|
27 | 31 | SteppableCommandContext::SteppableCommandContext(Cookie& cookie_) |
28 | 32 | : cookie(cookie_), connection(cookie.getConnection()) { |
@@ -60,6 +64,14 @@ void SteppableCommandContext::drive() { |
60 | 64 | void SteppableCommandContext::setDatatypeJSONFromValue( |
61 | 65 | const cb::const_byte_buffer& value, |
62 | 66 | protocol_binary_datatype_t& datatype) { |
| 67 | + // Record how long JSON checking takes to both Tracer and bucket-level |
| 68 | + // histogram. |
| 69 | + using namespace cb::tracing; |
| 70 | + ScopeTimer2<HdrMicroSecStopwatch, SpanStopwatch> timer( |
| 71 | + std::forward_as_tuple( |
| 72 | + cookie.getConnection().getBucket().jsonValidateTimes), |
| 73 | + std::forward_as_tuple(cookie, Code::JsonValidate)); |
| 74 | + |
63 | 75 | // Determine if document is JSON or not. We do not trust what the client |
64 | 76 | // sent - instead we check for ourselves. |
65 | 77 | if (connection.getThread().validator.validate(value.data(), value.size())) { |
|
0 commit comments