diff --git a/src/frontend/query.c b/src/frontend/query.c
index 4ae4f64a5e0a1373f5ff6ddfb416c277aa546f36..f8d6a1f2dc8e518ca3843752794789f94361b3d4 100644 (file)
--- a/src/frontend/query.c
+++ b/src/frontend/query.c
@@ -248,7 +248,13 @@ exec_timeseries(sdb_ast_timeseries_t *ts, sdb_strbuf_t *buf, sdb_strbuf_t *errbu
}
if (status >= 0) {
series = sdb_plugin_fetch_timeseries(st.type, st.id, &opts);
}
if (status >= 0) {
series = sdb_plugin_fetch_timeseries(st.type, st.id, &opts);
- if (! series) {
+ if (series) {
+ uint32_t res_type = htonl(SDB_CONNECTION_TIMESERIES);
+ sdb_strbuf_memcpy(buf, &res_type, sizeof(res_type));
+ sdb_timeseries_tojson(series, buf);
+ sdb_timeseries_destroy(series);
+ }
+ else {
sdb_log(SDB_LOG_ERR, "frontend: Failed to fetch time-series '%s/%s' "
"- %s fetcher callback returned no data for '%s'",
ts->hostname, ts->metric, st.type, st.id);
sdb_log(SDB_LOG_ERR, "frontend: Failed to fetch time-series '%s/%s' "
"- %s fetcher callback returned no data for '%s'",
ts->hostname, ts->metric, st.type, st.id);
@@ -256,11 +262,6 @@ exec_timeseries(sdb_ast_timeseries_t *ts, sdb_strbuf_t *buf, sdb_strbuf_t *errbu
}
}
}
}
- if (status >= 0) {
- sdb_timeseries_tojson(series, buf);
- sdb_timeseries_destroy(series);
- }
-
free(fetch.hostname);
free(fetch.name);
if (st.type)
free(fetch.hostname);
free(fetch.name);
if (st.type)
int
sdb_conn_store(sdb_conn_t *conn)
{
int
sdb_conn_store(sdb_conn_t *conn)
{
- sdb_ast_node_t *ast;
+ sdb_ast_node_t *ast = NULL;
const char *buf = sdb_strbuf_string(conn->buf);
size_t len = conn->cmd_len;
uint32_t type;
const char *buf = sdb_strbuf_string(conn->buf);
size_t len = conn->cmd_len;
uint32_t type;