Skip to content

Commit

Permalink
Merge branch 'develop' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruppsn authored Nov 22, 2024
2 parents dcb55fd + 96b5e09 commit 831495b
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 19 deletions.
4 changes: 2 additions & 2 deletions ee/query-service/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ func (s *Server) createPrivateServer(apiHandler *api.APIHandler) (*http.Server,

r := baseapp.NewRouter()

r.Use(baseapp.LogCommentEnricher)
r.Use(setTimeoutMiddleware)
r.Use(s.analyticsMiddleware)
r.Use(loggingMiddlewarePrivate)
r.Use(baseapp.LogCommentEnricher)

apiHandler.RegisterPrivateRoutes(r)

Expand Down Expand Up @@ -360,10 +360,10 @@ func (s *Server) createPublicServer(apiHandler *api.APIHandler) (*http.Server, e
}
am := baseapp.NewAuthMiddleware(getUserFromRequest)

r.Use(baseapp.LogCommentEnricher)
r.Use(setTimeoutMiddleware)
r.Use(s.analyticsMiddleware)
r.Use(loggingMiddleware)
r.Use(baseapp.LogCommentEnricher)

apiHandler.RegisterRoutes(r, am)
apiHandler.RegisterLogsRoutes(r, am)
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"save": "Save",
"edit": "Edit",
"logged_in": "Logged In",
"pending_data_placeholder": "Just a bit of patience, just a little bit’s enough ⎯ we’re getting your {{dataSource}}!"
"pending_data_placeholder": "Retrieving your {{dataSource}}!"
}
4 changes: 4 additions & 0 deletions frontend/src/container/InfraMonitoringHosts/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,31 @@ export const getHostsListColumns = (): ColumnType<HostRowData>[] => [
dataIndex: 'cpu',
key: 'cpu',
width: 100,
sorter: true,
align: 'right',
},
{
title: <div className="column-header-right">Memory Usage</div>,
dataIndex: 'memory',
key: 'memory',
width: 100,
sorter: true,
align: 'right',
},
{
title: <div className="column-header-right">IOWait</div>,
dataIndex: 'wait',
key: 'wait',
width: 100,
sorter: true,
align: 'right',
},
{
title: <div className="column-header-right">Load Avg</div>,
dataIndex: 'load15',
key: 'load15',
width: 100,
sorter: true,
align: 'right',
},
];
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/container/ListOfDashboard/DashboardsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ function DashboardsList(): JSX.Element {
const getLink = (): string => `${ROUTES.ALL_DASHBOARD}/${dashboard.id}`;

const onClickHandler = (event: React.MouseEvent<HTMLElement>): void => {
event.stopPropagation();
if (event.metaKey || event.ctrlKey) {
window.open(getLink(), '_blank');
} else {
Expand All @@ -458,7 +459,11 @@ function DashboardsList(): JSX.Element {
placement="left"
overlayClassName="title-toolip"
>
<Link to={getLink()} className="title-link">
<Link
to={getLink()}
className="title-link"
onClick={(e): void => e.stopPropagation()}
>
<img
src={dashboard?.image || Base64Icons[0]}
alt="dashboard-image"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import logEvent from 'api/common/logEvent';
import { QueryParams } from 'constants/query';
import Header from 'container/OnboardingContainer/common/Header/Header';
import { useOnboardingContext } from 'container/OnboardingContainer/context/OnboardingContext';
import { useOnboardingStatus } from 'hooks/messagingQueue / onboarding/useOnboardingStatus';
import { useOnboardingStatus } from 'hooks/messagingQueue/useOnboardingStatus';
import { useQueryService } from 'hooks/useQueryService';
import useResourceAttribute from 'hooks/useResourceAttribute';
import { convertRawQueriesToTraceSelectedTags } from 'hooks/useResourceAttribute/utils';
Expand Down
9 changes: 7 additions & 2 deletions frontend/src/container/PanelWrapper/PiePanelWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getYAxisFormattedValue } from 'components/Graph/yAxisConfig';
import { themeColors } from 'constants/theme';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
import { isNaN } from 'lodash-es';
import { useRef, useState } from 'react';
import { Query } from 'types/api/queryBuilder/queryBuilderData';

Expand Down Expand Up @@ -44,7 +45,7 @@ function PiePanelWrapper({

const isDarkMode = useIsDarkMode();

const pieChartData: {
let pieChartData: {
label: string;
value: string;
color: string;
Expand All @@ -67,6 +68,10 @@ function PiePanelWrapper({
)
.filter((d) => d !== undefined) as never[]),
);
pieChartData = pieChartData.filter(
(arc) =>
arc.value && !isNaN(parseFloat(arc.value)) && parseFloat(arc.value) > 0,
);

let size = 0;
let width = 0;
Expand Down Expand Up @@ -108,7 +113,7 @@ function PiePanelWrapper({
if (!active) return half - 3;
return data.label === active.label ? half : half - 3;
}}
padAngle={0.02}
padAngle={0.01}
cornerRadius={3}
width={size}
height={size}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,7 @@ describe('Logs Explorer Tests', () => {

// check for loading state to be not present
await waitFor(() =>
expect(
queryByText(
`Just a bit of patience, just a little bit’s enough ⎯ we’re getting your logs!`,
),
).not.toBeInTheDocument(),
expect(queryByText(`Retrieving your logs!`)).not.toBeInTheDocument(),
);

// check for no data state to not be present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './MessagingQueueHealthCheck.styles.scss';

import { Button } from 'antd';
import cx from 'classnames';
import { useOnboardingStatus } from 'hooks/messagingQueue / onboarding/useOnboardingStatus';
import { useOnboardingStatus } from 'hooks/messagingQueue/useOnboardingStatus';
import { Bolt, FolderTree } from 'lucide-react';
import { useEffect, useMemo, useState } from 'react';

Expand Down
1 change: 1 addition & 0 deletions pkg/query-service/app/inframetrics/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ func (h *HostsRepo) GetHostList(ctx context.Context, req model.HostListRequest)
}
resp.Total = len(allHostGroups)
resp.Records = records
resp.SortBy(req.OrderBy)

return resp, nil
}
7 changes: 2 additions & 5 deletions pkg/query-service/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ func (s *Server) createPublicServer(api *APIHandler) (*http.Server, error) {

r := NewRouter()

r.Use(LogCommentEnricher)
r.Use(setTimeoutMiddleware)
r.Use(s.analyticsMiddleware)
r.Use(loggingMiddleware)
r.Use(LogCommentEnricher)

// add auth middleware
getUserFromRequest := func(r *http.Request) (*model.UserPayload, error) {
Expand Down Expand Up @@ -387,10 +387,7 @@ func LogCommentEnricher(next http.Handler) http.Handler {
client = "api"
}

email, err := auth.GetEmailFromJwt(r.Context())
if err != nil {
zap.S().Errorf("error while getting email from jwt: %v", err)
}
email, _ := auth.GetEmailFromJwt(r.Context())

kvs := map[string]string{
"path": path,
Expand Down
34 changes: 33 additions & 1 deletion pkg/query-service/model/infra.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package model

import v3 "go.signoz.io/signoz/pkg/query-service/model/v3"
import (
"sort"

v3 "go.signoz.io/signoz/pkg/query-service/model/v3"
)

type (
ResponseType string
Expand Down Expand Up @@ -38,6 +42,34 @@ type HostListResponse struct {
Total int `json:"total"`
}

func (r *HostListResponse) SortBy(orderBy *v3.OrderBy) {
switch orderBy.ColumnName {
case "cpu":
sort.Slice(r.Records, func(i, j int) bool {
return r.Records[i].CPU > r.Records[j].CPU
})
case "memory":
sort.Slice(r.Records, func(i, j int) bool {
return r.Records[i].Memory > r.Records[j].Memory
})
case "load15":
sort.Slice(r.Records, func(i, j int) bool {
return r.Records[i].Load15 > r.Records[j].Load15
})
case "wait":
sort.Slice(r.Records, func(i, j int) bool {
return r.Records[i].Wait > r.Records[j].Wait
})
}
// the default is descending
if orderBy.Order == v3.DirectionAsc {
// reverse the list
for i, j := 0, len(r.Records)-1; i < j; i, j = i+1, j-1 {
r.Records[i], r.Records[j] = r.Records[j], r.Records[i]
}
}
}

type ProcessListRequest struct {
Start int64 `json:"start"` // epoch time in ms
End int64 `json:"end"` // epoch time in ms
Expand Down

0 comments on commit 831495b

Please sign in to comment.