mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-27 07:29:11 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
031e78cb20 | ||
|
|
f992ba9106 | ||
|
|
7118829107 | ||
|
|
5aea442939 | ||
|
|
bf385a9f95 |
@@ -174,13 +174,13 @@ services:
|
||||
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
|
||||
signoz:
|
||||
!!merge <<: *db-depend
|
||||
image: signoz/signoz:v0.76.1
|
||||
image: signoz/signoz:v0.76.2
|
||||
command:
|
||||
- --config=/root/config/prometheus.yml
|
||||
- --use-logs-new-schema=true
|
||||
- --use-trace-new-schema=true
|
||||
# ports:
|
||||
# - "8080:8080" # signoz port
|
||||
ports:
|
||||
- "8080:8080" # signoz port
|
||||
# - "6060:6060" # pprof port
|
||||
volumes:
|
||||
- ../common/signoz/prometheus.yml:/root/config/prometheus.yml
|
||||
|
||||
@@ -110,13 +110,13 @@ services:
|
||||
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
|
||||
signoz:
|
||||
!!merge <<: *db-depend
|
||||
image: signoz/signoz:v0.76.1
|
||||
image: signoz/signoz:v0.76.2
|
||||
command:
|
||||
- --config=/root/config/prometheus.yml
|
||||
- --use-logs-new-schema=true
|
||||
- --use-trace-new-schema=true
|
||||
# ports:
|
||||
# - "8080:8080" # signoz port
|
||||
ports:
|
||||
- "8080:8080" # signoz port
|
||||
# - "6060:6060" # pprof port
|
||||
volumes:
|
||||
- ../common/signoz/prometheus.yml:/root/config/prometheus.yml
|
||||
|
||||
@@ -177,7 +177,7 @@ services:
|
||||
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
|
||||
signoz:
|
||||
!!merge <<: *db-depend
|
||||
image: signoz/signoz:${DOCKER_TAG:-v0.76.1}
|
||||
image: signoz/signoz:${DOCKER_TAG:-v0.76.2}
|
||||
container_name: signoz
|
||||
command:
|
||||
- --config=/root/config/prometheus.yml
|
||||
|
||||
@@ -110,15 +110,15 @@ services:
|
||||
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
|
||||
signoz:
|
||||
!!merge <<: *db-depend
|
||||
image: signoz/signoz:${DOCKER_TAG:-v0.76.1}
|
||||
image: signoz/signoz:${DOCKER_TAG:-v0.76.2}
|
||||
container_name: signoz
|
||||
command:
|
||||
- --config=/root/config/prometheus.yml
|
||||
- --gateway-url=https://api.staging.signoz.cloud
|
||||
- --use-logs-new-schema=true
|
||||
- --use-trace-new-schema=true
|
||||
# ports:
|
||||
# - "8080:8080" # signoz port
|
||||
ports:
|
||||
- "8080:8080" # signoz port
|
||||
# - "6060:6060" # pprof port
|
||||
volumes:
|
||||
- ../common/signoz/prometheus.yml:/root/config/prometheus.yml
|
||||
|
||||
@@ -110,7 +110,7 @@ services:
|
||||
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
|
||||
signoz:
|
||||
!!merge <<: *db-depend
|
||||
image: signoz/signoz:${DOCKER_TAG:-v0.76.1}
|
||||
image: signoz/signoz:${DOCKER_TAG:-v0.76.2}
|
||||
container_name: signoz
|
||||
command:
|
||||
- --config=/root/config/prometheus.yml
|
||||
|
||||
@@ -155,7 +155,7 @@ func (lm *Manager) ValidatorV3(ctx context.Context) {
|
||||
tick := time.NewTicker(validationFrequency)
|
||||
defer tick.Stop()
|
||||
|
||||
lm.ValidateV3(ctx)
|
||||
_ = lm.ValidateV3(ctx)
|
||||
for {
|
||||
select {
|
||||
case <-lm.done:
|
||||
@@ -165,7 +165,7 @@ func (lm *Manager) ValidatorV3(ctx context.Context) {
|
||||
case <-lm.done:
|
||||
return
|
||||
case <-tick.C:
|
||||
lm.ValidateV3(ctx)
|
||||
_ = lm.ValidateV3(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,11 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
|
||||
|
||||
const { platform } = activeLicenseV3;
|
||||
|
||||
if (isWorkspaceAccessRestricted && platform === LicensePlatform.CLOUD) {
|
||||
if (
|
||||
isWorkspaceAccessRestricted &&
|
||||
platform === LicensePlatform.CLOUD &&
|
||||
currentRoute
|
||||
) {
|
||||
navigateToWorkSpaceAccessRestricted(currentRoute);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ function App(): JSX.Element {
|
||||
trialInfo,
|
||||
activeLicenseV3,
|
||||
isFetchingActiveLicenseV3,
|
||||
activeLicenseV3FetchError,
|
||||
userFetchError,
|
||||
licensesFetchError,
|
||||
featureFlagsFetchError,
|
||||
@@ -264,12 +263,7 @@ function App(): JSX.Element {
|
||||
// if the user is in logged in state
|
||||
if (isLoggedInState) {
|
||||
// if the setup calls are loading then return a spinner
|
||||
if (
|
||||
isFetchingLicenses ||
|
||||
isFetchingUser ||
|
||||
isFetchingFeatureFlags ||
|
||||
isFetchingActiveLicenseV3
|
||||
) {
|
||||
if (isFetchingLicenses || isFetchingUser || isFetchingFeatureFlags) {
|
||||
return <Spinner tip="Loading..." />;
|
||||
}
|
||||
|
||||
@@ -277,7 +271,7 @@ function App(): JSX.Element {
|
||||
// this needs to be on top of data missing error because if there is an error, data will never be loaded and it will
|
||||
// move to indefinitive loading
|
||||
if (
|
||||
(userFetchError || licensesFetchError || activeLicenseV3FetchError) &&
|
||||
(userFetchError || licensesFetchError) &&
|
||||
pathname !== ROUTES.SOMETHING_WENT_WRONG
|
||||
) {
|
||||
history.replace(ROUTES.SOMETHING_WENT_WRONG);
|
||||
@@ -287,8 +281,7 @@ function App(): JSX.Element {
|
||||
if (
|
||||
(!licenses || !user.email || !featureFlags) &&
|
||||
!userFetchError &&
|
||||
!licensesFetchError &&
|
||||
!activeLicenseV3FetchError
|
||||
!licensesFetchError
|
||||
) {
|
||||
return <Spinner tip="Loading..." />;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,11 @@ import { useGetDeploymentsData } from 'hooks/CustomDomain/useGetDeploymentsData'
|
||||
import history from 'lib/history';
|
||||
import { Globe, Link2 } from 'lucide-react';
|
||||
import Card from 'periscope/components/Card/Card';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { LicensePlatform } from 'types/api/licensesV3/getActive';
|
||||
|
||||
import { DOCS_LINKS } from '../constants';
|
||||
|
||||
function DataSourceInfo({
|
||||
dataSentToSigNoz,
|
||||
@@ -15,6 +19,8 @@ function DataSourceInfo({
|
||||
dataSentToSigNoz: boolean;
|
||||
isLoading: boolean;
|
||||
}): JSX.Element {
|
||||
const { activeLicenseV3 } = useAppContext();
|
||||
|
||||
const notSendingData = !dataSentToSigNoz;
|
||||
|
||||
const {
|
||||
@@ -77,12 +83,36 @@ function DataSourceInfo({
|
||||
tabIndex={0}
|
||||
onClick={(): void => {
|
||||
logEvent('Homepage: Connect dataSource clicked', {});
|
||||
history.push(ROUTES.GET_STARTED);
|
||||
|
||||
if (
|
||||
activeLicenseV3 &&
|
||||
activeLicenseV3.platform === LicensePlatform.CLOUD
|
||||
) {
|
||||
history.push(ROUTES.GET_STARTED_WITH_CLOUD);
|
||||
} else {
|
||||
window?.open(
|
||||
DOCS_LINKS.ADD_DATA_SOURCE,
|
||||
'_blank',
|
||||
'noopener noreferrer',
|
||||
);
|
||||
}
|
||||
}}
|
||||
onKeyDown={(e): void => {
|
||||
if (e.key === 'Enter') {
|
||||
logEvent('Homepage: Connect dataSource clicked', {});
|
||||
history.push(ROUTES.GET_STARTED);
|
||||
|
||||
if (
|
||||
activeLicenseV3 &&
|
||||
activeLicenseV3.platform === LicensePlatform.CLOUD
|
||||
) {
|
||||
history.push(ROUTES.GET_STARTED_WITH_CLOUD);
|
||||
} else {
|
||||
window?.open(
|
||||
DOCS_LINKS.ADD_DATA_SOURCE,
|
||||
'_blank',
|
||||
'noopener noreferrer',
|
||||
);
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
/* eslint-disable sonarjs/cognitive-complexity */
|
||||
import './HomeChecklist.styles.scss';
|
||||
|
||||
import { Button } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import ROUTES from 'constants/routes';
|
||||
import history from 'lib/history';
|
||||
import { ArrowRight, ArrowRightToLine, BookOpenText } from 'lucide-react';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { LicensePlatform } from 'types/api/licensesV3/getActive';
|
||||
import { USER_ROLES } from 'types/roles';
|
||||
|
||||
export type ChecklistItem = {
|
||||
@@ -14,6 +17,7 @@ export type ChecklistItem = {
|
||||
description: string;
|
||||
completed: boolean;
|
||||
isSkipped: boolean;
|
||||
isSkippable?: boolean;
|
||||
skippedPreferenceKey?: string;
|
||||
toRoute?: string;
|
||||
docsLink?: string;
|
||||
@@ -28,7 +32,7 @@ function HomeChecklist({
|
||||
onSkip: (item: ChecklistItem) => void;
|
||||
isLoading: boolean;
|
||||
}): JSX.Element {
|
||||
const { user } = useAppContext();
|
||||
const { user, activeLicenseV3 } = useAppContext();
|
||||
|
||||
const [completedChecklistItems, setCompletedChecklistItems] = useState<
|
||||
ChecklistItem[]
|
||||
@@ -79,19 +83,32 @@ function HomeChecklist({
|
||||
{user?.role !== USER_ROLES.VIEWER && (
|
||||
<div className="whats-next-checklist-item-action-buttons">
|
||||
<div className="whats-next-checklist-item-action-buttons-container">
|
||||
<Link to={item.toRoute || ''}>
|
||||
<Button
|
||||
type="default"
|
||||
className="periscope-btn secondary"
|
||||
onClick={(): void => {
|
||||
logEvent('Welcome Checklist: Get started clicked', {
|
||||
step: item.id,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Get Started <ArrowRight size={16} />
|
||||
</Button>
|
||||
</Link>
|
||||
<Button
|
||||
type="default"
|
||||
className="periscope-btn secondary"
|
||||
onClick={(): void => {
|
||||
logEvent('Welcome Checklist: Get started clicked', {
|
||||
step: item.id,
|
||||
});
|
||||
|
||||
if (item.toRoute !== ROUTES.GET_STARTED_WITH_CLOUD) {
|
||||
history.push(item.toRoute || '');
|
||||
} else if (
|
||||
activeLicenseV3 &&
|
||||
activeLicenseV3.platform === LicensePlatform.CLOUD
|
||||
) {
|
||||
history.push(item.toRoute || '');
|
||||
} else {
|
||||
window?.open(
|
||||
item.docsLink || '',
|
||||
'_blank',
|
||||
'noopener noreferrer',
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Get Started <ArrowRight size={16} />
|
||||
</Button>
|
||||
|
||||
{item.docsLink && (
|
||||
<Button
|
||||
@@ -102,7 +119,7 @@ function HomeChecklist({
|
||||
step: item.id,
|
||||
});
|
||||
|
||||
window?.open(item.docsLink, '_blank');
|
||||
window?.open(item.docsLink, '_blank', 'noopener noreferrer');
|
||||
}}
|
||||
>
|
||||
<BookOpenText size={16} />
|
||||
@@ -110,7 +127,7 @@ function HomeChecklist({
|
||||
)}
|
||||
</div>
|
||||
|
||||
{!item.isSkipped && (
|
||||
{!item.isSkipped && item.isSkippable && (
|
||||
<div className="whats-next-checklist-item-action-buttons-container">
|
||||
<Button
|
||||
type="link"
|
||||
|
||||
@@ -11,6 +11,7 @@ import useGetTopLevelOperations from 'hooks/useGetTopLevelOperations';
|
||||
import useResourceAttribute from 'hooks/useResourceAttribute';
|
||||
import { convertRawQueriesToTraceSelectedTags } from 'hooks/useResourceAttribute/utils';
|
||||
import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
||||
import history from 'lib/history';
|
||||
import { ArrowRight, ArrowUpRight } from 'lucide-react';
|
||||
import Card from 'periscope/components/Card/Card';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
@@ -20,18 +21,29 @@ import { QueryKey } from 'react-query';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { AppState } from 'store/reducers';
|
||||
import {
|
||||
LicensePlatform,
|
||||
LicenseV3ResModel,
|
||||
} from 'types/api/licensesV3/getActive';
|
||||
import { ServicesList } from 'types/api/metrics/getService';
|
||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||
import { Tags } from 'types/reducer/trace';
|
||||
import { USER_ROLES } from 'types/roles';
|
||||
|
||||
import { DOCS_LINKS } from '../constants';
|
||||
import { columns, TIME_PICKER_OPTIONS } from './constants';
|
||||
|
||||
const homeInterval = 30 * 60 * 1000;
|
||||
|
||||
// Extracted EmptyState component
|
||||
const EmptyState = memo(
|
||||
({ user }: { user: IUser }): JSX.Element => (
|
||||
({
|
||||
user,
|
||||
activeLicenseV3,
|
||||
}: {
|
||||
user: IUser;
|
||||
activeLicenseV3: LicenseV3ResModel | null;
|
||||
}): JSX.Element => (
|
||||
<div className="empty-state-container">
|
||||
<div className="empty-state-content-container">
|
||||
<div className="empty-state-content">
|
||||
@@ -48,19 +60,31 @@ const EmptyState = memo(
|
||||
|
||||
{user?.role !== USER_ROLES.VIEWER && (
|
||||
<div className="empty-actions-container">
|
||||
<Link to={ROUTES.GET_STARTED}>
|
||||
<Button
|
||||
type="default"
|
||||
className="periscope-btn secondary"
|
||||
onClick={(): void => {
|
||||
logEvent('Homepage: Get Started clicked', {
|
||||
source: 'Service Metrics',
|
||||
});
|
||||
}}
|
||||
>
|
||||
Get Started <ArrowRight size={16} />
|
||||
</Button>
|
||||
</Link>
|
||||
<Button
|
||||
type="default"
|
||||
className="periscope-btn secondary"
|
||||
onClick={(): void => {
|
||||
logEvent('Homepage: Get Started clicked', {
|
||||
source: 'Service Metrics',
|
||||
});
|
||||
|
||||
if (
|
||||
activeLicenseV3 &&
|
||||
activeLicenseV3.platform === LicensePlatform.CLOUD
|
||||
) {
|
||||
history.push(ROUTES.GET_STARTED_WITH_CLOUD);
|
||||
} else {
|
||||
window?.open(
|
||||
DOCS_LINKS.ADD_DATA_SOURCE,
|
||||
'_blank',
|
||||
'noopener noreferrer',
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Get Started <ArrowRight size={16} />
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
type="link"
|
||||
className="learn-more-link"
|
||||
@@ -122,7 +146,7 @@ function ServiceMetrics({
|
||||
GlobalReducer
|
||||
>((state) => state.globalTime);
|
||||
|
||||
const { user } = useAppContext();
|
||||
const { user, activeLicenseV3 } = useAppContext();
|
||||
|
||||
const [timeRange, setTimeRange] = useState(() => {
|
||||
const now = new Date().getTime();
|
||||
@@ -311,7 +335,7 @@ function ServiceMetrics({
|
||||
{servicesExist ? (
|
||||
<ServicesListTable services={top5Services} onRowClick={handleRowClick} />
|
||||
) : (
|
||||
<EmptyState user={user} />
|
||||
<EmptyState user={user} activeLicenseV3={activeLicenseV3} />
|
||||
)}
|
||||
</Card.Content>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import logEvent from 'api/common/logEvent';
|
||||
import ROUTES from 'constants/routes';
|
||||
import { useQueryService } from 'hooks/useQueryService';
|
||||
import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
||||
import history from 'lib/history';
|
||||
import { ArrowRight, ArrowUpRight } from 'lucide-react';
|
||||
import Card from 'periscope/components/Card/Card';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
@@ -10,10 +11,12 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { AppState } from 'store/reducers';
|
||||
import { LicensePlatform } from 'types/api/licensesV3/getActive';
|
||||
import { ServicesList } from 'types/api/metrics/getService';
|
||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||
import { USER_ROLES } from 'types/roles';
|
||||
|
||||
import { DOCS_LINKS } from '../constants';
|
||||
import { columns, TIME_PICKER_OPTIONS } from './constants';
|
||||
|
||||
const homeInterval = 30 * 60 * 1000;
|
||||
@@ -29,7 +32,7 @@ export default function ServiceTraces({
|
||||
(state) => state.globalTime,
|
||||
);
|
||||
|
||||
const { user } = useAppContext();
|
||||
const { user, activeLicenseV3 } = useAppContext();
|
||||
|
||||
const now = new Date().getTime();
|
||||
const [timeRange, setTimeRange] = useState({
|
||||
@@ -112,19 +115,30 @@ export default function ServiceTraces({
|
||||
|
||||
{user?.role !== USER_ROLES.VIEWER && (
|
||||
<div className="empty-actions-container">
|
||||
<Link to={ROUTES.GET_STARTED}>
|
||||
<Button
|
||||
type="default"
|
||||
className="periscope-btn secondary"
|
||||
onClick={(): void => {
|
||||
logEvent('Homepage: Get Started clicked', {
|
||||
source: 'Service Traces',
|
||||
});
|
||||
}}
|
||||
>
|
||||
Get Started <ArrowRight size={16} />
|
||||
</Button>
|
||||
</Link>
|
||||
<Button
|
||||
type="default"
|
||||
className="periscope-btn secondary"
|
||||
onClick={(): void => {
|
||||
logEvent('Homepage: Get Started clicked', {
|
||||
source: 'Service Traces',
|
||||
});
|
||||
|
||||
if (
|
||||
activeLicenseV3 &&
|
||||
activeLicenseV3.platform === LicensePlatform.CLOUD
|
||||
) {
|
||||
history.push(ROUTES.GET_STARTED_WITH_CLOUD);
|
||||
} else {
|
||||
window?.open(
|
||||
DOCS_LINKS.ADD_DATA_SOURCE,
|
||||
'_blank',
|
||||
'noopener noreferrer',
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Get Started <ArrowRight size={16} />
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
type="link"
|
||||
@@ -146,7 +160,7 @@ export default function ServiceTraces({
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
[user?.role],
|
||||
[user?.role, activeLicenseV3],
|
||||
);
|
||||
|
||||
const renderDashboardsList = useCallback(
|
||||
|
||||
@@ -15,6 +15,7 @@ export const checkListStepToPreferenceKeyMap = {
|
||||
};
|
||||
|
||||
export const DOCS_LINKS = {
|
||||
ADD_DATA_SOURCE: 'https://signoz.io/docs/instrumentation/overview/',
|
||||
SEND_LOGS: 'https://signoz.io/docs/userguide/logs/',
|
||||
SEND_TRACES: 'https://signoz.io/docs/userguide/traces/',
|
||||
SEND_INFRA_METRICS:
|
||||
@@ -32,6 +33,7 @@ export const defaultChecklistItemsState: ChecklistItem[] = [
|
||||
description: '',
|
||||
completed: true,
|
||||
isSkipped: false,
|
||||
isSkippable: false,
|
||||
skippedPreferenceKey: checkListStepToPreferenceKeyMap.SETUP_WORKSPACE,
|
||||
},
|
||||
{
|
||||
@@ -41,7 +43,9 @@ export const defaultChecklistItemsState: ChecklistItem[] = [
|
||||
completed: false,
|
||||
isSkipped: false,
|
||||
skippedPreferenceKey: checkListStepToPreferenceKeyMap.ADD_DATA_SOURCE,
|
||||
toRoute: ROUTES.GET_STARTED,
|
||||
toRoute: ROUTES.GET_STARTED_WITH_CLOUD,
|
||||
docsLink: DOCS_LINKS.ADD_DATA_SOURCE,
|
||||
isSkippable: false,
|
||||
},
|
||||
{
|
||||
id: 'SEND_LOGS',
|
||||
@@ -50,8 +54,9 @@ export const defaultChecklistItemsState: ChecklistItem[] = [
|
||||
'Send your logs to SigNoz to get more visibility into how your resources interact.',
|
||||
completed: false,
|
||||
isSkipped: false,
|
||||
isSkippable: true,
|
||||
skippedPreferenceKey: checkListStepToPreferenceKeyMap.SEND_LOGS,
|
||||
toRoute: ROUTES.GET_STARTED,
|
||||
toRoute: ROUTES.GET_STARTED_WITH_CLOUD,
|
||||
docsLink: DOCS_LINKS.SEND_LOGS,
|
||||
},
|
||||
{
|
||||
@@ -61,8 +66,9 @@ export const defaultChecklistItemsState: ChecklistItem[] = [
|
||||
'Send your traces to SigNoz to get more visibility into how your resources interact.',
|
||||
completed: false,
|
||||
isSkipped: false,
|
||||
isSkippable: true,
|
||||
skippedPreferenceKey: checkListStepToPreferenceKeyMap.SEND_TRACES,
|
||||
toRoute: ROUTES.GET_STARTED,
|
||||
toRoute: ROUTES.GET_STARTED_WITH_CLOUD,
|
||||
docsLink: DOCS_LINKS.SEND_TRACES,
|
||||
},
|
||||
{
|
||||
@@ -72,8 +78,9 @@ export const defaultChecklistItemsState: ChecklistItem[] = [
|
||||
'Send your infra metrics to SigNoz to get more visibility into your infrastructure.',
|
||||
completed: false,
|
||||
isSkipped: false,
|
||||
isSkippable: true,
|
||||
skippedPreferenceKey: checkListStepToPreferenceKeyMap.SEND_INFRA_METRICS,
|
||||
toRoute: ROUTES.GET_STARTED,
|
||||
toRoute: ROUTES.GET_STARTED_WITH_CLOUD,
|
||||
docsLink: DOCS_LINKS.SEND_INFRA_METRICS,
|
||||
},
|
||||
{
|
||||
@@ -83,6 +90,7 @@ export const defaultChecklistItemsState: ChecklistItem[] = [
|
||||
'Setup alerts to get notified when your resources are not performing as expected.',
|
||||
completed: false,
|
||||
isSkipped: false,
|
||||
isSkippable: true,
|
||||
skippedPreferenceKey: checkListStepToPreferenceKeyMap.SETUP_ALERTS,
|
||||
toRoute: ROUTES.ALERTS_NEW,
|
||||
docsLink: DOCS_LINKS.SETUP_ALERTS,
|
||||
@@ -94,6 +102,7 @@ export const defaultChecklistItemsState: ChecklistItem[] = [
|
||||
'Save your views to get a quick overview of your data and share it with your team.',
|
||||
completed: false,
|
||||
isSkipped: false,
|
||||
isSkippable: true,
|
||||
skippedPreferenceKey: checkListStepToPreferenceKeyMap.SETUP_SAVED_VIEWS,
|
||||
toRoute: ROUTES.LOGS_EXPLORER,
|
||||
docsLink: DOCS_LINKS.SETUP_SAVED_VIEWS,
|
||||
@@ -105,6 +114,7 @@ export const defaultChecklistItemsState: ChecklistItem[] = [
|
||||
'Create dashboards to visualize your data and share it with your team.',
|
||||
completed: false,
|
||||
isSkipped: false,
|
||||
isSkippable: true,
|
||||
skippedPreferenceKey: checkListStepToPreferenceKeyMap.SETUP_DASHBOARDS,
|
||||
toRoute: ROUTES.ALL_DASHBOARD,
|
||||
docsLink: DOCS_LINKS.SETUP_DASHBOARDS,
|
||||
|
||||
@@ -11,10 +11,10 @@ function WorkspaceAccessRestricted(): JSX.Element {
|
||||
const { activeLicenseV3, isFetchingActiveLicenseV3 } = useAppContext();
|
||||
|
||||
useEffect(() => {
|
||||
if (!isFetchingActiveLicenseV3 && activeLicenseV3) {
|
||||
const isTerminated = activeLicenseV3.state === LicenseState.TERMINATED;
|
||||
const isExpired = activeLicenseV3.state === LicenseState.EXPIRED;
|
||||
const isCancelled = activeLicenseV3.state === LicenseState.CANCELLED;
|
||||
if (!isFetchingActiveLicenseV3) {
|
||||
const isTerminated = activeLicenseV3?.state === LicenseState.TERMINATED;
|
||||
const isExpired = activeLicenseV3?.state === LicenseState.EXPIRED;
|
||||
const isCancelled = activeLicenseV3?.state === LicenseState.CANCELLED;
|
||||
|
||||
const isWorkspaceAccessRestricted = isTerminated || isExpired || isCancelled;
|
||||
|
||||
@@ -22,7 +22,7 @@ function WorkspaceAccessRestricted(): JSX.Element {
|
||||
!isWorkspaceAccessRestricted ||
|
||||
activeLicenseV3.platform === LicensePlatform.SELF_HOSTED
|
||||
) {
|
||||
history.push(ROUTES.APPLICATION);
|
||||
history.push(ROUTES.HOME);
|
||||
}
|
||||
}
|
||||
}, [isFetchingActiveLicenseV3, activeLicenseV3]);
|
||||
|
||||
@@ -77,7 +77,7 @@ export default function WorkspaceBlocked(): JSX.Element {
|
||||
!shouldBlockWorkspace ||
|
||||
activeLicenseV3?.platform === LicensePlatform.SELF_HOSTED
|
||||
) {
|
||||
history.push(ROUTES.APPLICATION);
|
||||
history.push(ROUTES.HOME);
|
||||
}
|
||||
}
|
||||
}, [
|
||||
|
||||
@@ -56,15 +56,15 @@ function WorkspaceSuspended(): JSX.Element {
|
||||
}, [manageCreditCard]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isFetchingActiveLicenseV3 && activeLicenseV3) {
|
||||
if (!isFetchingActiveLicenseV3) {
|
||||
const shouldSuspendWorkspace =
|
||||
activeLicenseV3.state === LicenseState.DEFAULTED;
|
||||
activeLicenseV3?.state === LicenseState.DEFAULTED;
|
||||
|
||||
if (
|
||||
!shouldSuspendWorkspace ||
|
||||
activeLicenseV3?.platform === LicensePlatform.SELF_HOSTED
|
||||
) {
|
||||
history.push(ROUTES.APPLICATION);
|
||||
history.push(ROUTES.HOME);
|
||||
}
|
||||
}
|
||||
}, [isFetchingActiveLicenseV3, activeLicenseV3]);
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
func TestBatcherWithOneAlertAndDefaultConfigs(t *testing.T) {
|
||||
batcher := New(slog.New(slog.NewTextHandler(io.Discard, nil)), NewConfig())
|
||||
batcher.Start(context.Background())
|
||||
_ = batcher.Start(context.Background())
|
||||
|
||||
batcher.Add(context.Background(), &alertmanagertypes.PostableAlert{Alert: alertmanagertypes.AlertModel{
|
||||
Labels: map[string]string{"alertname": "test"},
|
||||
@@ -26,7 +26,7 @@ func TestBatcherWithOneAlertAndDefaultConfigs(t *testing.T) {
|
||||
|
||||
func TestBatcherWithBatchSize(t *testing.T) {
|
||||
batcher := New(slog.New(slog.NewTextHandler(io.Discard, nil)), Config{Size: 2, Capacity: 4})
|
||||
batcher.Start(context.Background())
|
||||
_ = batcher.Start(context.Background())
|
||||
|
||||
var alerts alertmanagertypes.PostableAlerts
|
||||
for i := 0; i < 4; i++ {
|
||||
@@ -46,7 +46,7 @@ func TestBatcherWithBatchSize(t *testing.T) {
|
||||
|
||||
func TestBatcherWithCClosed(t *testing.T) {
|
||||
batcher := New(slog.New(slog.NewTextHandler(io.Discard, nil)), Config{Size: 2, Capacity: 4})
|
||||
batcher.Start(context.Background())
|
||||
_ = batcher.Start(context.Background())
|
||||
|
||||
var alerts alertmanagertypes.PostableAlerts
|
||||
for i := 0; i < 4; i++ {
|
||||
|
||||
@@ -134,21 +134,21 @@ func New(ctx context.Context, logger *slog.Logger, registry prometheus.Registere
|
||||
// Don't return here - we need to snapshot our state first.
|
||||
}
|
||||
|
||||
state, err := server.stateStore.Get(ctx, server.orgID)
|
||||
storableSilences, err := server.stateStore.Get(ctx, server.orgID)
|
||||
if err != nil && !errors.Ast(err, errors.TypeNotFound) {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if state == nil {
|
||||
state = alertmanagertypes.NewStoreableState(server.orgID)
|
||||
if storableSilences == nil {
|
||||
storableSilences = alertmanagertypes.NewStoreableState(server.orgID)
|
||||
}
|
||||
|
||||
c, err := state.Set(alertmanagertypes.SilenceStateName, server.silences)
|
||||
c, err := storableSilences.Set(alertmanagertypes.SilenceStateName, server.silences)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return c, server.stateStore.Set(ctx, server.orgID, state)
|
||||
return c, server.stateStore.Set(ctx, server.orgID, storableSilences)
|
||||
})
|
||||
|
||||
}()
|
||||
@@ -163,21 +163,21 @@ func New(ctx context.Context, logger *slog.Logger, registry prometheus.Registere
|
||||
// Don't return without saving the current state.
|
||||
}
|
||||
|
||||
state, err := server.stateStore.Get(ctx, server.orgID)
|
||||
storableNFLog, err := server.stateStore.Get(ctx, server.orgID)
|
||||
if err != nil && !errors.Ast(err, errors.TypeNotFound) {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if state == nil {
|
||||
state = alertmanagertypes.NewStoreableState(server.orgID)
|
||||
if storableNFLog == nil {
|
||||
storableNFLog = alertmanagertypes.NewStoreableState(server.orgID)
|
||||
}
|
||||
|
||||
c, err := state.Set(alertmanagertypes.NFLogStateName, server.nflog)
|
||||
c, err := storableNFLog.Set(alertmanagertypes.NFLogStateName, server.nflog)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return c, server.stateStore.Set(ctx, server.orgID, state)
|
||||
return c, server.stateStore.Set(ctx, server.orgID, storableNFLog)
|
||||
})
|
||||
}()
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ func TestServerPutAlerts(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}))
|
||||
require.NotEmpty(t, server.alerts)
|
||||
|
||||
dummyRequest, err := http.NewRequest(http.MethodGet, "/alerts", nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -138,11 +138,15 @@ func (service *Service) TestAlert(ctx context.Context, orgID string, alert *aler
|
||||
}
|
||||
|
||||
func (service *Service) Stop(ctx context.Context) error {
|
||||
var errs []error
|
||||
for _, server := range service.servers {
|
||||
server.Stop(ctx)
|
||||
if err := server.Stop(ctx); err != nil {
|
||||
errs = append(errs, err)
|
||||
service.settings.Logger().Error("failed to stop alertmanager server", "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
|
||||
func (service *Service) newServer(ctx context.Context, orgID string) (*alertmanagerserver.Server, error) {
|
||||
@@ -180,7 +184,9 @@ func (service *Service) getConfig(ctx context.Context, orgID string) (*alertmana
|
||||
if err := config.SetGlobalConfig(service.config.Global); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
config.SetRouteConfig(service.config.Route)
|
||||
if err := config.SetRouteConfig(service.config.Route); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
||||
2
pkg/cache/memorycache/provider.go
vendored
2
pkg/cache/memorycache/provider.go
vendored
@@ -75,7 +75,7 @@ func (c *provider) SetTTL(_ context.Context, cacheKey string, ttl time.Duration)
|
||||
if !found {
|
||||
return
|
||||
}
|
||||
c.cc.Replace(cacheKey, item, ttl)
|
||||
_ = c.cc.Replace(cacheKey, item, ttl)
|
||||
}
|
||||
|
||||
// Remove removes the cache entry
|
||||
|
||||
12
pkg/cache/rediscache/provider_test.go
vendored
12
pkg/cache/rediscache/provider_test.go
vendored
@@ -35,7 +35,7 @@ func TestStore(t *testing.T) {
|
||||
}
|
||||
|
||||
mock.ExpectSet("key", storeCacheableEntity, 10*time.Second).RedisNil()
|
||||
cache.Store(context.Background(), "key", storeCacheableEntity, 10*time.Second)
|
||||
_ = cache.Store(context.Background(), "key", storeCacheableEntity, 10*time.Second)
|
||||
|
||||
if err := mock.ExpectationsWereMet(); err != nil {
|
||||
t.Errorf("there were unfulfilled expectations: %s", err)
|
||||
@@ -53,7 +53,7 @@ func TestRetrieve(t *testing.T) {
|
||||
retrieveCacheableEntity := new(CacheableEntity)
|
||||
|
||||
mock.ExpectSet("key", storeCacheableEntity, 10*time.Second).RedisNil()
|
||||
cache.Store(context.Background(), "key", storeCacheableEntity, 10*time.Second)
|
||||
_ = cache.Store(context.Background(), "key", storeCacheableEntity, 10*time.Second)
|
||||
|
||||
data, err := storeCacheableEntity.MarshalBinary()
|
||||
assert.NoError(t, err)
|
||||
@@ -85,7 +85,7 @@ func TestSetTTL(t *testing.T) {
|
||||
}
|
||||
|
||||
mock.ExpectSet("key", storeCacheableEntity, 10*time.Second).RedisNil()
|
||||
cache.Store(context.Background(), "key", storeCacheableEntity, 10*time.Second)
|
||||
_ = cache.Store(context.Background(), "key", storeCacheableEntity, 10*time.Second)
|
||||
|
||||
mock.ExpectExpire("key", 4*time.Second).RedisNil()
|
||||
cache.SetTTL(context.Background(), "key", 4*time.Second)
|
||||
@@ -105,7 +105,7 @@ func TestRemove(t *testing.T) {
|
||||
}
|
||||
|
||||
mock.ExpectSet("key", storeCacheableEntity, 10*time.Second).RedisNil()
|
||||
c.Store(context.Background(), "key", storeCacheableEntity, 10*time.Second)
|
||||
_ = c.Store(context.Background(), "key", storeCacheableEntity, 10*time.Second)
|
||||
|
||||
mock.ExpectDel("key").RedisNil()
|
||||
c.Remove(context.Background(), "key")
|
||||
@@ -125,10 +125,10 @@ func TestBulkRemove(t *testing.T) {
|
||||
}
|
||||
|
||||
mock.ExpectSet("key", storeCacheableEntity, 10*time.Second).RedisNil()
|
||||
c.Store(context.Background(), "key", storeCacheableEntity, 10*time.Second)
|
||||
_ = c.Store(context.Background(), "key", storeCacheableEntity, 10*time.Second)
|
||||
|
||||
mock.ExpectSet("key2", storeCacheableEntity, 10*time.Second).RedisNil()
|
||||
c.Store(context.Background(), "key2", storeCacheableEntity, 10*time.Second)
|
||||
_ = c.Store(context.Background(), "key2", storeCacheableEntity, 10*time.Second)
|
||||
|
||||
mock.ExpectDel("key", "key2").RedisNil()
|
||||
c.BulkRemove(context.Background(), []string{"key", "key2"})
|
||||
|
||||
@@ -82,7 +82,7 @@ func (a *Analytics) extractQueryRangeData(path string, r *http.Request) (map[str
|
||||
}
|
||||
r.Body.Close() // must close
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
||||
json.Unmarshal(bodyBytes, &postData)
|
||||
_ = json.Unmarshal(bodyBytes, &postData)
|
||||
|
||||
} else {
|
||||
return nil, false
|
||||
|
||||
@@ -166,8 +166,8 @@ func (r *Repo) insertConfig(
|
||||
defer func() {
|
||||
if fnerr != nil {
|
||||
// remove all the damage (invalid rows from db)
|
||||
r.db.Exec("DELETE FROM agent_config_versions WHERE id = $1", c.ID)
|
||||
r.db.Exec("DELETE FROM agent_config_elements WHERE version_id=$1", c.ID)
|
||||
_, _ = r.db.Exec("DELETE FROM agent_config_versions WHERE id = $1", c.ID)
|
||||
_, _ = r.db.Exec("DELETE FROM agent_config_elements WHERE version_id=$1", c.ID)
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ func (m *Manager) RecommendAgentConfig(currentConfYaml []byte) (
|
||||
|
||||
settingVersionsUsed = append(settingVersionsUsed, configId)
|
||||
|
||||
m.updateDeployStatus(
|
||||
_ = m.updateDeployStatus(
|
||||
context.Background(),
|
||||
featureType,
|
||||
configVersion,
|
||||
@@ -168,7 +168,7 @@ func (m *Manager) ReportConfigDeploymentStatus(
|
||||
newStatus = string(DeployFailed)
|
||||
message = fmt.Sprintf("%s: %s", agentId, err.Error())
|
||||
}
|
||||
m.updateDeployStatusByHash(
|
||||
_ = m.updateDeployStatusByHash(
|
||||
context.Background(), featureConfId, newStatus, message,
|
||||
)
|
||||
}
|
||||
@@ -247,7 +247,7 @@ func Redeploy(ctx context.Context, typ ElementTypeDef, version int) *model.ApiEr
|
||||
return model.InternalError(fmt.Errorf("failed to deploy the config"))
|
||||
}
|
||||
|
||||
m.updateDeployStatus(ctx, ElementTypeSamplingRules, version, string(DeployInitiated), "Deployment started", configHash, configVersion.LastConf)
|
||||
_ = m.updateDeployStatus(ctx, ElementTypeSamplingRules, version, string(DeployInitiated), "Deployment started", configHash, configVersion.LastConf)
|
||||
case ElementTypeDropRules:
|
||||
var filterConfig *filterprocessor.Config
|
||||
if err := yaml.Unmarshal([]byte(configVersion.LastConf), &filterConfig); err != nil {
|
||||
@@ -265,7 +265,7 @@ func Redeploy(ctx context.Context, typ ElementTypeDef, version int) *model.ApiEr
|
||||
return err
|
||||
}
|
||||
|
||||
m.updateDeployStatus(ctx, ElementTypeSamplingRules, version, string(DeployInitiated), "Deployment started", configHash, configVersion.LastConf)
|
||||
_ = m.updateDeployStatus(ctx, ElementTypeSamplingRules, version, string(DeployInitiated), "Deployment started", configHash, configVersion.LastConf)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -296,7 +296,7 @@ func UpsertFilterProcessor(ctx context.Context, version int, config *filterproce
|
||||
zap.L().Warn("unexpected error while transforming processor config to yaml", zap.Error(yamlErr))
|
||||
}
|
||||
|
||||
m.updateDeployStatus(ctx, ElementTypeDropRules, version, string(DeployInitiated), "Deployment started", configHash, string(processorConfYaml))
|
||||
_ = m.updateDeployStatus(ctx, ElementTypeDropRules, version, string(DeployInitiated), "Deployment started", configHash, string(processorConfYaml))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ func (m *Manager) OnConfigUpdate(agentId string, hash string, err error) {
|
||||
message = fmt.Sprintf("%s: %s", agentId, err.Error())
|
||||
}
|
||||
|
||||
m.updateDeployStatusByHash(context.Background(), hash, status, message)
|
||||
_ = m.updateDeployStatusByHash(context.Background(), hash, status, message)
|
||||
}
|
||||
|
||||
// UpsertSamplingProcessor updates the agent config with new filter processor params
|
||||
@@ -347,6 +347,6 @@ func UpsertSamplingProcessor(ctx context.Context, version int, config *tsp.Confi
|
||||
zap.L().Warn("unexpected error while transforming processor config to yaml", zap.Error(yamlErr))
|
||||
}
|
||||
|
||||
m.updateDeployStatus(ctx, ElementTypeSamplingRules, version, string(DeployInitiated), "Deployment started", configHash, string(processorConfYaml))
|
||||
_ = m.updateDeployStatus(ctx, ElementTypeSamplingRules, version, string(DeployInitiated), "Deployment started", configHash, string(processorConfYaml))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func Enrich(params *v3.QueryRangeParamsV3, fields map[string]v3.AttributeKey) {
|
||||
if query.Expression != queryName && query.DataSource != v3.DataSourceLogs {
|
||||
continue
|
||||
}
|
||||
EnrichLogsQuery(query, fields)
|
||||
_ = EnrichLogsQuery(query, fields)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ func (ta *MockAgentConfigProvider) RecommendAgentConfig(baseConfYaml []byte) (
|
||||
return nil, "", errors.Wrap(err, "could not unmarshal baseConf")
|
||||
}
|
||||
|
||||
k.Set("extensions.zpages.endpoint", ta.ZPagesEndpoint)
|
||||
_ = k.Set("extensions.zpages.endpoint", ta.ZPagesEndpoint)
|
||||
recommendedYaml, err := k.Marshal(yaml.Parser())
|
||||
if err != nil {
|
||||
return nil, "", errors.Wrap(err, "could not marshal recommended conf")
|
||||
|
||||
@@ -359,5 +359,5 @@ func (agent *Agent) SendToAgent(msg *protobufs.ServerToAgent) {
|
||||
agent.connMutex.Lock()
|
||||
defer agent.connMutex.Unlock()
|
||||
|
||||
agent.conn.Send(context.Background(), msg)
|
||||
_ = agent.conn.Send(context.Background(), msg)
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ func (agents *Agents) RemoveConnection(conn types.Connection) {
|
||||
agent := agents.agentsById[instanceId]
|
||||
agent.CurrentStatus = AgentStatusDisconnected
|
||||
agent.TerminatedAt = time.Now()
|
||||
agent.Upsert()
|
||||
_ = agent.Upsert()
|
||||
delete(agents.agentsById, instanceId)
|
||||
}
|
||||
delete(agents.connections, conn)
|
||||
|
||||
@@ -71,7 +71,7 @@ func (srv *Server) Stop() {
|
||||
defer cleanup()
|
||||
}
|
||||
|
||||
srv.server.Stop(context.Background())
|
||||
_ = srv.server.Stop(context.Background())
|
||||
}
|
||||
|
||||
func (srv *Server) onDisconnect(conn types.Connection) {
|
||||
|
||||
@@ -160,7 +160,7 @@ func (cp *ConfigParser) CheckProcessorInPipeline(pipelineName, name string) bool
|
||||
func (cp *ConfigParser) Merge(c *confmap.Conf) {
|
||||
cp.lock.Lock()
|
||||
defer cp.lock.Unlock()
|
||||
cp.agentConf.Merge(c)
|
||||
_ = cp.agentConf.Merge(c)
|
||||
}
|
||||
|
||||
func (cp *ConfigParser) UpdateProcessors(processors map[string]interface{}) {
|
||||
|
||||
2
pkg/query-service/cache/inmemory/cache.go
vendored
2
pkg/query-service/cache/inmemory/cache.go
vendored
@@ -47,7 +47,7 @@ func (c *cache) SetTTL(cacheKey string, ttl time.Duration) {
|
||||
if !found {
|
||||
return
|
||||
}
|
||||
c.cc.Replace(cacheKey, item, ttl)
|
||||
_ = c.cc.Replace(cacheKey, item, ttl)
|
||||
}
|
||||
|
||||
// Remove removes the cache entry
|
||||
|
||||
12
pkg/query-service/cache/redis/redis_test.go
vendored
12
pkg/query-service/cache/redis/redis_test.go
vendored
@@ -13,7 +13,7 @@ func TestStore(t *testing.T) {
|
||||
c := WithClient(db)
|
||||
|
||||
mock.ExpectSet("key", []byte("value"), 10*time.Second).RedisNil()
|
||||
c.Store("key", []byte("value"), 10*time.Second)
|
||||
_ = c.Store("key", []byte("value"), 10*time.Second)
|
||||
|
||||
if err := mock.ExpectationsWereMet(); err != nil {
|
||||
t.Errorf("there were unfulfilled expectations: %s", err)
|
||||
@@ -24,7 +24,7 @@ func TestRetrieve(t *testing.T) {
|
||||
db, mock := redismock.NewClientMock()
|
||||
c := WithClient(db)
|
||||
mock.ExpectSet("key", []byte("value"), 10*time.Second).RedisNil()
|
||||
c.Store("key", []byte("value"), 10*time.Second)
|
||||
_ = c.Store("key", []byte("value"), 10*time.Second)
|
||||
|
||||
mock.ExpectGet("key").SetVal("value")
|
||||
data, retrieveStatus, err := c.Retrieve("key", false)
|
||||
@@ -49,7 +49,7 @@ func TestSetTTL(t *testing.T) {
|
||||
db, mock := redismock.NewClientMock()
|
||||
c := WithClient(db)
|
||||
mock.ExpectSet("key", []byte("value"), 10*time.Second).RedisNil()
|
||||
c.Store("key", []byte("value"), 10*time.Second)
|
||||
_ = c.Store("key", []byte("value"), 10*time.Second)
|
||||
|
||||
mock.ExpectExpire("key", 4*time.Second).RedisNil()
|
||||
c.SetTTL("key", 4*time.Second)
|
||||
@@ -63,7 +63,7 @@ func TestRemove(t *testing.T) {
|
||||
db, mock := redismock.NewClientMock()
|
||||
c := WithClient(db)
|
||||
mock.ExpectSet("key", []byte("value"), 10*time.Second).RedisNil()
|
||||
c.Store("key", []byte("value"), 10*time.Second)
|
||||
_ = c.Store("key", []byte("value"), 10*time.Second)
|
||||
|
||||
mock.ExpectDel("key").RedisNil()
|
||||
c.Remove("key")
|
||||
@@ -77,10 +77,10 @@ func TestBulkRemove(t *testing.T) {
|
||||
db, mock := redismock.NewClientMock()
|
||||
c := WithClient(db)
|
||||
mock.ExpectSet("key", []byte("value"), 10*time.Second).RedisNil()
|
||||
c.Store("key", []byte("value"), 10*time.Second)
|
||||
_ = c.Store("key", []byte("value"), 10*time.Second)
|
||||
|
||||
mock.ExpectSet("key2", []byte("value2"), 10*time.Second).RedisNil()
|
||||
c.Store("key2", []byte("value2"), 10*time.Second)
|
||||
_ = c.Store("key2", []byte("value2"), 10*time.Second)
|
||||
|
||||
mock.ExpectDel("key", "key2").RedisNil()
|
||||
c.BulkRemove([]string{"key", "key2"})
|
||||
|
||||
@@ -354,7 +354,7 @@ func (item *SearchSpanResponseItem) GetValues() []interface{} {
|
||||
|
||||
references := []OtelSpanRef{}
|
||||
jsonbody, _ := json.Marshal(item.References)
|
||||
json.Unmarshal(jsonbody, &references)
|
||||
_ = json.Unmarshal(jsonbody, &references)
|
||||
|
||||
referencesStringArray := []string{}
|
||||
for _, item := range references {
|
||||
@@ -750,7 +750,7 @@ type ClusterInfo struct {
|
||||
func (ci *ClusterInfo) GetMapFromStruct() map[string]interface{} {
|
||||
var clusterInfoMap map[string]interface{}
|
||||
data, _ := json.Marshal(*ci)
|
||||
json.Unmarshal(data, &clusterInfoMap)
|
||||
_ = json.Unmarshal(data, &clusterInfoMap)
|
||||
return clusterInfoMap
|
||||
}
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@ func FromReader(ch interfaces.Reader) (*PqlEngine, error) {
|
||||
func NewPqlEngine(config *pconfig.Config) (*PqlEngine, error) {
|
||||
|
||||
logLevel := promlog.AllowedLevel{}
|
||||
logLevel.Set("debug")
|
||||
_ = logLevel.Set("debug")
|
||||
|
||||
allowedFormat := promlog.AllowedFormat{}
|
||||
allowedFormat.Set("logfmt")
|
||||
_ = allowedFormat.Set("logfmt")
|
||||
|
||||
promlogConfig := promlog.Config{
|
||||
Level: &logLevel,
|
||||
@@ -80,7 +80,7 @@ func NewPqlEngine(config *pconfig.Config) (*PqlEngine, error) {
|
||||
)
|
||||
fanoutStorage := pstorage.NewFanout(logger, remoteStorage)
|
||||
|
||||
remoteStorage.ApplyConfig(config)
|
||||
_ = remoteStorage.ApplyConfig(config)
|
||||
|
||||
return &PqlEngine{
|
||||
engine: e,
|
||||
|
||||
@@ -515,8 +515,8 @@ func createTelemetry() {
|
||||
nextHeartbeat := calculateNextRun(HEART_BEAT_DURATION, SCHEDULE_START_TIME)
|
||||
nextActiveUser := calculateNextRun(ACTIVE_USER_DURATION, SCHEDULE_START_TIME)
|
||||
|
||||
s.Every(HEART_BEAT_DURATION).StartAt(nextHeartbeat).Do(heartbeatFunc)
|
||||
s.Every(ACTIVE_USER_DURATION).StartAt(nextActiveUser).Do(activeUserFunc)
|
||||
_, _ = s.Every(HEART_BEAT_DURATION).StartAt(nextHeartbeat).Do(heartbeatFunc)
|
||||
_, _ = s.Every(ACTIVE_USER_DURATION).StartAt(nextActiveUser).Do(activeUserFunc)
|
||||
}
|
||||
|
||||
// Schedule immediate execution and subsequent runs
|
||||
@@ -559,18 +559,18 @@ func (a *Telemetry) IdentifyUser(user *types.User) {
|
||||
|
||||
if a.saasOperator != nil {
|
||||
if role != "" {
|
||||
a.saasOperator.Enqueue(analytics.Identify{
|
||||
_ = a.saasOperator.Enqueue(analytics.Identify{
|
||||
UserId: a.userEmail,
|
||||
Traits: analytics.NewTraits().SetName(user.Name).SetEmail(user.Email).Set("role", role),
|
||||
})
|
||||
} else {
|
||||
a.saasOperator.Enqueue(analytics.Identify{
|
||||
_ = a.saasOperator.Enqueue(analytics.Identify{
|
||||
UserId: a.userEmail,
|
||||
Traits: analytics.NewTraits().SetName(user.Name).SetEmail(user.Email),
|
||||
})
|
||||
}
|
||||
|
||||
a.saasOperator.Enqueue(analytics.Group{
|
||||
_ = a.saasOperator.Enqueue(analytics.Group{
|
||||
UserId: a.userEmail,
|
||||
GroupId: a.getCompanyDomain(),
|
||||
Traits: analytics.NewTraits().Set("company_domain", a.getCompanyDomain()),
|
||||
@@ -578,12 +578,12 @@ func (a *Telemetry) IdentifyUser(user *types.User) {
|
||||
}
|
||||
|
||||
if a.ossOperator != nil {
|
||||
a.ossOperator.Enqueue(analytics.Identify{
|
||||
_ = a.ossOperator.Enqueue(analytics.Identify{
|
||||
UserId: a.ipAddress,
|
||||
Traits: analytics.NewTraits().SetName(user.Name).SetEmail(user.Email).Set("ip", a.ipAddress),
|
||||
})
|
||||
// Updating a groups properties
|
||||
a.ossOperator.Enqueue(analytics.Group{
|
||||
_ = a.ossOperator.Enqueue(analytics.Group{
|
||||
UserId: a.ipAddress,
|
||||
GroupId: a.getCompanyDomain(),
|
||||
Traits: analytics.NewTraits().Set("company_domain", a.getCompanyDomain()),
|
||||
@@ -611,13 +611,13 @@ func (a *Telemetry) SendIdentifyEvent(data map[string]interface{}, userEmail str
|
||||
traits.Set(k, v)
|
||||
}
|
||||
if a.saasOperator != nil {
|
||||
a.saasOperator.Enqueue(analytics.Identify{
|
||||
_ = a.saasOperator.Enqueue(analytics.Identify{
|
||||
UserId: a.GetUserEmail(),
|
||||
Traits: traits,
|
||||
})
|
||||
}
|
||||
if a.ossOperator != nil {
|
||||
a.ossOperator.Enqueue(analytics.Identify{
|
||||
_ = a.ossOperator.Enqueue(analytics.Identify{
|
||||
UserId: a.ipAddress,
|
||||
Traits: traits,
|
||||
})
|
||||
@@ -644,14 +644,14 @@ func (a *Telemetry) SendGroupEvent(data map[string]interface{}, userEmail string
|
||||
traits.Set(k, v)
|
||||
}
|
||||
if a.saasOperator != nil {
|
||||
a.saasOperator.Enqueue(analytics.Group{
|
||||
_ = a.saasOperator.Enqueue(analytics.Group{
|
||||
UserId: a.GetUserEmail(),
|
||||
GroupId: a.getCompanyDomain(),
|
||||
Traits: traits,
|
||||
})
|
||||
}
|
||||
if a.ossOperator != nil {
|
||||
a.ossOperator.Enqueue(analytics.Group{
|
||||
_ = a.ossOperator.Enqueue(analytics.Group{
|
||||
UserId: a.ipAddress,
|
||||
GroupId: a.getCompanyDomain(),
|
||||
Traits: traits,
|
||||
@@ -757,7 +757,7 @@ func (a *Telemetry) SendEvent(event string, data map[string]interface{}, userEma
|
||||
_, isSaaSEvent := SAAS_EVENTS_LIST[event]
|
||||
|
||||
if a.saasOperator != nil && a.GetUserEmail() != "" && (isSaaSEvent || viaEventsAPI) {
|
||||
a.saasOperator.Enqueue(analytics.Track{
|
||||
_ = a.saasOperator.Enqueue(analytics.Track{
|
||||
Event: event,
|
||||
UserId: a.GetUserEmail(),
|
||||
Properties: properties,
|
||||
@@ -772,7 +772,7 @@ func (a *Telemetry) SendEvent(event string, data map[string]interface{}, userEma
|
||||
_, isOSSEvent := OSS_EVENTS_LIST[event]
|
||||
|
||||
if a.ossOperator != nil && isOSSEvent {
|
||||
a.ossOperator.Enqueue(analytics.Track{
|
||||
_ = a.ossOperator.Enqueue(analytics.Track{
|
||||
Event: event,
|
||||
UserId: userId,
|
||||
Properties: properties,
|
||||
|
||||
@@ -70,7 +70,7 @@ func NewQueryServiceDBForTests(t *testing.T) sqlstore.SQLStore {
|
||||
if err != nil {
|
||||
t.Fatalf("could not initialize dao: %v", err)
|
||||
}
|
||||
dashboards.InitDB(sqlStore.BunDB())
|
||||
_ = dashboards.InitDB(sqlStore.BunDB())
|
||||
|
||||
return sqlStore
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func (migration *modifyDatetime) Up(ctx context.Context, db *bun.DB) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
defer tx.Rollback() //nolint:errcheck
|
||||
|
||||
tables := []string{"dashboards", "rules", "planned_maintenance", "ttl_status", "saved_views"}
|
||||
columns := []string{"created_at", "updated_at"}
|
||||
|
||||
@@ -38,7 +38,7 @@ func (migration *modifyOrgDomain) Up(ctx context.Context, db *bun.DB) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
defer tx.Rollback() //nolint:errcheck
|
||||
|
||||
// rename old column
|
||||
if _, err := tx.ExecContext(ctx, `ALTER TABLE org_domains RENAME COLUMN updated_at TO updated_at_old`); err != nil {
|
||||
|
||||
@@ -42,7 +42,7 @@ func (migration *updateOrganization) Up(ctx context.Context, db *bun.DB) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
defer tx.Rollback() //nolint:errcheck
|
||||
|
||||
// update apdex settings table
|
||||
if err := updateApdexSettings(ctx, tx); err != nil {
|
||||
|
||||
@@ -41,7 +41,7 @@ func (migration *updateDashboardAndSavedViews) Up(ctx context.Context, db *bun.D
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
defer tx.Rollback() //nolint:errcheck
|
||||
|
||||
// get all org ids
|
||||
var orgIDs []string
|
||||
|
||||
@@ -84,14 +84,13 @@ func (dialect *PGDialect) MigrateIntToBoolean(ctx context.Context, bun bun.IDB,
|
||||
|
||||
func (dialect *PGDialect) GetColumnType(ctx context.Context, bun bun.IDB, table string, column string) (string, error) {
|
||||
var columnType string
|
||||
var err error
|
||||
err = bun.NewSelect().
|
||||
|
||||
err := bun.NewSelect().
|
||||
ColumnExpr("data_type").
|
||||
TableExpr("information_schema.columns").
|
||||
Where("table_name = ?", table).
|
||||
Where("column_name = ?", column).
|
||||
Scan(ctx, &columnType)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -84,14 +84,12 @@ func (dialect *SQLiteDialect) MigrateIntToBoolean(ctx context.Context, bun bun.I
|
||||
|
||||
func (dialect *SQLiteDialect) GetColumnType(ctx context.Context, bun bun.IDB, table string, column string) (string, error) {
|
||||
var columnType string
|
||||
var err error
|
||||
|
||||
err = bun.NewSelect().
|
||||
err := bun.NewSelect().
|
||||
ColumnExpr("type").
|
||||
TableExpr("pragma_table_info(?)", table).
|
||||
Where("name = ?", column).
|
||||
Scan(ctx, &columnType)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ func (s *StateStore) Set(ctx context.Context, orgID string, storeableState *aler
|
||||
}
|
||||
|
||||
func (s *StateStore) Get(ctx context.Context, orgID string) (*alertmanagertypes.StoreableState, error) {
|
||||
s.mtx.RLock()
|
||||
defer s.mtx.RUnlock()
|
||||
if _, ok := s.states[orgID]; !ok {
|
||||
return nil, errors.Newf(errors.TypeNotFound, alertmanagertypes.ErrCodeAlertmanagerStateNotFound, "state for orgID %q not found", orgID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user