signoz

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package signoz is a api client for signoz, more specifically the trace API https://signoz.io/docs/traces-management/trace-api/overview/ the client is based on resty.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*UnauthenticatedClient
	// contains filtered or unexported fields
}

Client is a signoz client.

func NewClientFromUser

func NewClientFromUser(handler metrics.Handler, url, email, password string) *Client

NewClientFromUser creates a new signoz client from a user.

func (*Client) SearchTraces

func (c *Client) SearchTraces(ctx context.Context, timePeriod TimePreferenceType, searchTerms map[string]string) (*QueryRangeResponse, error)

SearchTraces searches for traces.

func (*Client) Services

func (c *Client) Services(ctx context.Context, timePeriod TimePreferenceType) (res []ServiceResponse, err error)

Services gets services.

type LoginResponse

type LoginResponse struct {
	// UserID is the user ID.
	UserID string `json:"userId"`
	// AccessJWT is the access JWT.
	AccessJwt string `json:"accessJwt"`
	// AccessJWTExpiry is the access JWT expiry.
	AccessJwtExpiry int `json:"accessJwtExpiry"`
	// RefreshJWT is the refresh JWT.
	RefreshJwt string `json:"refreshJwt"`
	// RefreshJWTExpiry is the refresh JWT expiry.
	RefreshJwtExpiry int `json:"refreshJwtExpiry"`
}

LoginResponse is the response from the login endpoint.

type QueryRangeResponse

type QueryRangeResponse struct {
	Status string                 `json:"status"`
	Data   *v3.QueryRangeResponse `json:"data"`
}

QueryRangeResponse is a response to a query range.

type ServiceRequest

type ServiceRequest struct {
	Start string        `json:"start"`
	End   string        `json:"end"`
	Tags  []interface{} `json:"tags"`
}

ServiceRequest is a request to get services.

type ServiceResponse

type ServiceResponse struct {
	ServiceName string  `json:"serviceName"`
	P99         float64 `json:"p99"`
	AvgDuration float64 `json:"avgDuration"`
	NumCalls    int     `json:"numCalls"`
	CallRate    float64 `json:"callRate"`
	NumErrors   int     `json:"numErrors"`
	ErrorRate   float64 `json:"errorRate"`
	Num4XX      float64 `json:"num4XX"`
	FourXXRate  float64 `json:"fourXXRate"`
}

ServiceResponse is a signoz service.

type StartEnd

type StartEnd struct {
	Start string
	End   string
}

StartEnd is the start and end time.

func GetStartAndEndTime

func GetStartAndEndTime(preference TimePreferenceType) StartEnd

GetStartAndEndTime returns the start and end time. nolint: cyclop

type StartEndInt

type StartEndInt struct {
	Start int64
	End   int64
}

StartEndInt is the start and end time.

func GetStartAndEndTimeInt

func GetStartAndEndTimeInt(preference TimePreferenceType) (StartEndInt, error)

GetStartAndEndTimeInt returns the start and end time as integers.

type TimePreferenceType

type TimePreferenceType string

TimePreferenceType is the type of time preference.

const (
	// Last5Min is the last 5 minutes.
	Last5Min TimePreferenceType = "LAST_5_MIN"
	// Last30Min is the last 30 minutes.
	Last30Min TimePreferenceType = "LAST_30_MIN"
	// Last1Hr is the last 1 hour.
	Last1Hr TimePreferenceType = "LAST_1_HR"
	// Last3Hr is the last 3 hour.
	Last3Hr TimePreferenceType = "LAST_3_HR"
	// Last15Min is the last 15 minutes.
	Last15Min TimePreferenceType = "LAST_15_MIN"
	// Last6Hr is the last 6 hours.
	Last6Hr TimePreferenceType = "LAST_6_HR"
	// Last1Day is the last 1 day.
	Last1Day TimePreferenceType = "LAST_1_DAY"
	// Last3Days is the last 3 days.
	Last3Days TimePreferenceType = "LAST_3_DAYS"
	// Last1Week is the last 1 week.
	Last1Week TimePreferenceType = "LAST_1_WEEK"
)

type UnauthenticatedClient

type UnauthenticatedClient struct {
	// contains filtered or unexported fields
}

UnauthenticatedClient is an unauthenticated client.

func NewUnauthenticatedClient

func NewUnauthenticatedClient(handler metrics.Handler, url string) *UnauthenticatedClient

NewUnauthenticatedClient creates a new unauthenticated client.

func (*UnauthenticatedClient) Login

func (c *UnauthenticatedClient) Login(ctx context.Context, email, password string) (_ *LoginResponse, err error)

Login logs in a user.

Directories

Path Synopsis
keychain
Package keychain wraps go-keychain.
Package keychain wraps go-keychain.
Package model contains the data models for the Signoz API.
Package model contains the data models for the Signoz API.
v3

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL