fix/TD-31542-monitorfw
This commit is contained in:
parent
456f0d888a
commit
00c5a213e8
|
@ -22,7 +22,10 @@
|
||||||
#ifdef TAOS_ASSERT_ENABLE
|
#ifdef TAOS_ASSERT_ENABLE
|
||||||
#define TAOS_ASSERT(i) assert(i);
|
#define TAOS_ASSERT(i) assert(i);
|
||||||
#else
|
#else
|
||||||
#define TAOS_ASSERT(i)
|
#define TAOS_ASSERT(i) \
|
||||||
|
if (i) return 1;
|
||||||
|
#define TAOS_ASSERT_NULL(i) \
|
||||||
|
if (i) return NULL;
|
||||||
#endif // TAOS_TEST
|
#endif // TAOS_TEST
|
||||||
|
|
||||||
#endif // TAOS_ASSERT_H
|
#endif // TAOS_ASSERT_H
|
||||||
|
|
|
@ -120,7 +120,7 @@ int taos_collector_remove_metric(taos_collector_t *self, const char* key){
|
||||||
}
|
}
|
||||||
|
|
||||||
taos_metric_t* taos_collector_get_metric(taos_collector_t *self, char *metric_name){
|
taos_metric_t* taos_collector_get_metric(taos_collector_t *self, char *metric_name){
|
||||||
TAOS_ASSERT(self != NULL);
|
TAOS_ASSERT_NULL(self != NULL);
|
||||||
if (self == NULL) return NULL;
|
if (self == NULL) return NULL;
|
||||||
return taos_map_get(self->metrics, metric_name);
|
return taos_map_get(self->metrics, metric_name);
|
||||||
}
|
}
|
|
@ -126,7 +126,7 @@ int taos_collector_registry_register_metric(taos_metric_t *metric) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int taos_collector_registry_deregister_metric(const char *key) {
|
int taos_collector_registry_deregister_metric(const char *key) {
|
||||||
TAOS_ASSERT(metric != NULL);
|
TAOS_ASSERT(key != NULL);
|
||||||
|
|
||||||
taos_collector_t *default_collector =
|
taos_collector_t *default_collector =
|
||||||
(taos_collector_t *)taos_map_get(TAOS_COLLECTOR_REGISTRY_DEFAULT->collectors, "default");
|
(taos_collector_t *)taos_map_get(TAOS_COLLECTOR_REGISTRY_DEFAULT->collectors, "default");
|
||||||
|
@ -139,7 +139,7 @@ int taos_collector_registry_deregister_metric(const char *key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
taos_metric_t *taos_collector_registry_get_metric(char* metric_name){
|
taos_metric_t *taos_collector_registry_get_metric(char* metric_name){
|
||||||
TAOS_ASSERT(metric != NULL);
|
TAOS_ASSERT_NULL(metric_name != NULL);
|
||||||
|
|
||||||
taos_collector_t *default_collector =
|
taos_collector_t *default_collector =
|
||||||
(taos_collector_t *)taos_map_get(TAOS_COLLECTOR_REGISTRY_DEFAULT->collectors, "default");
|
(taos_collector_t *)taos_map_get(TAOS_COLLECTOR_REGISTRY_DEFAULT->collectors, "default");
|
||||||
|
|
|
@ -69,7 +69,7 @@ int taos_linked_list_destroy(taos_linked_list_t *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *taos_linked_list_first(taos_linked_list_t *self) {
|
void *taos_linked_list_first(taos_linked_list_t *self) {
|
||||||
TAOS_ASSERT(self != NULL);
|
TAOS_ASSERT_NULL(self != NULL);
|
||||||
if (self->head) {
|
if (self->head) {
|
||||||
return self->head->item;
|
return self->head->item;
|
||||||
} else {
|
} else {
|
||||||
|
@ -78,7 +78,7 @@ void *taos_linked_list_first(taos_linked_list_t *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *taos_linked_list_last(taos_linked_list_t *self) {
|
void *taos_linked_list_last(taos_linked_list_t *self) {
|
||||||
TAOS_ASSERT(self != NULL);
|
TAOS_ASSERT_NULL(self != NULL);
|
||||||
if (self->tail) {
|
if (self->tail) {
|
||||||
return self->tail->item;
|
return self->tail->item;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -199,7 +199,7 @@ static void *taos_map_get_internal(const char *key, size_t *size, size_t *max_si
|
||||||
}
|
}
|
||||||
|
|
||||||
void *taos_map_get(taos_map_t *self, const char *key) {
|
void *taos_map_get(taos_map_t *self, const char *key) {
|
||||||
TAOS_ASSERT(self != NULL);
|
TAOS_ASSERT_NULL(self != NULL);
|
||||||
int r = 0;
|
int r = 0;
|
||||||
r = pthread_rwlock_wrlock(self->rwlock);
|
r = pthread_rwlock_wrlock(self->rwlock);
|
||||||
if (r) {
|
if (r) {
|
||||||
|
@ -217,7 +217,7 @@ void *taos_map_get(taos_map_t *self, const char *key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *taos_map_get_withoutlock(taos_map_t *self, const char *key) {
|
void *taos_map_get_withoutlock(taos_map_t *self, const char *key) {
|
||||||
TAOS_ASSERT(self != NULL);
|
TAOS_ASSERT_NULL(self != NULL);
|
||||||
int r = 0;
|
int r = 0;
|
||||||
void *payload =
|
void *payload =
|
||||||
taos_map_get_internal(key, &self->size, &self->max_size, self->keys, self->addrs, self->free_value_fn);
|
taos_map_get_internal(key, &self->size, &self->max_size, self->keys, self->addrs, self->free_value_fn);
|
||||||
|
|
|
@ -144,7 +144,7 @@ void taos_metric_free_generic(void *item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
taos_metric_sample_t *taos_metric_sample_from_labels(taos_metric_t *self, const char **label_values) {
|
taos_metric_sample_t *taos_metric_sample_from_labels(taos_metric_t *self, const char **label_values) {
|
||||||
TAOS_ASSERT(self != NULL);
|
TAOS_ASSERT_NULL(self != NULL);
|
||||||
int r = 0;
|
int r = 0;
|
||||||
r = pthread_rwlock_wrlock(self->rwlock);
|
r = pthread_rwlock_wrlock(self->rwlock);
|
||||||
if (r) {
|
if (r) {
|
||||||
|
|
|
@ -193,7 +193,7 @@ int taos_metric_formatter_clear(taos_metric_formatter_t *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *taos_metric_formatter_dump(taos_metric_formatter_t *self) {
|
char *taos_metric_formatter_dump(taos_metric_formatter_t *self) {
|
||||||
TAOS_ASSERT(self != NULL);
|
TAOS_ASSERT_NULL(self != NULL);
|
||||||
int r = 0;
|
int r = 0;
|
||||||
if (self == NULL) return NULL;
|
if (self == NULL) return NULL;
|
||||||
char *data = taos_string_builder_dump(self->string_builder);
|
char *data = taos_string_builder_dump(self->string_builder);
|
||||||
|
|
|
@ -140,7 +140,7 @@ size_t taos_string_builder_len(taos_string_builder_t *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *taos_string_builder_dump(taos_string_builder_t *self) {
|
char *taos_string_builder_dump(taos_string_builder_t *self) {
|
||||||
TAOS_ASSERT(self != NULL);
|
TAOS_ASSERT_NULL(self != NULL);
|
||||||
// +1 to accommodate \0
|
// +1 to accommodate \0
|
||||||
char *out = (char *)taos_malloc((self->len + 1) * sizeof(char));
|
char *out = (char *)taos_malloc((self->len + 1) * sizeof(char));
|
||||||
memcpy(out, self->str, self->len + 1);
|
memcpy(out, self->str, self->len + 1);
|
||||||
|
@ -148,6 +148,6 @@ char *taos_string_builder_dump(taos_string_builder_t *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *taos_string_builder_str(taos_string_builder_t *self) {
|
char *taos_string_builder_str(taos_string_builder_t *self) {
|
||||||
TAOS_ASSERT(self != NULL);
|
TAOS_ASSERT_NULL(self != NULL);
|
||||||
return self->str;
|
return self->str;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue