mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
29 lines
531 B
Go
29 lines
531 B
Go
package validator
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana/pkg/plugins"
|
|
)
|
|
|
|
type UsageStatsValidator struct {
|
|
pluginStore plugins.Store
|
|
}
|
|
|
|
func ProvideService(pluginStore plugins.Store) (Service, error) {
|
|
s := &UsageStatsValidator{
|
|
pluginStore: pluginStore,
|
|
}
|
|
|
|
return s, nil
|
|
}
|
|
|
|
func (uss *UsageStatsValidator) ShouldBeReported(ctx context.Context, dsType string) bool {
|
|
ds, exists := uss.pluginStore.Plugin(ctx, dsType)
|
|
if !exists {
|
|
return false
|
|
}
|
|
|
|
return ds.Signature.IsValid() || ds.Signature.IsInternal()
|
|
}
|