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

View File

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

View File

@ -37,7 +37,7 @@ services:
query-service:
image: signoz/query-service:0.8.0
image: signoz/query-service:0.8.1
container_name: query-service
command: ["-config=/root/config/prometheus.yml"]
# ports:
@ -64,7 +64,7 @@ services:
condition: service_healthy
frontend:
image: signoz/frontend:0.8.0
image: signoz/frontend:0.8.1
container_name: frontend
restart: on-failure
depends_on:
@ -76,7 +76,7 @@ services:
- ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf
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"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
@ -97,7 +97,7 @@ services:
condition: service_healthy
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"]
volumes:
- ./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`
query-service:
image: signoz/query-service:0.8.0
image: signoz/query-service:0.8.1
container_name: query-service
command: ["-config=/root/config/prometheus.yml"]
# ports:
@ -63,7 +63,7 @@ services:
condition: service_healthy
frontend:
image: signoz/frontend:0.8.0
image: signoz/frontend:0.8.1
container_name: frontend
restart: on-failure
depends_on:
@ -75,7 +75,7 @@ services:
- ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf
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"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
@ -96,7 +96,7 @@ services:
condition: service_healthy
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"]
volumes:
- ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml

View File

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

View File

@ -29,12 +29,15 @@ function GraphLayout({
const { role } = 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 (
<>
<ButtonContainer>
{saveLayout && (
{saveLayoutPermission && (
<Button
loading={saveLayoutState.loading}
onClick={(): Promise<void> => onLayoutSaveHandler(layouts)}
@ -45,24 +48,26 @@ function GraphLayout({
</Button>
)}
<Button
loading={addPanelLoading}
disabled={addPanelLoading}
onClick={onAddPanelHandler}
icon={<PlusOutlined />}
>
Add Panel
</Button>
{addPanelPermission && (
<Button
loading={addPanelLoading}
disabled={addPanelLoading}
onClick={onAddPanelHandler}
icon={<PlusOutlined />}
>
Add Panel
</Button>
)}
</ButtonContainer>
<ReactGridLayout
isResizable
cols={12}
rowHeight={100}
autoSize
width={100}
isDraggable
isDroppable
isDraggable={addPanelPermission}
isDroppable={addPanelPermission}
isResizable={addPanelPermission}
useCSSTransforms
allowOverlap={false}
onLayoutChange={onLayoutChangeHandler}

View File

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

View File

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

View File

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

View File

@ -51,7 +51,7 @@ services:
condition: service_healthy
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"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
@ -64,7 +64,7 @@ services:
condition: service_healthy
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"]
volumes:
- ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml

View File

@ -56,7 +56,7 @@ services:
condition: service_healthy
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"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
@ -69,7 +69,7 @@ services:
condition: service_healthy
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"]
volumes:
- ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml

View File

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