datasource_plugin.go 622 B

123456789101112131415161718192021222324252627
  1. package plugins
  2. import "encoding/json"
  3. type DataSourcePlugin struct {
  4. FrontendPluginBase
  5. Annotations bool `json:"annotations"`
  6. Metrics bool `json:"metrics"`
  7. Alerting bool `json:"alerting"`
  8. BuiltIn bool `json:"builtIn"`
  9. Mixed bool `json:"mixed"`
  10. AlwaysDisplay bool `json:"alwaysDisplay"`
  11. App string `json:"app"`
  12. }
  13. func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error {
  14. if err := decoder.Decode(&p); err != nil {
  15. return err
  16. }
  17. if err := p.registerPlugin(pluginDir); err != nil {
  18. return err
  19. }
  20. DataSources[p.Id] = p
  21. return nil
  22. }