Skip to content

Commit

Permalink
cleanup provider name usage (trickstercache#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Ranson authored Oct 13, 2020
1 parent 0ec349b commit 1c541ba
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pkg/backends/clickhouse/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var marshalers = map[byte]dataset.Marshaler{
5: marshalTimeseriesTSVWithNamesAndTypes,
}

// NewModeler returns a collection of modeling functions for influxdb interoperability
// NewModeler returns a collection of modeling functions for clickhouse interoperability
func NewModeler() *timeseries.Modeler {
return &timeseries.Modeler{
WireUnmarshalerReader: UnmarshalTimeseriesReader,
Expand Down
7 changes: 3 additions & 4 deletions pkg/backends/irondb/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (dp *DataPoint) UnmarshalJSON(b []byte) error {
// DataPoints values represent sortable slices of data point values.
type DataPoints []DataPoint

// Len returns the length of an array of Prometheus model.Times
// Len returns the number of elements in the subject slice
func (dps DataPoints) Len() int {
return len(dps)
}
Expand All @@ -172,8 +172,7 @@ func (dps DataPoints) Less(i, j int) bool {
return dps[i].Time.Before(dps[j].Time)
}

// Swap modifies a slice of data tuples by swapping the values in indexes
// i and j.
// Swap modifies the subject slice by swapping the values in indexes i and j
func (dps DataPoints) Swap(i, j int) {
dps[i], dps[j] = dps[j], dps[i]
}
Expand Down Expand Up @@ -346,7 +345,7 @@ func (se *SeriesEnvelope) Sort() {
sort.Sort(se.Data)
}

// NewModeler returns a collection of modeling functions for influxdb interoperability
// NewModeler returns a collection of modeling functions for irondb interoperability
func NewModeler() *timeseries.Modeler {
return &timeseries.Modeler{
WireUnmarshalerReader: UnmarshalTimeseriesReader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package types
package providers

import "strconv"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package types
package providers

import (
"strconv"
Expand Down
4 changes: 2 additions & 2 deletions pkg/cache/index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func (idx *Index) reap(logger interface{}) {
}
}

// Len returns the length of an array of Prometheus model.Times
// Len returns the number of elements in the subject slice
func (o objectsAtime) Len() int {
return len(o)
}
Expand All @@ -402,7 +402,7 @@ func (o objectsAtime) Less(i, j int) bool {
return o[i].LastAccess.Before(o[j].LastAccess)
}

// Swap modifies an array by of Prometheus model.Times swapping the values in indexes i and j
// Swap modifies the subject slice by swapping the values in indexes i and j
func (o objectsAtime) Swap(i, j int) {
o[i], o[j] = o[j], o[i]
}
2 changes: 1 addition & 1 deletion pkg/config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func parseFlags(applicationName string, arguments []string) (*Flags, error) {
flagSet.StringVar(&flags.Origin, cfOrigin, "",
"URL to the Origin. Enter it like you would in grafana, e.g., http://prometheus:9090")
flagSet.StringVar(&flags.Provider, cfProvider, "",
"Type of origin (prometheus, influxdb)")
"Name of the backend provider (prometheus, influxdb, clickhouse, rpc, etc.)")
flagSet.IntVar(&flags.ProxyListenPort, cfProxyPort, 0,
"Port that the primary Proxy server will listen on")
flagSet.IntVar(&flags.MetricsListenPort, cfMetricsPort, 0,
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/engines/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"github.com/tricksterproxy/trickster/pkg/util/md5"
)

// DeriveCacheKey calculates a query-specific keyname based on the prometheus query in the user request
// DeriveCacheKey calculates a query-specific keyname based on the user request
func (pr *proxyRequest) DeriveCacheKey(templateURL *url.URL, extra string) string {

rsc := request.GetResources(pr.Request)
Expand Down
4 changes: 2 additions & 2 deletions pkg/routing/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import (
oo "github.com/tricksterproxy/trickster/pkg/backends/options"
"github.com/tricksterproxy/trickster/pkg/backends/prometheus"
modelprom "github.com/tricksterproxy/trickster/pkg/backends/prometheus/model"
"github.com/tricksterproxy/trickster/pkg/backends/providers"
"github.com/tricksterproxy/trickster/pkg/backends/reverseproxycache"
"github.com/tricksterproxy/trickster/pkg/backends/rule"
"github.com/tricksterproxy/trickster/pkg/backends/types"
"github.com/tricksterproxy/trickster/pkg/cache"
"github.com/tricksterproxy/trickster/pkg/config"
tl "github.com/tricksterproxy/trickster/pkg/logging"
Expand Down Expand Up @@ -80,7 +80,7 @@ func RegisterProxyRoutes(conf *config.Config, router *mux.Router,

// This iteration will ensure default backends are handled properly
for k, o := range conf.Backends {
if !types.IsValidProvider(o.Provider) {
if !providers.IsValidProvider(o.Provider) {
return nil,
fmt.Errorf(`unknown backend provider in backend options. backendName: %s, backendProvider: %s`,
k, o.Provider)
Expand Down

0 comments on commit 1c541ba

Please sign in to comment.