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.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore(licensing): remove the legacy billing endpoints (#12771)
Vikrant Gupta3931c7163f06
diff --git a/ee/licensing/httplicensing/api.go b/ee/licensing/httplicensing/api.godeleted file mode 100644index 0050eb5985..0000000000--- a/ee/licensing/httplicensing/api.go+++ /dev/null@@ -1,85 +0,0 @@-package httplicensing--import (- "context"- "encoding/json"- "net/http"- "time"-- "github.com/SigNoz/signoz/pkg/errors"- "github.com/SigNoz/signoz/pkg/http/render"- "github.com/SigNoz/signoz/pkg/licensing"- "github.com/SigNoz/signoz/pkg/types/authtypes"- "github.com/SigNoz/signoz/pkg/types/licensetypes"- "github.com/SigNoz/signoz/pkg/valuer"-)--type licensingAPI struct {- licensing licensing.Licensing-}--func NewLicensingAPI(licensing licensing.Licensing) licensing.API {- return &licensingAPI{licensing: licensing}-}--func (api *licensingAPI) Checkout(rw http.ResponseWriter, r *http.Request) {- ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)- defer cancel()-- claims, err := authtypes.ClaimsFromContext(ctx)- if err != nil {- render.Error(rw, err)- return- }-- orgID, err := valuer.NewUUID(claims.OrgID)- if err != nil {- render.Error(rw, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "orgId is invalid"))- return- }-- req := new(licensetypes.PostableSubscription)- if err := json.NewDecoder(r.Body).Decode(req); err != nil {- render.Error(rw, err)- return- }-- gettableSubscription, err := api.licensing.Checkout(ctx, orgID, req)- if err != nil {- render.Error(rw, err)- return- }-- render.Success(rw, http.StatusCreated, gettableSubscription)-}--func (api *licensingAPI) Portal(rw http.ResponseWriter, r *http.Request) {- ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)- defer cancel()-- claims, err := authtypes.ClaimsFromContext(ctx)- if err != nil {- render.Error(rw, err)- return- }-- orgID, err := valuer.NewUUID(claims.OrgID)- if err != nil {- render.Error(rw, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "orgId is invalid"))- return- }-- req := new(licensetypes.PostableSubscription)- if err := json.NewDecoder(r.Body).Decode(req); err != nil {- render.Error(rw, err)- return- }-- gettableSubscription, err := api.licensing.Portal(ctx, orgID, req)- if err != nil {- render.Error(rw, err)- return- }-- render.Success(rw, http.StatusCreated, gettableSubscription)-}diff --git a/ee/licensing/httplicensing/provider.go b/ee/licensing/httplicensing/provider.goindex 0e9d3ec089..3cd68677ae 100644--- a/ee/licensing/httplicensing/provider.go+++ b/ee/licensing/httplicensing/provider.go@@ -2,12 +2,9 @@ package httplicensingimport ("context"- "encoding/json""log/slog""time"- "github.com/tidwall/gjson"-"github.com/SigNoz/signoz/ee/licensing/licensingstore/sqllicensingstore""github.com/SigNoz/signoz/pkg/analytics""github.com/SigNoz/signoz/pkg/errors"@@ -228,47 +225,6 @@ func (provider *provider) Refresh(ctx context.Context, organizationID valuer.UUIreturn nil}-func (provider *provider) Checkout(ctx context.Context, organizationID valuer.UUID, postableSubscription *licensetypes.PostableSubscription) (*licensetypes.GettableSubscription, error) {- activeLicense, err := provider.GetActive(ctx, organizationID)- if err != nil {- return nil, err- }-- body, err := json.Marshal(postableSubscription)- if err != nil {- return nil, errors.Wrapf(err, errors.TypeInvalidInput, errors.CodeInvalidInput, "failed to marshal checkout payload")- }-- response, err := provider.zeus.GetCheckoutURL(ctx, activeLicense.Key, body)- if err != nil {- if errors.Ast(err, errors.TypeAlreadyExists) {- return nil, errors.WithAdditionalf(err, "checkout has already been completed for this account. Please click 'Refresh Status' to sync your subscription")- }- return nil, err- }-- return &licensetypes.GettableSubscription{RedirectURL: gjson.GetBytes(response, "url").String()}, nil-}--func (provider *provider) Portal(ctx context.Context, organizationID valuer.UUID, postableSubscription *licensetypes.PostableSubscription) (*licensetypes.GettableSubscription, error) {- activeLicense, err := provider.GetActive(ctx, organizationID)- if err != nil {- return nil, err- }-- body, err := json.Marshal(postableSubscription)- if err != nil {- return nil, errors.Wrapf(err, errors.TypeInvalidInput, errors.CodeInvalidInput, "failed to marshal portal payload")- }-- response, err := provider.zeus.GetPortalURL(ctx, activeLicense.Key, body)- if err != nil {- return nil, err- }-- return &licensetypes.GettableSubscription{RedirectURL: gjson.GetBytes(response, "url").String()}, nil-}-func (provider *provider) GetFeatureFlags(ctx context.Context, organizationID valuer.UUID) ([]*licensetypes.Feature, error) {license, err := provider.GetActive(ctx, organizationID)if err != nil {diff --git a/ee/query-service/app/api/api.go b/ee/query-service/app/api/api.goindex 65d8543132..29ae93175a 100644--- a/ee/query-service/app/api/api.go+++ b/ee/query-service/app/api/api.go@@ -4,7 +4,6 @@ import ("net/http""time"- "github.com/SigNoz/signoz/ee/licensing/httplicensing""github.com/SigNoz/signoz/ee/query-service/usage""github.com/SigNoz/signoz/pkg/global""github.com/SigNoz/signoz/pkg/http/middleware"@@ -42,7 +41,6 @@ func NewAPIHandler(opts APIHandlerOptions, signoz *signoz.SigNoz, config signoz.IntegrationsController: opts.IntegrationsController,LogsParsingPipelineController: opts.LogsParsingPipelineController,FluxInterval: opts.FluxInterval,- LicensingAPI: httplicensing.NewLicensingAPI(signoz.Licensing),Signoz: signoz,QueryParserAPI: queryparser.NewAPI(signoz.Instrumentation.ToProviderSettings(), signoz.QueryParser),}, config)@@ -72,10 +70,6 @@ func (ah *APIHandler) RegisterRoutes(router *mux.Router, am *middleware.AuthZ) {// base overridesrouter.HandleFunc("/api/v1/version", am.OpenAccess(ah.getVersion)).Methods(http.MethodGet)- router.HandleFunc("/api/v1/checkout", am.AdminAccess(ah.LicensingAPI.Checkout)).Methods(http.MethodPost)- router.HandleFunc("/api/v1/billing", am.AdminAccess(ah.getBilling)).Methods(http.MethodGet)- router.HandleFunc("/api/v1/portal", am.AdminAccess(ah.LicensingAPI.Portal)).Methods(http.MethodPost)-// v4router.HandleFunc("/api/v4/query_range", am.ViewAccess(ah.queryRangeV4)).Methods(http.MethodPost)diff --git a/ee/query-service/app/api/license.go b/ee/query-service/app/api/license.godeleted file mode 100644index 50c657d0aa..0000000000--- a/ee/query-service/app/api/license.go+++ /dev/null@@ -1,76 +0,0 @@-package api--import (- "encoding/json"- "fmt"- "net/http"-- "github.com/SigNoz/signoz/ee/query-service/model"-)--type DayWiseBreakdown struct {- Type string `json:"type"`- Breakdown []DayWiseData `json:"breakdown"`-}--type DayWiseData struct {- Timestamp int64 `json:"timestamp"`- Count float64 `json:"count"`- Size float64 `json:"size"`- UnitPrice float64 `json:"unitPrice"`- Quantity float64 `json:"quantity"`- Total float64 `json:"total"`-}--type tierBreakdown struct {- UnitPrice float64 `json:"unitPrice"`- Quantity float64 `json:"quantity"`- TierStart int64 `json:"tierStart"`- TierEnd int64 `json:"tierEnd"`- TierCost float64 `json:"tierCost"`-}--type usageResponse struct {- Type string `json:"type"`- Unit string `json:"unit"`- Tiers []tierBreakdown `json:"tiers"`- DayWiseBreakdown DayWiseBreakdown `json:"dayWiseBreakdown"`-}--type details struct {- Total float64 `json:"total"`- Breakdown []usageResponse `json:"breakdown"`- BaseFee float64 `json:"baseFee"`- BillTotal float64 `json:"billTotal"`-}--type billingData struct {- BillingPeriodStart int64 `json:"billingPeriodStart"`- BillingPeriodEnd int64 `json:"billingPeriodEnd"`- Details details `json:"details"`- Discount float64 `json:"discount"`- SubscriptionStatus string `json:"subscriptionStatus"`-}--func (ah *APIHandler) getBilling(w http.ResponseWriter, r *http.Request) {- licenseKey := r.URL.Query().Get("licenseKey")-- if licenseKey == "" {- RespondError(w, model.BadRequest(fmt.Errorf("license key is required")), nil)- return- }-- data, err := ah.Signoz.Zeus.GetMeters(r.Context(), licenseKey)- if err != nil {- RespondError(w, model.InternalError(err), nil)- return- }-- var billing billingData- if err := json.Unmarshal(data, &billing); err != nil {- RespondError(w, model.InternalError(err), nil)- return- }-- ah.Respond(w, billing)-}diff --git a/pkg/licensing/licensing.go b/pkg/licensing/licensing.goindex b1834f0156..e5c9eef2cb 100644--- a/pkg/licensing/licensing.go+++ b/pkg/licensing/licensing.go@@ -33,21 +33,12 @@ type Licensing interface {Delete(ctx context.Context, organizationID valuer.UUID, licenseID valuer.UUID) error// Refresh refreshes the license state from upstream serverRefresh(ctx context.Context, organizationID valuer.UUID) error- // Checkout creates a checkout session via upstream server and returns the redirection link- Checkout(ctx context.Context, organizationID valuer.UUID, postableSubscription *licensetypes.PostableSubscription) (*licensetypes.GettableSubscription, error)- // Portal creates a portal session via upstream server and return the redirection link- Portal(ctx context.Context, organizationID valuer.UUID, postableSubscription *licensetypes.PostableSubscription) (*licensetypes.GettableSubscription, error)// GetFeatureFlags fetches all the defined feature flagsGetFeatureFlags(ctx context.Context, organizationID valuer.UUID) ([]*licensetypes.Feature, error)statsreporter.StatsCollector}-type API interface {- Checkout(http.ResponseWriter, *http.Request)- Portal(http.ResponseWriter, *http.Request)-}-type Handler interface {Create(http.ResponseWriter, *http.Request)diff --git a/pkg/licensing/nooplicensing/api.go b/pkg/licensing/nooplicensing/api.godeleted file mode 100644index c49a073b64..0000000000--- a/pkg/licensing/nooplicensing/api.go+++ /dev/null@@ -1,23 +0,0 @@-package nooplicensing--import (- "net/http"-- "github.com/SigNoz/signoz/pkg/errors"- "github.com/SigNoz/signoz/pkg/http/render"- "github.com/SigNoz/signoz/pkg/licensing"-)--type noopLicensingAPI struct{}--func NewLicenseAPI() licensing.API {- return &noopLicensingAPI{}-}--func (api *noopLicensingAPI) Checkout(rw http.ResponseWriter, r *http.Request) {- render.Error(rw, errors.New(errors.TypeUnsupported, licensing.ErrCodeUnsupported, "not implemented"))-}--func (api *noopLicensingAPI) Portal(rw http.ResponseWriter, r *http.Request) {- render.Error(rw, errors.New(errors.TypeUnsupported, licensing.ErrCodeUnsupported, "not implemented"))-}diff --git a/pkg/licensing/nooplicensing/provider.go b/pkg/licensing/nooplicensing/provider.goindex 7662725514..0cf6b173cb 100644--- a/pkg/licensing/nooplicensing/provider.go+++ b/pkg/licensing/nooplicensing/provider.go@@ -59,14 +59,6 @@ func (provider *noopLicensing) Refresh(ctx context.Context, organizationID valuereturn errors.New(errors.TypeUnsupported, licensing.ErrCodeUnsupported, "refreshing license is not supported")}-func (provider *noopLicensing) Checkout(ctx context.Context, organizationID valuer.UUID, postableSubscription *licensetypes.PostableSubscription) (*licensetypes.GettableSubscription, error) {- return nil, errors.New(errors.TypeUnsupported, licensing.ErrCodeUnsupported, "checkout session is not supported")-}--func (provider *noopLicensing) Portal(ctx context.Context, organizationID valuer.UUID, postableSubscription *licensetypes.PostableSubscription) (*licensetypes.GettableSubscription, error) {- return nil, errors.New(errors.TypeUnsupported, licensing.ErrCodeUnsupported, "portal session is not supported")-}-func (provider *noopLicensing) GetActive(ctx context.Context, organizationID valuer.UUID) (*licensetypes.License, error) {return nil, errors.New(errors.TypeUnsupported, licensing.ErrCodeUnsupported, "fetching active license is not supported")}diff --git a/pkg/query-service/app/http_handler.go b/pkg/query-service/app/http_handler.goindex 1f492a0acf..018fa1ac23 100644--- a/pkg/query-service/app/http_handler.go+++ b/pkg/query-service/app/http_handler.go@@ -30,7 +30,6 @@ import ("github.com/SigNoz/signoz/pkg/http/middleware""github.com/SigNoz/signoz/pkg/http/render"- "github.com/SigNoz/signoz/pkg/licensing""github.com/SigNoz/signoz/pkg/query-service/app/integrations""github.com/SigNoz/signoz/pkg/signoz""github.com/SigNoz/signoz/pkg/types/retentiontypes"@@ -119,8 +118,6 @@ type APIHandler struct {// Websocket connection upgraderUpgrader *websocket.Upgrader- LicensingAPI licensing.API-QueryParserAPI *queryparser.APISignoz *signoz.SigNoz@@ -139,8 +136,6 @@ type APIHandlerOpts struct {// Flux IntervalFluxInterval time.Duration- LicensingAPI licensing.API-QueryParserAPI *queryparser.APISignoz *signoz.SigNoz@@ -176,7 +171,6 @@ func NewAPIHandler(opts APIHandlerOpts, config signoz.Config) (*APIHandler, erroLogsParsingPipelineController: opts.LogsParsingPipelineController,querier: querier,querierV2: querierv2,- LicensingAPI: opts.LicensingAPI,Signoz: opts.Signoz,QueryParserAPI: opts.QueryParserAPI,}diff --git a/pkg/query-service/app/server.go b/pkg/query-service/app/server.goindex 02c97c417e..3b274f0f11 100644--- a/pkg/query-service/app/server.go+++ b/pkg/query-service/app/server.go@@ -16,7 +16,6 @@ import ("github.com/soheilhy/cmux""github.com/SigNoz/signoz/pkg/http/middleware"- "github.com/SigNoz/signoz/pkg/licensing/nooplicensing""github.com/SigNoz/signoz/pkg/query-service/agentConf""github.com/SigNoz/signoz/pkg/query-service/app/clickhouseReader""github.com/SigNoz/signoz/pkg/query-service/app/integrations"@@ -84,7 +83,6 @@ func NewServer(config signoz.Config, signoz *signoz.SigNoz) (*Server, error) {IntegrationsController: integrationsController,LogsParsingPipelineController: logParsingPipelineController,FluxInterval: config.Querier.FluxInterval,- LicensingAPI: nooplicensing.NewLicenseAPI(),Signoz: signoz,QueryParserAPI: queryparser.NewAPI(signoz.Instrumentation.ToProviderSettings(), signoz.QueryParser),}, config)diff --git a/pkg/types/licensetypes/subscription.go b/pkg/types/licensetypes/subscription.godeleted file mode 100644index 9065a8a465..0000000000--- a/pkg/types/licensetypes/subscription.go+++ /dev/null@@ -1,33 +0,0 @@-package licensetypes--import (- "encoding/json"-- "github.com/SigNoz/signoz/pkg/errors"-)--type GettableSubscription struct {- RedirectURL string `json:"redirectURL"`-}--type PostableSubscription struct {- SuccessURL string `json:"url"`-}--func (p *PostableSubscription) UnmarshalJSON(data []byte) error {- var postableSubscription struct {- SuccessURL string `json:"url"`- }-- err := json.Unmarshal(data, &postableSubscription)- if err != nil {- return errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "failed to unmarshal payload")- }-- if postableSubscription.SuccessURL == "" {- return errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "success url cannot be empty")- }-- p.SuccessURL = postableSubscription.SuccessURL- return nil-}diff --git a/tests/integration/tests/passwordauthn/02_license.py b/tests/integration/tests/passwordauthn/02_license.pyindex 8617bbd523..272e57de72 100644--- a/tests/integration/tests/passwordauthn/02_license.py+++ b/tests/integration/tests/passwordauthn/02_license.py@@ -185,7 +185,7 @@ def test_license_checkout(access_token = get_token("[email protected]", "password123Z$")response = requests.post(- url=signoz.self.host_configs["8080"].get("/api/v1/checkout"),+ url=signoz.self.host_configs["8080"].get("/api/v1/subscriptions"),json={"url": "https://integration-signoz.com"},headers={"Authorization": "Bearer " + access_token},timeout=5,@@ -231,14 +231,14 @@ def test_license_portal(access_token = get_token("[email protected]", "password123Z$")- response = requests.post(- url=signoz.self.host_configs["8080"].get("/api/v1/portal"),+ response = requests.put(+ url=signoz.self.host_configs["8080"].get("/api/v1/subscriptions"),json={"url": "https://integration-signoz.com"},headers={"Authorization": "Bearer " + access_token},timeout=5,)- assert response.status_code == http.HTTPStatus.CREATED+ assert response.status_code == http.HTTPStatus.OKassert response.json()["data"]["redirectURL"] == "https://signoz.portal.com"response = requests.post(