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.

1023 B
Raw Blame
package thirdpartyapitypes

import (
	"github.com/SigNoz/signoz/pkg/errors"
	qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5"
)

type ThirdPartyApiRequest struct {
	Start    uint64               `json:"start"`
	End      uint64               `json:"end"`
	ShowIp   bool                 `json:"show_ip,omitempty"`
	Domain   string               `json:"domain,omitempty"`
	Endpoint string               `json:"endpoint,omitempty"`
	Filter   *qbtypes.Filter      `json:"filter,omitempty"`
	GroupBy  []qbtypes.GroupByKey `json:"groupBy,omitempty"`
}

// Validate validates the ThirdPartyApiRequest.
func (req *ThirdPartyApiRequest) Validate() error {
	if req.Start >= req.End {
		return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "start time must be before end time")
	}

	if req.Filter != nil && req.Filter.Expression == "" {
		return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "filter expression cannot be empty when filter is provided")
	}

	return nil
}