Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix(license): fixes for license service (#8121)

Vikrant Gupta9d397d08670c
diff --git a/ee/licensing/httplicensing/provider.go b/ee/licensing/httplicensing/provider.go
index 5874df44d9..1cfdad4d37 100644
--- a/ee/licensing/httplicensing/provider.go
+++ b/ee/licensing/httplicensing/provider.go
@@ -3,9 +3,10 @@ package httplicensing
import (
"context"
"encoding/json"
- "github.com/SigNoz/signoz/ee/query-service/constants"
"time"
+ "github.com/SigNoz/signoz/ee/query-service/constants"
+
"github.com/SigNoz/signoz/ee/licensing/licensingstore/sqllicensingstore"
"github.com/SigNoz/signoz/pkg/errors"
"github.com/SigNoz/signoz/pkg/factory"
@@ -177,6 +178,11 @@ func (provider *provider) Refresh(ctx context.Context, organizationID valuer.UUI
return err
}
+ err = provider.InitFeatures(ctx, activeLicense.Features)
+ if err != nil {
+ return err
+ }
+
return nil
}
diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsx
index a97fd7e933..32ccafa838 100644
--- a/frontend/src/AppRoutes/index.tsx
+++ b/frontend/src/AppRoutes/index.tsx
@@ -28,6 +28,7 @@ import { QueryBuilderProvider } from 'providers/QueryBuilder';
import { Suspense, useCallback, useEffect, useState } from 'react';
import { Route, Router, Switch } from 'react-router-dom';
import { CompatRouter } from 'react-router-dom-v5-compat';
+import { LicenseStatus } from 'types/api/licensesV3/getActive';
import { Userpilot } from 'userpilot';
import { extractDomain } from 'utils/app';
@@ -171,11 +172,13 @@ function App(): JSX.Element {
user &&
!!user.email
) {
+ // either the active API returns error with 404 or 501 and if it returns a terminated license means it's on basic plan
const isOnBasicPlan =
- activeLicenseFetchError &&
- [StatusCodes.NOT_FOUND, StatusCodes.NOT_IMPLEMENTED].includes(
- activeLicenseFetchError?.getHttpStatusCode(),
- );
+ (activeLicenseFetchError &&
+ [StatusCodes.NOT_FOUND, StatusCodes.NOT_IMPLEMENTED].includes(
+ activeLicenseFetchError?.getHttpStatusCode(),
+ )) ||
+ (activeLicense?.status && activeLicense.status === LicenseStatus.INVALID);
const isIdentifiedUser = getLocalStorageApi(LOCALSTORAGE.IS_IDENTIFIED_USER);
if (isLoggedInState && user && user.id && user.email && !isIdentifiedUser) {
@@ -190,6 +193,10 @@ function App(): JSX.Element {
updatedRoutes = updatedRoutes.filter(
(route) => route?.path !== ROUTES.BILLING,
);
+
+ if (isEnterpriseSelfHostedUser) {
+ updatedRoutes.push(LIST_LICENSES);
+ }
}
// always add support route for cloud users
updatedRoutes = [...updatedRoutes, SUPPORT_ROUTE];
diff --git a/frontend/src/container/SideNav/SideNav.tsx b/frontend/src/container/SideNav/SideNav.tsx
index d3c0b03c5b..a9e0d7c087 100644
--- a/frontend/src/container/SideNav/SideNav.tsx
+++ b/frontend/src/container/SideNav/SideNav.tsx
@@ -26,6 +26,7 @@ import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';
import { AppState } from 'store/reducers';
+import { LicenseStatus } from 'types/api/licensesV3/getActive';
import AppReducer from 'types/reducer/app';
import { USER_ROLES } from 'types/roles';
import { checkVersionState } from 'utils/app';
@@ -301,10 +302,11 @@ function SideNav(): JSX.Element {
}
const isOnBasicPlan =
- activeLicenseFetchError &&
- [StatusCodes.NOT_FOUND, StatusCodes.NOT_IMPLEMENTED].includes(
- activeLicenseFetchError?.getHttpStatusCode(),
- );
+ (activeLicenseFetchError &&
+ [StatusCodes.NOT_FOUND, StatusCodes.NOT_IMPLEMENTED].includes(
+ activeLicenseFetchError?.getHttpStatusCode(),
+ )) ||
+ (activeLicense?.status && activeLicense.status === LicenseStatus.INVALID);
if (user.role !== USER_ROLES.ADMIN || isOnBasicPlan) {
updatedMenuItems = updatedMenuItems.filter(
@@ -353,6 +355,7 @@ function SideNav(): JSX.Element {
t,
user.role,
activeLicenseFetchError,
+ activeLicense?.status,
]);
return (
diff --git a/frontend/src/types/api/licensesV3/getActive.ts b/frontend/src/types/api/licensesV3/getActive.ts
index a26d766064..be0d488b5e 100644
--- a/frontend/src/types/api/licensesV3/getActive.ts
+++ b/frontend/src/types/api/licensesV3/getActive.ts
@@ -6,6 +6,7 @@ export enum LicenseEvent {
export enum LicenseStatus {
SUSPENDED = 'SUSPENDED',
VALID = 'VALID',
+ INVALID = 'INVALID',
}
export enum LicenseState {
diff --git a/pkg/types/licensetypes/license.go b/pkg/types/licensetypes/license.go
index e0a1a1a49e..d78c45585a 100644
--- a/pkg/types/licensetypes/license.go
+++ b/pkg/types/licensetypes/license.go
@@ -87,9 +87,6 @@ func GetActiveLicenseFromStorableLicenses(storableLicenses []*StorableLicense, o
return nil, err
}
- if license.Status == "INVALID" {
- continue
- }
if activeLicense == nil &&
(license.ValidFrom != 0) &&
(license.ValidUntil == -1 || license.ValidUntil > time.Now().Unix()) {