Skip to content

Commit 65249ea

Browse files
committed
MB-32557: Remove "stats settings"
The settings stats group is not used by cbcollect_info so we can remove it to reduce the amount of code to maintain. Change-Id: I0e660427cb8735df34c15bc43524d80c91d70782 Reviewed-on: http://review.couchbase.org/103541 Tested-by: Build Bot <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent 62769ea commit 65249ea

File tree

2 files changed

+0
-147
lines changed

2 files changed

+0
-147
lines changed

daemon/protocol/mcbp/stats_context.cc

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -289,106 +289,6 @@ static ENGINE_ERROR_CODE server_stats(ADD_STAT add_stat_callback,
289289
return ENGINE_SUCCESS;
290290
}
291291

292-
static void process_stat_settings(ADD_STAT add_stat_callback, Cookie& cookie) {
293-
if (add_stat_callback == nullptr) {
294-
throw std::invalid_argument("process_stat_settings: "
295-
"add_stat_callback must be non-NULL");
296-
}
297-
add_stat(cookie, add_stat_callback, "maxconns", settings.getMaxconns());
298-
299-
try {
300-
for (auto& ifce : stats.listening_ports) {
301-
char interface[1024];
302-
int offset;
303-
if (ifce.host.empty()) {
304-
offset = checked_snprintf(interface, sizeof(interface),
305-
"interface-*:%u",
306-
ifce.port);
307-
} else {
308-
offset = checked_snprintf(interface, sizeof(interface),
309-
"interface-%s:%u",
310-
ifce.host.c_str(),
311-
ifce.port);
312-
}
313-
314-
checked_snprintf(interface + offset, sizeof(interface) - offset,
315-
"-maxconn");
316-
add_stat(cookie, add_stat_callback, interface, ifce.maxconns);
317-
checked_snprintf(interface + offset, sizeof(interface) - offset,
318-
"-ipv4");
319-
add_stat(cookie, add_stat_callback, interface, ifce.ipv4);
320-
checked_snprintf(interface + offset, sizeof(interface) - offset,
321-
"-ipv6");
322-
add_stat(cookie, add_stat_callback, interface, ifce.ipv6);
323-
324-
checked_snprintf(interface + offset, sizeof(interface) - offset,
325-
"-tcp_nodelay");
326-
add_stat(cookie, add_stat_callback, interface, ifce.tcp_nodelay);
327-
328-
auto ssl = ifce.getSslSettings();
329-
if (ssl) {
330-
checked_snprintf(interface + offset, sizeof(interface) - offset,
331-
"-ssl-pkey");
332-
add_stat(cookie, add_stat_callback, interface, ssl->key);
333-
checked_snprintf(interface + offset, sizeof(interface) - offset,
334-
"-ssl-cert");
335-
add_stat(cookie, add_stat_callback, interface, ssl->cert);
336-
} else {
337-
checked_snprintf(interface + offset, sizeof(interface) - offset,
338-
"-ssl");
339-
add_stat(cookie, add_stat_callback, interface, "false");
340-
}
341-
}
342-
} catch (const std::exception& error) {
343-
LOG_WARNING("process_stats_settings: Error building stats: {}",
344-
error.what());
345-
}
346-
347-
add_stat(cookie, add_stat_callback, "verbosity", settings.getVerbose());
348-
add_stat(cookie, add_stat_callback, "num_threads", settings.getNumWorkerThreads());
349-
add_stat(cookie, add_stat_callback, "reqs_per_event_high_priority",
350-
settings.getRequestsPerEventNotification(EventPriority::High));
351-
add_stat(cookie, add_stat_callback, "reqs_per_event_med_priority",
352-
settings.getRequestsPerEventNotification(EventPriority::Medium));
353-
add_stat(cookie, add_stat_callback, "reqs_per_event_low_priority",
354-
settings.getRequestsPerEventNotification(EventPriority::Low));
355-
add_stat(cookie, add_stat_callback, "reqs_per_event_def_priority",
356-
settings.getRequestsPerEventNotification(EventPriority::Default));
357-
add_stat(cookie, add_stat_callback, "auth_enabled_sasl", "yes");
358-
add_stat(cookie, add_stat_callback, "auth_sasl_engine", "cbsasl");
359-
360-
add_stat(cookie, add_stat_callback, "audit",
361-
settings.getAuditFile().c_str());
362-
363-
add_stat(cookie, add_stat_callback, "connection_idle_time",
364-
std::to_string(settings.getConnectionIdleTime()).c_str());
365-
add_stat(cookie,
366-
add_stat_callback,
367-
"datatype_json",
368-
settings.isDatatypeJsonEnabled() ? "true" : "false");
369-
add_stat(cookie,
370-
add_stat_callback,
371-
"datatype_snappy",
372-
settings.isDatatypeSnappyEnabled() ? "true" : "false");
373-
add_stat(cookie, add_stat_callback, "dedupe_nmvb_maps",
374-
settings.isDedupeNmvbMaps() ? "true" : "false");
375-
add_stat(cookie, add_stat_callback, "max_packet_size",
376-
std::to_string(settings.getMaxPacketSize()).c_str());
377-
add_stat(cookie, add_stat_callback, "xattr_enabled",
378-
settings.isXattrEnabled());
379-
add_stat(cookie, add_stat_callback, "privilege_debug",
380-
settings.isPrivilegeDebug());
381-
382-
add_stat(cookie,
383-
add_stat_callback,
384-
"collections_enabled",
385-
settings.isCollectionsEnabled());
386-
add_stat(cookie,
387-
add_stat_callback,
388-
"external_auth_service",
389-
settings.isExternalAuthServiceEnabled());
390-
}
391-
392292
static void append_bin_stats(const char* key,
393293
const uint16_t klen,
394294
const char* val,
@@ -529,23 +429,6 @@ static ENGINE_ERROR_CODE stat_sched_executor(const std::string& arg,
529429
}
530430
}
531431

532-
/**
533-
* Handler for the <code>stats settings</code> used to get the current
534-
* settings.
535-
*
536-
* @param arg - should be empty
537-
* @param cookie the command context
538-
*/
539-
static ENGINE_ERROR_CODE stat_settings_executor(const std::string& arg,
540-
Cookie& cookie) {
541-
if (arg.empty()) {
542-
process_stat_settings(&append_stats, cookie);
543-
return ENGINE_SUCCESS;
544-
} else {
545-
return ENGINE_EINVAL;
546-
}
547-
}
548-
549432
/**
550433
* Handler for the <code>stats audit</code> used to get statistics from
551434
* the audit subsystem.
@@ -849,7 +732,6 @@ static std::unordered_map<std::string, struct command_stat_handler>
849732
{"", {false, stat_all_stats}},
850733
{"reset", {true, stat_reset_executor}},
851734
{"worker_thread_info", {false, stat_sched_executor}},
852-
{"settings", {false, stat_settings_executor}},
853735
{"audit", {true, stat_audit_executor}},
854736
{"bucket_details", {true, stat_bucket_details_executor}},
855737
{"aggregate", {false, stat_aggregate_executor}},

tests/testapp/testapp_stats.cc

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -267,35 +267,6 @@ TEST_P(StatsTest, TestAppend) {
267267
EXPECT_EQ(11, cmd_set->valueint);
268268
}
269269

270-
TEST_P(StatsTest, TestSettings) {
271-
MemcachedConnection& conn = getConnection();
272-
// @todo verify that I get all of the expected settings. for now
273-
// just verify that I've got the ones I expect...
274-
unique_cJSON_ptr stats;
275-
ASSERT_NO_THROW(stats = conn.stats("settings"));
276-
ASSERT_NE(nullptr, stats.get());
277-
ASSERT_NE(nullptr, cJSON_GetObjectItem(stats.get(), "maxconns"));
278-
279-
// skip interfaces....
280-
281-
ASSERT_NE(nullptr, cJSON_GetObjectItem(stats.get(), "verbosity"));
282-
ASSERT_NE(nullptr, cJSON_GetObjectItem(stats.get(), "num_threads"));
283-
ASSERT_NE(nullptr,
284-
cJSON_GetObjectItem(stats.get(), "reqs_per_event_high_priority"));
285-
ASSERT_NE(nullptr,
286-
cJSON_GetObjectItem(stats.get(), "reqs_per_event_med_priority"));
287-
ASSERT_NE(nullptr,
288-
cJSON_GetObjectItem(stats.get(), "reqs_per_event_low_priority"));
289-
ASSERT_NE(nullptr,
290-
cJSON_GetObjectItem(stats.get(), "reqs_per_event_def_priority"));
291-
ASSERT_NE(nullptr, cJSON_GetObjectItem(stats.get(), "auth_enabled_sasl"));
292-
ASSERT_NE(nullptr, cJSON_GetObjectItem(stats.get(), "auth_sasl_engine"));
293-
294-
// skip extensions, loggers and daemons
295-
296-
// Skip audit.. it is "optional" and we don't pass it to the config
297-
}
298-
299270
TEST_P(StatsTest, TestAuditNoAccess) {
300271
MemcachedConnection& conn = getConnection();
301272

0 commit comments

Comments
 (0)