Пример #1
0
static mtev_hook_return_t
handle_log_line(void *closure, mtev_log_stream_t ls, const struct timeval *whence,
                const char *timebuf, int timebuflen,
                const char *debugbuf, int debugbuflen,
                const char *line, size_t len) {
  if(!ls) return MTEV_HOOK_CONTINUE;
  const char *name = mtev_log_stream_get_name(ls);
  if(!name ||
     (strcmp(name,"metrics") && strcmp(name,"bundle") &&
      strcmp(name,"check") && strcmp(name,"status")))
    return MTEV_HOOK_CONTINUE;
  handle_metric_buffer(line, len, 0);
  return MTEV_HOOK_CONTINUE;
}
void
noit_websocket_closure_free(void *jcl) {
  noit_websocket_closure_t *w = jcl;
  if (w->check) noit_check_transient_remove_feed(w->check, w->feed);
  free(w->feed);

  mtev_log_stream_close(w->log_stream);
  mtev_log_stream_remove(mtev_log_stream_get_name(w->log_stream));
  mtev_log_stream_free(w->log_stream);

  for (int i = 0; i < w->filter_count; i++) {
    free(w->filters[i]);
  }
  free(w->filters);

  free(w);
}