Plugins: Migrate Elasticsearch to backend plugin SDK (#36132)
* Migrate Elasticsearch to backend plugin SDK * Fix linting * Move away from Convey! * Rebase commit * Small logger fix * Fixes according to reviewer's comments * Fixes according to reviewer's comments * Fixes according to reviewer's comments * More cleanup * Move things around - small refactoring * Fix typo * Update calculator - add tests * Fixes according to reviewer's comments
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -19,7 +19,7 @@ const (
|
||||
)
|
||||
|
||||
type indexPattern interface {
|
||||
GetIndices(timeRange plugins.DataTimeRange) ([]string, error)
|
||||
GetIndices(timeRange backend.TimeRange) ([]string, error)
|
||||
}
|
||||
|
||||
var newIndexPattern = func(interval string, pattern string) (indexPattern, error) {
|
||||
@@ -34,7 +34,7 @@ type staticIndexPattern struct {
|
||||
indexName string
|
||||
}
|
||||
|
||||
func (ip *staticIndexPattern) GetIndices(timeRange plugins.DataTimeRange) ([]string, error) {
|
||||
func (ip *staticIndexPattern) GetIndices(timeRange backend.TimeRange) ([]string, error) {
|
||||
return []string{ip.indexName}, nil
|
||||
}
|
||||
|
||||
@@ -73,9 +73,9 @@ func newDynamicIndexPattern(interval, pattern string) (*dynamicIndexPattern, err
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ip *dynamicIndexPattern) GetIndices(timeRange plugins.DataTimeRange) ([]string, error) {
|
||||
from := timeRange.GetFromAsTimeUTC()
|
||||
to := timeRange.GetToAsTimeUTC()
|
||||
func (ip *dynamicIndexPattern) GetIndices(timeRange backend.TimeRange) ([]string, error) {
|
||||
from := timeRange.From.UTC()
|
||||
to := timeRange.To.UTC()
|
||||
intervals := ip.intervalGenerator.Generate(from, to)
|
||||
indices := make([]string, 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user