Merge branch 'develop' into 412-trace-detail

This commit is contained in:
Palash 2022-06-13 22:58:02 +05:30 committed by GitHub
commit fabab345cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 79 additions and 63 deletions

View File

@ -37,7 +37,7 @@ services:
condition: on-failure condition: on-failure
query-service: query-service:
image: signoz/query-service:0.8.0 image: signoz/query-service:0.8.1
command: ["-config=/root/config/prometheus.yml"] command: ["-config=/root/config/prometheus.yml"]
# ports: # ports:
# - "6060:6060" # pprof port # - "6060:6060" # pprof port
@ -65,7 +65,7 @@ services:
- clickhouse - clickhouse
frontend: frontend:
image: signoz/frontend:0.8.0 image: signoz/frontend:0.8.1
deploy: deploy:
restart_policy: restart_policy:
condition: on-failure condition: on-failure
@ -78,7 +78,7 @@ services:
- ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf - ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf
otel-collector: otel-collector:
image: signoz/otelcontribcol:0.43.0-0.1 image: signoz/otelcontribcol:0.45.1-0.2
command: ["--config=/etc/otel-collector-config.yaml"] command: ["--config=/etc/otel-collector-config.yaml"]
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
@ -104,7 +104,7 @@ services:
- clickhouse - clickhouse
otel-collector-metrics: otel-collector-metrics:
image: signoz/otelcontribcol:0.43.0-0.1 image: signoz/otelcontribcol:0.45.1-0.2
command: ["--config=/etc/otel-collector-metrics-config.yaml"] command: ["--config=/etc/otel-collector-metrics-config.yaml"]
volumes: volumes:
- ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml - ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml

View File

@ -52,7 +52,7 @@ extensions:
health_check: {} health_check: {}
zpages: {} zpages: {}
exporters: exporters:
clickhouse: clickhousetraces:
datasource: tcp://clickhouse:9000/?database=signoz_traces datasource: tcp://clickhouse:9000/?database=signoz_traces
clickhousemetricswrite: clickhousemetricswrite:
endpoint: tcp://clickhouse:9000/?database=signoz_metrics endpoint: tcp://clickhouse:9000/?database=signoz_metrics
@ -66,7 +66,7 @@ service:
traces: traces:
receivers: [jaeger, otlp] receivers: [jaeger, otlp]
processors: [signozspanmetrics/prometheus, batch] processors: [signozspanmetrics/prometheus, batch]
exporters: [clickhouse] exporters: [clickhousetraces]
metrics: metrics:
receivers: [otlp, hostmetrics] receivers: [otlp, hostmetrics]
processors: [batch] processors: [batch]

View File

@ -37,7 +37,7 @@ services:
query-service: query-service:
image: signoz/query-service:0.8.0 image: signoz/query-service:0.8.1
container_name: query-service container_name: query-service
command: ["-config=/root/config/prometheus.yml"] command: ["-config=/root/config/prometheus.yml"]
# ports: # ports:
@ -64,7 +64,7 @@ services:
condition: service_healthy condition: service_healthy
frontend: frontend:
image: signoz/frontend:0.8.0 image: signoz/frontend:0.8.1
container_name: frontend container_name: frontend
restart: on-failure restart: on-failure
depends_on: depends_on:
@ -76,7 +76,7 @@ services:
- ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf - ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf
otel-collector: otel-collector:
image: signoz/otelcontribcol:0.43.0-0.1 image: signoz/otelcontribcol:0.45.1-0.2
command: ["--config=/etc/otel-collector-config.yaml"] command: ["--config=/etc/otel-collector-config.yaml"]
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
@ -97,7 +97,7 @@ services:
condition: service_healthy condition: service_healthy
otel-collector-metrics: otel-collector-metrics:
image: signoz/otelcontribcol:0.43.0-0.1 image: signoz/otelcontribcol:0.45.1-0.2
command: ["--config=/etc/otel-collector-metrics-config.yaml"] command: ["--config=/etc/otel-collector-metrics-config.yaml"]
volumes: volumes:
- ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml - ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml

View File

@ -36,7 +36,7 @@ services:
# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md` # Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md`
query-service: query-service:
image: signoz/query-service:0.8.0 image: signoz/query-service:0.8.1
container_name: query-service container_name: query-service
command: ["-config=/root/config/prometheus.yml"] command: ["-config=/root/config/prometheus.yml"]
# ports: # ports:
@ -63,7 +63,7 @@ services:
condition: service_healthy condition: service_healthy
frontend: frontend:
image: signoz/frontend:0.8.0 image: signoz/frontend:0.8.1
container_name: frontend container_name: frontend
restart: on-failure restart: on-failure
depends_on: depends_on:
@ -75,7 +75,7 @@ services:
- ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf - ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf
otel-collector: otel-collector:
image: signoz/otelcontribcol:0.43.0-0.1 image: signoz/otelcontribcol:0.45.1-0.2
command: ["--config=/etc/otel-collector-config.yaml"] command: ["--config=/etc/otel-collector-config.yaml"]
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
@ -96,7 +96,7 @@ services:
condition: service_healthy condition: service_healthy
otel-collector-metrics: otel-collector-metrics:
image: signoz/otelcontribcol:0.43.0-0.1 image: signoz/otelcontribcol:0.45.1-0.2
command: ["--config=/etc/otel-collector-metrics-config.yaml"] command: ["--config=/etc/otel-collector-metrics-config.yaml"]
volumes: volumes:
- ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml - ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml

View File

@ -52,7 +52,7 @@ extensions:
health_check: {} health_check: {}
zpages: {} zpages: {}
exporters: exporters:
clickhouse: clickhousetraces:
datasource: tcp://clickhouse:9000/?database=signoz_traces datasource: tcp://clickhouse:9000/?database=signoz_traces
clickhousemetricswrite: clickhousemetricswrite:
endpoint: tcp://clickhouse:9000/?database=signoz_metrics endpoint: tcp://clickhouse:9000/?database=signoz_metrics
@ -66,7 +66,7 @@ service:
traces: traces:
receivers: [jaeger, otlp] receivers: [jaeger, otlp]
processors: [signozspanmetrics/prometheus, batch] processors: [signozspanmetrics/prometheus, batch]
exporters: [clickhouse] exporters: [clickhousetraces]
metrics: metrics:
receivers: [otlp, hostmetrics] receivers: [otlp, hostmetrics]
processors: [batch] processors: [batch]

View File

@ -29,12 +29,15 @@ function GraphLayout({
const { role } = useSelector<AppState, AppReducer>((state) => state.app); const { role } = useSelector<AppState, AppReducer>((state) => state.app);
const { isDarkMode } = useSelector<AppState, AppReducer>((state) => state.app); const { isDarkMode } = useSelector<AppState, AppReducer>((state) => state.app);
const [saveLayout] = useComponentPermission(['save_layout'], role); const [saveLayoutPermission, addPanelPermission] = useComponentPermission(
['save_layout', 'add_panel'],
role,
);
return ( return (
<> <>
<ButtonContainer> <ButtonContainer>
{saveLayout && ( {saveLayoutPermission && (
<Button <Button
loading={saveLayoutState.loading} loading={saveLayoutState.loading}
onClick={(): Promise<void> => onLayoutSaveHandler(layouts)} onClick={(): Promise<void> => onLayoutSaveHandler(layouts)}
@ -45,24 +48,26 @@ function GraphLayout({
</Button> </Button>
)} )}
<Button {addPanelPermission && (
loading={addPanelLoading} <Button
disabled={addPanelLoading} loading={addPanelLoading}
onClick={onAddPanelHandler} disabled={addPanelLoading}
icon={<PlusOutlined />} onClick={onAddPanelHandler}
> icon={<PlusOutlined />}
Add Panel >
</Button> Add Panel
</Button>
)}
</ButtonContainer> </ButtonContainer>
<ReactGridLayout <ReactGridLayout
isResizable
cols={12} cols={12}
rowHeight={100} rowHeight={100}
autoSize autoSize
width={100} width={100}
isDraggable isDraggable={addPanelPermission}
isDroppable isDroppable={addPanelPermission}
isResizable={addPanelPermission}
useCSSTransforms useCSSTransforms
allowOverlap={false} allowOverlap={false}
onLayoutChange={onLayoutChangeHandler} onLayoutChange={onLayoutChangeHandler}

View File

@ -1,6 +1,7 @@
/* eslint-disable react/no-unstable-nested-components */ /* eslint-disable react/no-unstable-nested-components */
import { notification } from 'antd'; import { notification } from 'antd';
import updateDashboardApi from 'api/dashboard/update'; import updateDashboardApi from 'api/dashboard/update';
import useComponentPermission from 'hooks/useComponentPermission';
import React, { useCallback, useEffect, useState } from 'react'; import React, { useCallback, useEffect, useState } from 'react';
import { Layout } from 'react-grid-layout'; import { Layout } from 'react-grid-layout';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -15,6 +16,7 @@ import { AppState } from 'store/reducers';
import AppActions from 'types/actions'; import AppActions from 'types/actions';
import { UPDATE_DASHBOARD } from 'types/actions/dashboard'; import { UPDATE_DASHBOARD } from 'types/actions/dashboard';
import { Dashboard, Widgets } from 'types/api/dashboard/getAll'; import { Dashboard, Widgets } from 'types/api/dashboard/getAll';
import AppReducer from 'types/reducer/app';
import DashboardReducer from 'types/reducer/dashboards'; import DashboardReducer from 'types/reducer/dashboards';
import Graph from './Graph'; import Graph from './Graph';
@ -49,6 +51,9 @@ function GridGraph(props: Props): JSX.Element {
const { dashboards, isAddWidget } = useSelector<AppState, DashboardReducer>( const { dashboards, isAddWidget } = useSelector<AppState, DashboardReducer>(
(state) => state.dashboards, (state) => state.dashboards,
); );
const { role } = useSelector<AppState, AppReducer>((state) => state.app);
const [saveLayoutPermission] = useComponentPermission(['save_layout'], role);
const [saveLayoutState, setSaveLayoutState] = useState<State>({ const [saveLayoutState, setSaveLayoutState] = useState<State>({
loading: false, loading: false,
error: false, error: false,
@ -109,31 +114,34 @@ function GridGraph(props: Props): JSX.Element {
loading: true, loading: true,
})); }));
const response = await updateDashboardApi({ // Save layout only when users has the has the permission to do so.
data: { if (saveLayoutPermission) {
title: data.title, const response = await updateDashboardApi({
description: data.description, data: {
name: data.name, title: data.title,
tags: data.tags, description: data.description,
widgets: data.widgets, name: data.name,
layout, tags: data.tags,
}, widgets: data.widgets,
uuid: selectedDashboard.uuid, layout,
}); },
if (response.statusCode === 200) { uuid: selectedDashboard.uuid,
setSaveLayoutState((state) => ({ });
...state, if (response.statusCode === 200) {
error: false, setSaveLayoutState((state) => ({
errorMessage: '', ...state,
loading: false, error: false,
})); errorMessage: '',
} else { loading: false,
setSaveLayoutState((state) => ({ }));
...state, } else {
error: true, setSaveLayoutState((state) => ({
errorMessage: response.error || 'Something went wrong', ...state,
loading: false, error: true,
})); errorMessage: response.error || 'Something went wrong',
loading: false,
}));
}
} }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
@ -145,6 +153,7 @@ function GridGraph(props: Props): JSX.Element {
data.tags, data.tags,
data.title, data.title,
data.widgets, data.widgets,
saveLayoutPermission,
selectedDashboard.uuid, selectedDashboard.uuid,
], ],
); );

View File

@ -66,7 +66,7 @@ export const RedDot = styled.div`
background: #d32029; background: #d32029;
border-radius: 50%; border-radius: 50%;
margin-left: 1rem; margin-left: 0.5rem;
margin-top: 0.5rem; margin-top: 0.5rem;
`; `;

View File

@ -16,7 +16,8 @@ export type ComponentTypes =
| 'delete_widget' | 'delete_widget'
| 'new_dashboard' | 'new_dashboard'
| 'new_alert_action' | 'new_alert_action'
| 'edit_widget'; | 'edit_widget'
| 'add_panel';
export const componentPermission: Record<ComponentTypes, ROLES[]> = { export const componentPermission: Record<ComponentTypes, ROLES[]> = {
current_org_settings: ['ADMIN'], current_org_settings: ['ADMIN'],
@ -34,6 +35,7 @@ export const componentPermission: Record<ComponentTypes, ROLES[]> = {
new_dashboard: ['ADMIN', 'EDITOR'], new_dashboard: ['ADMIN', 'EDITOR'],
new_alert_action: ['ADMIN'], new_alert_action: ['ADMIN'],
edit_widget: ['ADMIN', 'EDITOR'], edit_widget: ['ADMIN', 'EDITOR'],
add_panel: ['ADMIN', 'EDITOR'],
}; };
export const routePermission: Record<keyof typeof ROUTES, ROLES[]> = { export const routePermission: Record<keyof typeof ROUTES, ROLES[]> = {
@ -47,7 +49,7 @@ export const routePermission: Record<keyof typeof ROUTES, ROLES[]> = {
APPLICATION: ['ADMIN', 'EDITOR', 'VIEWER'], APPLICATION: ['ADMIN', 'EDITOR', 'VIEWER'],
CHANNELS_EDIT: ['ADMIN'], CHANNELS_EDIT: ['ADMIN'],
CHANNELS_NEW: ['ADMIN'], CHANNELS_NEW: ['ADMIN'],
DASHBOARD: ['ADMIN', 'EDITOR', 'EDITOR'], DASHBOARD: ['ADMIN', 'EDITOR', 'VIEWER'],
DASHBOARD_WIDGET: ['ADMIN', 'EDITOR', 'VIEWER'], DASHBOARD_WIDGET: ['ADMIN', 'EDITOR', 'VIEWER'],
EDIT_ALERTS: ['ADMIN'], EDIT_ALERTS: ['ADMIN'],
ERROR_DETAIL: ['ADMIN', 'EDITOR', 'VIEWER'], ERROR_DETAIL: ['ADMIN', 'EDITOR', 'VIEWER'],

View File

@ -51,7 +51,7 @@ services:
condition: service_healthy condition: service_healthy
otel-collector: otel-collector:
image: signoz/otelcontribcol:0.43.0-0.1 image: signoz/otelcontribcol:0.45.1-0.2
command: ["--config=/etc/otel-collector-config.yaml"] command: ["--config=/etc/otel-collector-config.yaml"]
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
@ -64,7 +64,7 @@ services:
condition: service_healthy condition: service_healthy
otel-collector-metrics: otel-collector-metrics:
image: signoz/otelcontribcol:0.43.0-0.1 image: signoz/otelcontribcol:0.45.1-0.2
command: ["--config=/etc/otel-collector-metrics-config.yaml"] command: ["--config=/etc/otel-collector-metrics-config.yaml"]
volumes: volumes:
- ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml - ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml

View File

@ -56,7 +56,7 @@ services:
condition: service_healthy condition: service_healthy
otel-collector: otel-collector:
image: signoz/otelcontribcol:0.43.0-0.1 image: signoz/otelcontribcol:0.45.1-0.2
command: ["--config=/etc/otel-collector-config.yaml"] command: ["--config=/etc/otel-collector-config.yaml"]
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
@ -69,7 +69,7 @@ services:
condition: service_healthy condition: service_healthy
otel-collector-metrics: otel-collector-metrics:
image: signoz/otelcontribcol:0.43.0-0.1 image: signoz/otelcontribcol:0.45.1-0.2
command: ["--config=/etc/otel-collector-metrics-config.yaml"] command: ["--config=/etc/otel-collector-metrics-config.yaml"]
volumes: volumes:
- ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml - ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml

View File

@ -49,7 +49,7 @@ extensions:
health_check: {} health_check: {}
zpages: {} zpages: {}
exporters: exporters:
clickhouse: clickhousetraces:
datasource: tcp://clickhouse:9000/?database=signoz_traces datasource: tcp://clickhouse:9000/?database=signoz_traces
clickhousemetricswrite: clickhousemetricswrite:
endpoint: tcp://clickhouse:9000/?database=signoz_metrics endpoint: tcp://clickhouse:9000/?database=signoz_metrics
@ -63,7 +63,7 @@ service:
traces: traces:
receivers: [jaeger, otlp] receivers: [jaeger, otlp]
processors: [signozspanmetrics/prometheus, batch] processors: [signozspanmetrics/prometheus, batch]
exporters: [clickhouse] exporters: [clickhousetraces]
metrics: metrics:
receivers: [otlp, hostmetrics] receivers: [otlp, hostmetrics]
processors: [batch] processors: [batch]