live

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConvertDryRunRequest

type ConvertDryRunRequest struct {
	ChannelRules []pipeline.ChannelRule `json:"channelRules"`
	Channel      string                 `json:"channel"`
	Data         string                 `json:"data"`
}

type ConvertDryRunResponse

type ConvertDryRunResponse struct {
	ChannelFrames []*pipeline.ChannelFrame `json:"channelFrames"`
}

type CoreGrafanaScope

type CoreGrafanaScope struct {
	Features map[string]model.ChannelHandlerFactory

	// The generic service to advertise dashboard changes
	Dashboards DashboardActivityChannel
}

CoreGrafanaScope list of core features

type DashboardActivityChannel

type DashboardActivityChannel interface {
	// Called when a dashboard is saved -- this includes the error so we can support a
	// gitops workflow that knows if the value was saved to the local database or not
	// in many cases all direct save requests will fail, but the request should be forwarded
	// to any gitops observers
	DashboardSaved(orgID int64, requester identity.Requester, message string, dashboard *dashboards.Dashboard, err error) error

	// Called when a dashboard is deleted
	DashboardDeleted(orgID int64, requester identity.Requester, uid string) error

	// Experimental! Indicate is GitOps is active.  This really means
	// someone is subscribed to the `grafana/dashboards/gitops` channel
	HasGitOpsObserver(orgID int64) bool
}

DashboardActivityChannel is a service to advertise dashboard activity

type DryRunRuleStorage

type DryRunRuleStorage struct {
	ChannelRules []pipeline.ChannelRule
}

func (*DryRunRuleStorage) CreateChannelRule

func (*DryRunRuleStorage) CreateWriteConfig

func (*DryRunRuleStorage) DeleteChannelRule

func (*DryRunRuleStorage) DeleteWriteConfig

func (*DryRunRuleStorage) GetWriteConfig

func (*DryRunRuleStorage) ListChannelRules

func (s *DryRunRuleStorage) ListChannelRules(_ context.Context, _ int64) ([]pipeline.ChannelRule, error)

func (*DryRunRuleStorage) ListWriteConfigs

func (s *DryRunRuleStorage) ListWriteConfigs(_ context.Context, _ int64) ([]pipeline.WriteConfig, error)

func (*DryRunRuleStorage) UpdateChannelRule

func (*DryRunRuleStorage) UpdateWriteConfig

type GrafanaLive

type GrafanaLive struct {
	PluginContextProvider *plugincontext.Provider
	Cfg                   *setting.Cfg
	Features              featuremgmt.FeatureToggles
	RouteRegister         routing.RouteRegister
	CacheService          *localcache.CacheService
	DataSourceCache       datasources.CacheService
	SQLStore              db.DB
	SecretsService        secrets.Service

	// The core internal features
	GrafanaScope CoreGrafanaScope

	ManagedStreamRunner *managedstream.Runner
	Pipeline            *pipeline.Pipeline
	// contains filtered or unexported fields
}

GrafanaLive manages live real-time connections to Grafana (over WebSocket at this moment). The main concept here is Channel. Connections can subscribe to many channels. Each channel can have different permissions and properties but once a connection subscribed to a channel it starts receiving all messages published into this channel. Thus GrafanaLive is a PUB/SUB server.

func ProvideService

func ProvideService(plugCtxProvider *plugincontext.Provider, cfg *setting.Cfg, routeRegister routing.RouteRegister,
	pluginStore pluginstore.Store, pluginClient plugins.Client, cacheService *localcache.CacheService,
	dataSourceCache datasources.CacheService, sqlStore db.DB, secretsService secrets.Service,
	usageStatsService usagestats.Service, queryDataService query.Service, toggles featuremgmt.FeatureToggles,
	accessControl accesscontrol.AccessControl, dashboardService dashboards.DashboardService, annotationsRepo annotations.Repository,
	orgService org.Service) (*GrafanaLive, error)

func (*GrafanaLive) ClientCount

func (g *GrafanaLive) ClientCount(orgID int64, channel string) (int, error)

ClientCount returns the number of clients.

func (*GrafanaLive) GetChannelHandler

func (g *GrafanaLive) GetChannelHandler(ctx context.Context, user identity.Requester, channel string) (model.ChannelHandler, live.Channel, error)

GetChannelHandler gives thread-safe access to the channel.

func (*GrafanaLive) GetChannelHandlerFactory

func (g *GrafanaLive) GetChannelHandlerFactory(ctx context.Context, user identity.Requester, scope string, namespace string) (model.ChannelHandlerFactory, error)

GetChannelHandlerFactory gets a ChannelHandlerFactory for a namespace. It gives thread-safe access to the channel.

func (*GrafanaLive) HandleChannelRulesDeleteHTTP

func (g *GrafanaLive) HandleChannelRulesDeleteHTTP(c *contextmodel.ReqContext) response.Response

HandleChannelRulesDeleteHTTP ...

func (*GrafanaLive) HandleChannelRulesListHTTP

func (g *GrafanaLive) HandleChannelRulesListHTTP(c *contextmodel.ReqContext) response.Response

HandleChannelRulesListHTTP ...

func (*GrafanaLive) HandleChannelRulesPostHTTP

func (g *GrafanaLive) HandleChannelRulesPostHTTP(c *contextmodel.ReqContext) response.Response

HandleChannelRulesPostHTTP ...

func (*GrafanaLive) HandleChannelRulesPutHTTP

func (g *GrafanaLive) HandleChannelRulesPutHTTP(c *contextmodel.ReqContext) response.Response

HandleChannelRulesPutHTTP ...

func (*GrafanaLive) HandleDatasourceDelete

func (g *GrafanaLive) HandleDatasourceDelete(orgID int64, dsUID string)

func (*GrafanaLive) HandleDatasourceUpdate

func (g *GrafanaLive) HandleDatasourceUpdate(orgID int64, dsUID string)

func (*GrafanaLive) HandleHTTPPublish

func (g *GrafanaLive) HandleHTTPPublish(ctx *contextmodel.ReqContext) response.Response

func (*GrafanaLive) HandleInfoHTTP

func (g *GrafanaLive) HandleInfoHTTP(ctx *contextmodel.ReqContext) response.Response

HandleInfoHTTP special http response for

func (*GrafanaLive) HandleListHTTP

func (g *GrafanaLive) HandleListHTTP(c *contextmodel.ReqContext) response.Response

HandleListHTTP returns metadata so the UI can build a nice form

func (*GrafanaLive) HandlePipelineConvertTestHTTP

func (g *GrafanaLive) HandlePipelineConvertTestHTTP(c *contextmodel.ReqContext) response.Response

HandlePipelineConvertTestHTTP ...

func (*GrafanaLive) HandlePipelineEntitiesListHTTP

func (g *GrafanaLive) HandlePipelineEntitiesListHTTP(_ *contextmodel.ReqContext) response.Response

HandlePipelineEntitiesListHTTP ...

func (*GrafanaLive) HandleWriteConfigsDeleteHTTP

func (g *GrafanaLive) HandleWriteConfigsDeleteHTTP(c *contextmodel.ReqContext) response.Response

HandleWriteConfigsDeleteHTTP ...

func (*GrafanaLive) HandleWriteConfigsListHTTP

func (g *GrafanaLive) HandleWriteConfigsListHTTP(c *contextmodel.ReqContext) response.Response

HandleWriteConfigsListHTTP ...

func (*GrafanaLive) HandleWriteConfigsPostHTTP

func (g *GrafanaLive) HandleWriteConfigsPostHTTP(c *contextmodel.ReqContext) response.Response

HandleWriteConfigsPostHTTP ...

func (*GrafanaLive) HandleWriteConfigsPutHTTP

func (g *GrafanaLive) HandleWriteConfigsPutHTTP(c *contextmodel.ReqContext) response.Response

HandleWriteConfigsPutHTTP ...

func (*GrafanaLive) IsHA

func (g *GrafanaLive) IsHA() bool

func (*GrafanaLive) Publish

func (g *GrafanaLive) Publish(orgID int64, channel string, data []byte) error

Publish sends the data to the channel without checking permissions etc.

func (*GrafanaLive) Run

func (g *GrafanaLive) Run(ctx context.Context) error

Directories

Path Synopsis
Package features is a generated GoMock package.
Package features is a generated GoMock package.
Package pipeline is a generated GoMock package.
Package pipeline is a generated GoMock package.
Package runstream is a generated GoMock package.
Package runstream is a generated GoMock package.

Jump to

Keyboard shortcuts

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