From fdc8670fab202288689b690b1445186c969ceeb2 Mon Sep 17 00:00:00 2001 From: Patrik Date: Wed, 9 Feb 2022 22:05:27 +0100 Subject: [PATCH 1/9] fix: added support for custom alertmanager url --- .../app/clickhouseReader/reader.go | 8 ++++---- pkg/query-service/constants/constants.go | 8 +++++++- pkg/query-service/constants/constants_test.go | 20 +++++++++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 pkg/query-service/constants/constants_test.go diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.go index ab124de5e9..876c66fa18 100644 --- a/pkg/query-service/app/clickhouseReader/reader.go +++ b/pkg/query-service/app/clickhouseReader/reader.go @@ -660,7 +660,7 @@ func (r *ClickHouseReader) LoadChannel(channel *model.ChannelItem) *model.ApiErr return &model.ApiError{Typ: model.ErrorBadData, Err: err} } - response, err := http.Post(constants.ALERTMANAGER_API_PREFIX+"v1/receivers", "application/json", bytes.NewBuffer([]byte(channel.Data))) + response, err := http.Post(constants.GetAlertManagerApiPrefix()+"v1/receivers", "application/json", bytes.NewBuffer([]byte(channel.Data))) if err != nil { zap.S().Errorf("Error in getting response of API call to alertmanager/v1/receivers\n", err) @@ -730,7 +730,7 @@ func (r *ClickHouseReader) DeleteChannel(id string) *model.ApiError { values := map[string]string{"name": channelToDelete.Name} jsonValue, _ := json.Marshal(values) - req, err := http.NewRequest(http.MethodDelete, constants.ALERTMANAGER_API_PREFIX+"v1/receivers", bytes.NewBuffer(jsonValue)) + req, err := http.NewRequest(http.MethodDelete, constants.GetAlertManagerApiPrefix()+"v1/receivers", bytes.NewBuffer(jsonValue)) if err != nil { zap.S().Errorf("Error in creating new delete request to alertmanager/v1/receivers\n", err) @@ -855,7 +855,7 @@ func (r *ClickHouseReader) EditChannel(receiver *model.Receiver, id string) (*mo } } - req, err := http.NewRequest(http.MethodPut, constants.ALERTMANAGER_API_PREFIX+"v1/receivers", bytes.NewBuffer(receiverString)) + req, err := http.NewRequest(http.MethodPut, constants.GetAlertManagerApiPrefix()+"v1/receivers", bytes.NewBuffer(receiverString)) if err != nil { zap.S().Errorf("Error in creating new update request to alertmanager/v1/receivers\n", err) @@ -917,7 +917,7 @@ func (r *ClickHouseReader) CreateChannel(receiver *model.Receiver) (*model.Recei } } - response, err := http.Post(constants.ALERTMANAGER_API_PREFIX+"v1/receivers", "application/json", bytes.NewBuffer(receiverString)) + response, err := http.Post(constants.GetAlertManagerApiPrefix()+"v1/receivers", "application/json", bytes.NewBuffer(receiverString)) if err != nil { zap.S().Errorf("Error in getting response of API call to alertmanager/v1/receivers\n", err) diff --git a/pkg/query-service/constants/constants.go b/pkg/query-service/constants/constants.go index 3339432513..0e19f83f93 100644 --- a/pkg/query-service/constants/constants.go +++ b/pkg/query-service/constants/constants.go @@ -23,7 +23,13 @@ func IsTelemetryEnabled() bool { const TraceTTL = "traces" const MetricsTTL = "metrics" -const ALERTMANAGER_API_PREFIX = "http://alertmanager:9093/api/" +func GetAlertManagerApiPrefix() string { + if os.Getenv("ALERTMANAGER_API_PREFIX") != "" { + return os.Getenv("ALERTMANAGER_API_PREFIX") + } + return "http://alertmanager:9093/api/" +} + const RELATIONAL_DATASOURCE_PATH = "/var/lib/signoz/signoz.db" const ( diff --git a/pkg/query-service/constants/constants_test.go b/pkg/query-service/constants/constants_test.go new file mode 100644 index 0000000000..97bed19271 --- /dev/null +++ b/pkg/query-service/constants/constants_test.go @@ -0,0 +1,20 @@ +package constants + +import ( + . "github.com/smartystreets/goconvey/convey" + "os" + "testing" +) + +func TestGetAlertManagerApiPrefix(t *testing.T) { + Convey("TestGetAlertManagerApiPrefix", t, func() { + res := GetAlertManagerApiPrefix() + So(res, ShouldEqual, "http://alertmanager:9093/api/") + + Convey("WithEnvSet", func() { + os.Setenv("ALERTMANAGER_API_PREFIX", "http://test:9093/api/") + res = GetAlertManagerApiPrefix() + So(res, ShouldEqual, "http://test:9093/api/") + }) + }) +} From 828bd3bac6853989c2a1bc992655bd1ac17f6162 Mon Sep 17 00:00:00 2001 From: Palash gupta Date: Thu, 10 Feb 2022 16:37:14 +0530 Subject: [PATCH 2/9] feat: now webpack filename are hashed --- frontend/webpack.config.prod.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/webpack.config.prod.js b/frontend/webpack.config.prod.js index 1e7f2198f0..c90c4616d8 100644 --- a/frontend/webpack.config.prod.js +++ b/frontend/webpack.config.prod.js @@ -34,8 +34,8 @@ const plugins = [ path: resolve(__dirname, './build/css'), // Public path of the CSS resources. This prefix is removed from the href publicPath: resolve(__dirname, './public/css'), - fonts: true - }) + fonts: true, + }), ]; if (process.env.BUNDLE_ANALYSER === 'true') { @@ -48,6 +48,7 @@ const config = { output: { path: resolve(__dirname, './build'), publicPath: '/', + filename: '[name].[contenthash].js', }, resolve: { extensions: ['.ts', '.tsx', '.js', '.jsx'], From 0ae5b824d91d0bc3fdcba457a5df2c852a51142b Mon Sep 17 00:00:00 2001 From: Palash gupta Date: Thu, 10 Feb 2022 16:44:38 +0530 Subject: [PATCH 3/9] bug: signup state is now not toggled when component is not toggled --- frontend/src/pages/SignUp/SignUp.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/SignUp/SignUp.tsx b/frontend/src/pages/SignUp/SignUp.tsx index 37253a0aeb..c7f540836a 100644 --- a/frontend/src/pages/SignUp/SignUp.tsx +++ b/frontend/src/pages/SignUp/SignUp.tsx @@ -82,17 +82,19 @@ const Signup = ({ version, userpref }: SignupProps): JSX.Element => { history.push(ROUTES.APPLICATION); } else { + setLoading(false); + notification.error({ message: 'Something went wrong', }); } } else { + setLoading(false); + notification.error({ message: 'Something went wrong', }); } - - setLoading(false); } catch (error) { notification.error({ message: 'Something went wrong', From dc737f385a757c0e357c1023a560a1b435fc2229 Mon Sep 17 00:00:00 2001 From: Palash gupta Date: Thu, 10 Feb 2022 22:20:31 +0530 Subject: [PATCH 4/9] bug: in the error state bar panel is added --- .../src/container/GridGraphLayout/Graph/index.tsx | 14 ++++++++++++-- .../src/container/GridGraphLayout/Graph/styles.ts | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/src/container/GridGraphLayout/Graph/index.tsx b/frontend/src/container/GridGraphLayout/Graph/index.tsx index 60a086befa..74ff7c8511 100644 --- a/frontend/src/container/GridGraphLayout/Graph/index.tsx +++ b/frontend/src/container/GridGraphLayout/Graph/index.tsx @@ -23,7 +23,7 @@ import { Widgets } from 'types/api/dashboard/getAll'; import Bar from './Bar'; import FullView from './FullView'; -import { Modal, FullViewContainer } from './styles'; +import { Modal, FullViewContainer, ErrorContainer } from './styles'; const GridCardGraph = ({ widget, @@ -131,7 +131,17 @@ const GridCardGraph = ({ }, [deleteWidget, widget, onToggleModal, isDeleted]); if (state.error) { - return
{state.errorMessage}
; + return ( + <> + onToggleModal(setModal)} + widget={widget} + onDeleteHandler={(): void => onToggleModal(setDeletModal)} + /> + + {state.errorMessage} + + ); } if (state.loading === true || state.payload === undefined) { diff --git a/frontend/src/container/GridGraphLayout/Graph/styles.ts b/frontend/src/container/GridGraphLayout/Graph/styles.ts index 61f4c7c9c9..7a5d9f1a62 100644 --- a/frontend/src/container/GridGraphLayout/Graph/styles.ts +++ b/frontend/src/container/GridGraphLayout/Graph/styles.ts @@ -15,3 +15,9 @@ export const Modal = styled(ModalComponent)` export const FullViewContainer = styled.div` height: 70vh; `; + +export const ErrorContainer = styled.div` + margin-top: 2rem; + padding-left: 2rem; + padding-right: 2rem; +`; From 744dfd010a361a82f29691344cd96393abc8a434 Mon Sep 17 00:00:00 2001 From: Palash gupta Date: Fri, 11 Feb 2022 12:00:46 +0530 Subject: [PATCH 5/9] chore: modal is updated in the error state --- .../container/GridGraphLayout/Graph/index.tsx | 59 +++++++++++-------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/frontend/src/container/GridGraphLayout/Graph/index.tsx b/frontend/src/container/GridGraphLayout/Graph/index.tsx index 74ff7c8511..977b274ac0 100644 --- a/frontend/src/container/GridGraphLayout/Graph/index.tsx +++ b/frontend/src/container/GridGraphLayout/Graph/index.tsx @@ -124,6 +124,38 @@ const GridCardGraph = ({ [], ); + const getModals = () => { + return ( + <> + onToggleModal(setDeletModal)} + visible={deleteModal} + title="Delete" + height="10vh" + onOk={onDeleteHandler} + centered + > + Are you sure you want to delete this widget + + + onToggleModal(setModal)} + width="85%" + destroyOnClose + > + + + + + + ); + }; + const onDeleteHandler = useCallback(() => { deleteWidget({ widgetId: widget.id }); onToggleModal(setDeletModal); @@ -133,6 +165,7 @@ const GridCardGraph = ({ if (state.error) { return ( <> + {getModals()} onToggleModal(setModal)} widget={widget} @@ -156,31 +189,7 @@ const GridCardGraph = ({ onDeleteHandler={(): void => onToggleModal(setDeletModal)} /> - onToggleModal(setDeletModal)} - visible={deleteModal} - title="Delete" - height="10vh" - onOk={onDeleteHandler} - centered - > - Are you sure you want to delete this widget - - - onToggleModal(setModal)} - width="85%" - destroyOnClose - > - - - - + {getModals()} Date: Fri, 11 Feb 2022 14:09:05 +0530 Subject: [PATCH 6/9] bug: dashboard graph is now fixed --- frontend/src/components/Graph/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/Graph/index.tsx b/frontend/src/components/Graph/index.tsx index eac5ae2712..b6905495d4 100644 --- a/frontend/src/components/Graph/index.tsx +++ b/frontend/src/components/Graph/index.tsx @@ -148,7 +148,7 @@ const Graph = ({ useEffect(() => { buildChart(); - }, []); + }, [buildChart]); return (
From db9052ea6e06cef3b3bfdf2e01b405188c61dce1 Mon Sep 17 00:00:00 2001 From: Palash gupta Date: Fri, 11 Feb 2022 15:00:00 +0530 Subject: [PATCH 7/9] bug: full view legend is now fixed --- frontend/src/container/GridGraphLayout/Graph/index.tsx | 2 +- frontend/src/container/GridGraphLayout/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/container/GridGraphLayout/Graph/index.tsx b/frontend/src/container/GridGraphLayout/Graph/index.tsx index 60a086befa..2c163c2b05 100644 --- a/frontend/src/container/GridGraphLayout/Graph/index.tsx +++ b/frontend/src/container/GridGraphLayout/Graph/index.tsx @@ -168,7 +168,7 @@ const GridCardGraph = ({ destroyOnClose > - + diff --git a/frontend/src/container/GridGraphLayout/index.tsx b/frontend/src/container/GridGraphLayout/index.tsx index c72885f9ef..cbbec4a2a7 100644 --- a/frontend/src/container/GridGraphLayout/index.tsx +++ b/frontend/src/container/GridGraphLayout/index.tsx @@ -61,7 +61,7 @@ const GridGraph = (): JSX.Element => { x: (index % 2) * 6, Component: (): JSX.Element => ( From 3db790c3c79f3ffc2c378f981a4b9897e9457f38 Mon Sep 17 00:00:00 2001 From: Palash gupta Date: Fri, 11 Feb 2022 15:52:04 +0530 Subject: [PATCH 8/9] bug: merge conflit is resolved --- frontend/src/container/GridGraphLayout/Graph/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/container/GridGraphLayout/Graph/index.tsx b/frontend/src/container/GridGraphLayout/Graph/index.tsx index 977b274ac0..0cf795b06d 100644 --- a/frontend/src/container/GridGraphLayout/Graph/index.tsx +++ b/frontend/src/container/GridGraphLayout/Graph/index.tsx @@ -149,7 +149,7 @@ const GridCardGraph = ({ destroyOnClose > - + From 5510c67dbf847a6f36ce231a7475ea26d6c63fcb Mon Sep 17 00:00:00 2001 From: Ankit Nayan Date: Fri, 11 Feb 2022 16:22:51 +0530 Subject: [PATCH 9/9] release: v0.6.1 --- deploy/docker/clickhouse-setup/docker-compose.arm.yaml | 4 ++-- deploy/docker/clickhouse-setup/docker-compose.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deploy/docker/clickhouse-setup/docker-compose.arm.yaml b/deploy/docker/clickhouse-setup/docker-compose.arm.yaml index 0a09efbca3..dba80353da 100644 --- a/deploy/docker/clickhouse-setup/docker-compose.arm.yaml +++ b/deploy/docker/clickhouse-setup/docker-compose.arm.yaml @@ -23,7 +23,7 @@ services: - '--storage.path=/data' query-service: - image: signoz/query-service:0.6.0 + image: signoz/query-service:0.6.1 container_name: query-service command: ["-config=/root/config/prometheus.yml"] volumes: @@ -40,7 +40,7 @@ services: condition: service_healthy frontend: - image: signoz/frontend:0.6.0 + image: signoz/frontend:0.6.1 container_name: frontend depends_on: - query-service diff --git a/deploy/docker/clickhouse-setup/docker-compose.yaml b/deploy/docker/clickhouse-setup/docker-compose.yaml index 0f5109b635..13eaa5790e 100644 --- a/deploy/docker/clickhouse-setup/docker-compose.yaml +++ b/deploy/docker/clickhouse-setup/docker-compose.yaml @@ -26,7 +26,7 @@ services: query-service: - image: signoz/query-service:0.6.0 + image: signoz/query-service:0.6.1 container_name: query-service command: ["-config=/root/config/prometheus.yml"] volumes: @@ -43,7 +43,7 @@ services: condition: service_healthy frontend: - image: signoz/frontend:0.6.0 + image: signoz/frontend:0.6.1 container_name: frontend depends_on: - query-service