summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfumingwei <[email protected]>2023-03-28 19:06:49 +0800
committerfumingwei <[email protected]>2023-03-28 19:06:49 +0800
commit1e22236b3fdce7446422fedb03594cf09c3d4cfb (patch)
treeba2f884e6a9b9ad39cc255f1445b0492ad8b7553
parent1b65cc6b0cabca68f7e731a5d201dc1071bbd48d (diff)
bugfix:1.将MESA_field_stat2改为fieldstat3 2.修复develop分支编译失败问题v3.0.1refactor-fieldstat3
-rw-r--r--.gitlab-ci.yml20
-rw-r--r--src/Makefile33
-rw-r--r--src/fieldstat.cpp1
-rw-r--r--test/Makefile7
-rw-r--r--test/src/gtest_fieldstat.cpp15
5 files changed, 16 insertions, 60 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 512fc30..d1aa5ef 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -77,7 +77,7 @@ develop_build_debug_for_centos7:
PULP3_REPO_NAME: framework-testing-x86_64.el7
PULP3_DIST_NAME: framework-testing-x86_64.el7
artifacts:
- name: "MESA_field_stat2-$CI_COMMIT_REF_NAME-debug"
+ name: "fieldstat3-$CI_COMMIT_REF_NAME-debug"
paths:
- build/*.rpm
only:
@@ -96,7 +96,7 @@ develop_build_release_for_centos7:
PULP3_REPO_NAME: framework-testing-x86_64.el7
PULP3_DIST_NAME: framework-testing-x86_64.el7
artifacts:
- name: "MESA_field_stat2-$CI_COMMIT_REF_NAME-release"
+ name: "fieldstat3-$CI_COMMIT_REF_NAME-release"
paths:
- build/*.rpm
only:
@@ -114,7 +114,7 @@ release_build_debug_for_centos7:
PULP3_DIST_NAME: framework-stable-x86_64.el7
extends: .build_by_travis_for_centos7
artifacts:
- name: "MESA_field_stat2-$CI_COMMIT_REF_NAME-debug"
+ name: "fieldstat3-$CI_COMMIT_REF_NAME-debug"
paths:
- build/*.rpm
only:
@@ -128,12 +128,12 @@ release_build_release_for_centos7:
PACKAGE: 1
UPLOAD_RPM: 1
UPLOAD_SYMBOL_FILES: 1
- SYMBOL_TARGET: libMESA_field_stat2
+ SYMBOL_TARGET: libfieldstat3
PULP3_REPO_NAME: framework-stable-x86_64.el7
PULP3_DIST_NAME: framework-stable-x86_64.el7
extends: .build_by_travis_for_centos7
artifacts:
- name: "MESA_field_stat2-$CI_COMMIT_REF_NAME-release"
+ name: "fieldstat3-$CI_COMMIT_REF_NAME-release"
paths:
- build/*.rpm
only:
@@ -174,7 +174,7 @@ develop_build_debug_for_centos8:
PULP3_REPO_NAME: framework-testing-x86_64.el8
PULP3_DIST_NAME: framework-testing-x86_64.el8
artifacts:
- name: "MESA_field_stat2-$CI_COMMIT_REF_NAME-debug"
+ name: "fieldstat3-$CI_COMMIT_REF_NAME-debug"
paths:
- build/*.rpm
only:
@@ -193,7 +193,7 @@ develop_build_release_for_centos8:
PULP3_REPO_NAME: framework-testing-x86_64.el8
PULP3_DIST_NAME: framework-testing-x86_64.el8
artifacts:
- name: "MESA_field_stat2-$CI_COMMIT_REF_NAME-release"
+ name: "fieldstat3-$CI_COMMIT_REF_NAME-release"
paths:
- build/*.rpm
only:
@@ -211,7 +211,7 @@ release_build_debug_for_centos8:
PULP3_DIST_NAME: framework-stable-x86_64.el8
extends: .build_by_travis_for_centos8
artifacts:
- name: "MESA_field_stat2-$CI_COMMIT_REF_NAME-debug"
+ name: "fieldstat3-$CI_COMMIT_REF_NAME-debug"
paths:
- build/*.rpm
only:
@@ -225,12 +225,12 @@ release_build_release_for_centos8:
PACKAGE: 1
UPLOAD_RPM: 1
UPLOAD_SYMBOL_FILES: 1
- SYMBOL_TARGET: libMESA_field_stat2
+ SYMBOL_TARGET: libfieldstat3
PULP3_REPO_NAME: framework-stable-x86_64.el8
PULP3_DIST_NAME: framework-stable-x86_64.el8
extends: .build_by_travis_for_centos8
artifacts:
- name: "MESA_field_stat2-$CI_COMMIT_REF_NAME-release"
+ name: "fieldstat3-$CI_COMMIT_REF_NAME-release"
paths:
- build/*.rpm
only:
diff --git a/src/Makefile b/src/Makefile
deleted file mode 100644
index 9099a6b..0000000
--- a/src/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-MAJOR_VER=2
-MINOR_VER=8
-RELEASE_DATE=20181118
-CC = g++
-GCC = gcc
-CFLAGS = -Wall
-CFLAGS += -g -fPIC
-LDFLAGS = -shared
-LDFLAGS += -Wl,--version-script=version.map
-H_DIR = -I../inc
-SOURCES = MESA_field_stat.cpp hdr_histogram.c
-OBJS = $(SOURCES:.c=.o ,.cc=.o)
-TARGET_LIB = libMESA_field_stat2.a
-TARGET_SO = libMESA_field_stat2.so.$(MAJOR_VER).$(MINOR_VER).$(RELEASE_DATE)
-.PHONY: all clean deps
-.cpp.o:
- $(CC) -c $(CFLAGS) -I. $(H_DIR) $<
-.c.o:
- $(GCC) -c $(CFLAGS) -I. $(H_DIR) $<
-all: $(TARGET_LIB) $(TARGET_SO)
-
-deps:
- @$(CC) -MM $(SOURCES) $(CFLAGS)
-
-$(TARGET_LIB): MESA_field_stat.o hdr_histogram.o
- ar -r $@ $^
- cp $(TARGET_LIB) ../lib/
-$(TARGET_SO): MESA_field_stat.o hdr_histogram.o
- $(CC) $(LDFLAGS) -o $(TARGET_SO) $^ -lrt
- cp $(TARGET_SO) ../lib/
-
-clean:
- rm -f $(TARGET_LIB) $(TARGET_SO) *.o core core.*
diff --git a/src/fieldstat.cpp b/src/fieldstat.cpp
index 582efaa..0ad0e67 100644
--- a/src/fieldstat.cpp
+++ b/src/fieldstat.cpp
@@ -526,6 +526,7 @@ void fieldstat_instance_start(struct fieldstat_instance *instance)
if(instance->background_thread_disable == 0)
{
pthread_create(&(instance->background_thread), NULL, fieldstat_thread_schema_output, (void*)instance);
+ instance->background_thread_is_created = 1;
}
//append instance to prometheus output
}
diff --git a/test/Makefile b/test/Makefile
deleted file mode 100644
index 0718719..0000000
--- a/test/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-LIBS=../lib/libMESA_field_stat2.so.*
-INC=-I../inc/
-all:
- g++ -o fs2_test -g -Wall fs2_test.cpp $(INC) $(LIBS) -lpthread
-clean:
- rm fs2_test fs2_test.status* -f
-
diff --git a/test/src/gtest_fieldstat.cpp b/test/src/gtest_fieldstat.cpp
index 609853e..6683a31 100644
--- a/test/src/gtest_fieldstat.cpp
+++ b/test/src/gtest_fieldstat.cpp
@@ -15,22 +15,17 @@ TEST(FeildStatAPI, FieldStatInstanceNew)
fieldstat_instance_free(instance);
}
-/*
+
TEST(FeildStatAPI, FieldStatEnablePrometheusEndpoint)
{
- int ret_enable_prometheus_endpoint = 0;
- int ret_req_prometheus_endpoint = 0;
- const char *request_cmd = "curl -s -o /dev/null http://127.0.0.1:9020/metrics";
+ int ret = 0;
- ret_enable_prometheus_endpoint = fieldstat_global_enable_prometheus_endpoint(9020, "/metrcis");
- EXPECT_EQ(0, ret_enable_prometheus_endpoint);
- usleep(500 * 1000);
- ret_req_prometheus_endpoint = system(request_cmd);
- EXPECT_EQ(0,ret_req_prometheus_endpoint);
+ ret = fieldstat_global_enable_prometheus_endpoint(9020, "/metrcis");
+ EXPECT_EQ(0, ret);
usleep(500 * 1000);
fieldstat_global_disable_prometheus_endpoint();
}
-*/
+
TEST(FeildStatAPI, FieldStatSetPrometheusOutput)
{
struct fieldstat_instance *instance = NULL;