sentry

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginID         string = "grafana-sentry-datasource"
	DefaultSentryURL string = "https://sentry.io"
)

Variables

This section is empty.

Functions

func FormatSentryInterval added in v1.7.0

func FormatSentryInterval(interval time.Duration) string

Types

type GetEventsInput added in v1.4.0

type GetEventsInput struct {
	OrganizationSlug string
	ProjectIds       []string
	Environments     []string
	Query            string
	From             time.Time
	To               time.Time
	Sort             string
	Limit            int64
}

func (*GetEventsInput) ToQuery added in v1.4.0

func (gei *GetEventsInput) ToQuery() string

type GetEventsStatsInput added in v1.7.0

type GetEventsStatsInput struct {
	OrganizationSlug string
	ProjectIds       []string
	Environments     []string
	Fields           []string
	YAxis            []string
	Query            string
	From             time.Time
	To               time.Time
	Sort             string
	Interval         time.Duration
	Limit            int64
}

func (*GetEventsStatsInput) ToQuery added in v1.7.0

func (gei *GetEventsStatsInput) ToQuery() string

type GetIssuesInput

type GetIssuesInput struct {
	OrganizationSlug string
	ProjectIds       []string
	Environments     []string
	Query            string
	From             time.Time
	To               time.Time
	Sort             string
	Limit            int64
}

func (*GetIssuesInput) ToQuery

func (gii *GetIssuesInput) ToQuery() string

type GetMetricsInput added in v1.8.0

type GetMetricsInput struct {
	OrganizationSlug string
	ProjectIds       []string
	Environments     []string
	From             time.Time
	To               time.Time
	Interval         time.Duration
	Field            string
	Query            string
	GroupBy          string
	Sort             string
	Order            string
	Limit            int64
}

func (*GetMetricsInput) ToQuery added in v1.8.0

func (args *GetMetricsInput) ToQuery() string

type GetStatsV2Input

type GetStatsV2Input struct {
	OrganizationSlug string
	From             time.Time
	To               time.Time
	Interval         string
	Category         []string
	Fields           []string
	GroupBy          []string
	ProjectIds       []string
	Outcome          []string
	Reason           []string
}

func (*GetStatsV2Input) ToQuery

func (args *GetStatsV2Input) ToQuery() string

type HTTPClient

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

HTTP creates an HTTP client with a 'Do' method. It automatically injects the provided api token into every request with an `Authorization: Bearer AuthToken` header

func NewHTTPClient

func NewHTTPClient(d doer, pluginId string, b build.InfoGetterFunc, authToken string) HTTPClient

NewHTTPClient creates a new AuthHTTP client

func (HTTPClient) Do

func (a HTTPClient) Do(req *http.Request) (*http.Response, error)

Do attaches the sentry authentication header and the User-Agent header to the request and passes it to the injected http Doer

type MetricsResponse added in v1.8.0

type MetricsResponse struct {
	Start     time.Time   `json:"start"`
	End       time.Time   `json:"end"`
	Intervals []time.Time `json:"intervals"`
	Groups    []struct {
		By     map[string]interface{} `json:"by"`
		Totals map[string]interface{} `json:"totals"`
		Series map[string]interface{} `json:"series"`
	} `json:"groups"`
}

type SentryClient

type SentryClient struct {
	BaseURL string
	OrgSlug string
	// contains filtered or unexported fields
}

func NewSentryClient

func NewSentryClient(baseURL string, orgSlug string, authToken string, doerClient doer) (*SentryClient, error)

func (*SentryClient) Fetch

func (sc *SentryClient) Fetch(path string, out interface{}) error

func (*SentryClient) FetchWithPagination added in v1.4.0

func (sc *SentryClient) FetchWithPagination(path string, out interface{}) (string, error)

func (*SentryClient) GetEvents added in v1.4.0

func (sc *SentryClient) GetEvents(gei GetEventsInput) ([]SentryEvent, string, error)

func (*SentryClient) GetEventsStats added in v1.7.0

func (sc *SentryClient) GetEventsStats(gei GetEventsStatsInput) (SentryEventsStats, string, error)

func (*SentryClient) GetIssues

func (sc *SentryClient) GetIssues(gii GetIssuesInput) ([]SentryIssue, string, error)

func (*SentryClient) GetMetrics added in v1.8.0

func (sc *SentryClient) GetMetrics(args GetMetricsInput) (MetricsResponse, string, error)

func (*SentryClient) GetOrganizations

func (sc *SentryClient) GetOrganizations() ([]SentryOrganization, error)

func (*SentryClient) GetProjects

func (sc *SentryClient) GetProjects(organizationSlug string, withPagination bool) ([]SentryProject, error)

func (*SentryClient) GetStatsV2

func (sc *SentryClient) GetStatsV2(args GetStatsV2Input) (StatsV2Response, string, error)

func (*SentryClient) GetTeamsProjects added in v1.1.0

func (sc *SentryClient) GetTeamsProjects(organizationSlug string, teamSlug string) ([]SentryProject, error)

func (*SentryClient) ListOrganizationTeams added in v1.1.0

func (sc *SentryClient) ListOrganizationTeams(organizationSlug string, withPagination bool) ([]SentryTeam, error)

type SentryErrorResponse

type SentryErrorResponse struct {
	Detail string `json:"detail"`
}

type SentryEvent added in v1.4.0

type SentryEvent struct {
	ID              string    `json:"id"`
	Title           string    `json:"title"`
	Project         string    `json:"project"`
	ProjectId       int64     `json:"project.id"`
	Release         string    `json:"release"`
	Count           int64     `json:"count()"`
	EventsPerMinute float64   `json:"epm()"`
	LastSeen        time.Time `json:"last_seen()"`
	Level           string    `json:"level"`
	EventType       string    `json:"event.type"`
	Platform        string    `json:"platform"`
}

type SentryEvents added in v1.4.0

type SentryEvents struct {
	Data []SentryEvent          `json:"data"`
	Meta map[string]interface{} `json:"meta"`
}

type SentryEventsStats added in v1.7.0

type SentryEventsStats = map[string]interface{}

type SentryIssue

type SentryIssue struct {
	ID          string    `json:"id"`
	ShortID     string    `json:"shortId"`
	Title       string    `json:"title"`
	Count       string    `json:"count"`
	UserCount   int64     `json:"userCount"`
	Status      string    `json:"status"`
	Substatus   string    `json:"substatus"`
	Level       string    `json:"level"`
	Type        string    `json:"type"`
	Platform    string    `json:"platform"`
	FirstSeen   time.Time `json:"firstSeen"`
	LastSeen    time.Time `json:"lastSeen"`
	Culprit     string    `json:"culprit"`
	HasSeen     bool      `json:"hasSeen"`
	IsUnhandled bool      `json:"isUnhandled"`
	Permalink   string    `json:"permalink"`
	IsPublic    bool      `json:"isPublic"`
	Project     struct {
		ID       string `json:"id"`
		Name     string `json:"name"`
		Slug     string `json:"slug"`
		Platform string `json:"platform"`
	} `json:"project"`
	Metadata struct {
		Value    string `json:"value"`
		Type     string `json:"type"`
		Filename string `json:"filename"`
		Function string `json:"function"`
	} `json:"metadata"`
	NumComments int64 `json:"numComments"`
	AssignedTo  struct {
		Email string `json:"email"`
		Type  string `json:"type"`
		ID    string `json:"id"`
		Name  string `json:"name"`
	} `json:"assignedTo"`
	IsBookmarked        bool `json:"isBookmarked"`
	IsSubscribed        bool `json:"isSubscribed"`
	SubscriptionDetails struct {
		Reason string `json:"reason"`
	} `json:"subscriptionDetails"`
}

type SentryOrganization

type SentryOrganization struct {
	DateCreated    time.Time `json:"dateCreated"`
	ID             string    `json:"id"`
	IsEarlyAdopter bool      `json:"isEarlyAdopter"`
	Name           string    `json:"name"`
	Require2FA     bool      `json:"require2FA"`
	Slug           string    `json:"slug"`
	Status         struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"status"`
	Avatar struct {
		AvatarType string `json:"avatarType"`
	} `json:"avatar"`
}

type SentryProject

type SentryProject struct {
	DateCreated  time.Time `json:"dateCreated"`
	HasAccess    bool      `json:"hasAccess"`
	ID           string    `json:"id"`
	IsBookmarked bool      `json:"isBookmarked"`
	IsMember     bool      `json:"isMember"`
	Environments []string  `json:"environments"`
	Name         string    `json:"name"`
	Slug         string    `json:"slug"`
	Team         struct {
		ID   string `json:"id"`
		Name string `json:"name"`
		Slug string `json:"slug"`
	} `json:"team"`
	Teams []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
		Slug string `json:"slug"`
	} `json:"teams"`
}

type SentryTeam added in v1.1.0

type SentryTeam struct {
	Avatar struct {
		AvatarType string      `json:"avatarType"`
		AvatarUUID interface{} `json:"avatarUuid"`
	} `json:"avatar"`
	DateCreated time.Time     `json:"dateCreated"`
	HasAccess   bool          `json:"hasAccess"`
	ID          string        `json:"id"`
	IsMember    bool          `json:"isMember"`
	IsPending   bool          `json:"isPending"`
	MemberCount int           `json:"memberCount"`
	Name        string        `json:"name"`
	Projects    []interface{} `json:"projects"`
	Slug        string        `json:"slug"`
}

type StatsV2Response

type StatsV2Response struct {
	Start     time.Time   `json:"start"`
	End       time.Time   `json:"end"`
	Intervals []time.Time `json:"intervals"`
	Groups    []struct {
		By struct {
			Reason   string `json:"reason"`
			Category string `json:"category"`
			Outcome  string `json:"outcome"`
		} `json:"by"`
		Totals struct {
			SumTimesSeen int64 `json:"sum(times_seen)"`
			SumQuantity  int64 `json:"sum(quantity)"`
		} `json:"totals"`
		Series struct {
			SumTimesSeen []int64 `json:"sum(times_seen)"`
			SumQuantity  []int64 `json:"sum(quantity)"`
		} `json:"series"`
	} `json:"groups"`
}

Jump to

Keyboard shortcuts

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