Skip to content

Commit

Permalink
Merge pull request #51 from K-Phoen/graphite-conversion
Browse files Browse the repository at this point in the history
Graphite conversion
  • Loading branch information
K-Phoen authored Mar 27, 2021
2 parents 50b78ff + 9b7e2b0 commit a168cc3
Show file tree
Hide file tree
Showing 15 changed files with 142 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/K-Phoen/dark
go 1.13

require (
github.com/K-Phoen/grabana v0.13.6
github.com/K-Phoen/grabana v0.14.0
github.com/caarlos0/env v3.5.0+incompatible
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/grafana-tools/sdk v0.0.0-20210301100910-d23004341fc8
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbt
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/K-Phoen/grabana v0.13.6 h1:JDmseoI4IVjimgCI3JNoKcMuAtiHT2eY/hloiNYGLJI=
github.com/K-Phoen/grabana v0.13.6/go.mod h1:eQVdbgP2ygxaeSEb08+0Q1K++ewawO0sHXVQgG/SuCw=
github.com/K-Phoen/grabana v0.14.0 h1:dRymBPMrQ5wzXMPUBAtysepDB/up5kaFT0VuR5ufKeo=
github.com/K-Phoen/grabana v0.14.0/go.mod h1:eQVdbgP2ygxaeSEb08+0Q1K++ewawO0sHXVQgG/SuCw=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
Expand Down
16 changes: 16 additions & 0 deletions internal/pkg/converter/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,12 @@ func (converter *JSON) convertTarget(target sdk.Target) *grabana.Target {
return converter.convertPrometheusTarget(target)
}

// looks like graphite
if target.Target != "" {
return converter.convertGraphiteTarget(target)
}

// looks like stackdriver
if target.MetricType != "" {
return converter.convertStackdriverTarget(target)
}
Expand All @@ -677,6 +683,16 @@ func (converter *JSON) convertPrometheusTarget(target sdk.Target) *grabana.Targe
}
}

func (converter *JSON) convertGraphiteTarget(target sdk.Target) *grabana.Target {
return &grabana.Target{
Graphite: &grabana.GraphiteTarget{
Query: target.Target,
Ref: target.RefID,
Hidden: target.Hide,
},
}
}

func (converter *JSON) convertStackdriverTarget(target sdk.Target) *grabana.Target {
switch strings.ToLower(target.MetricKind) {
case "cumulative":
Expand Down
9 changes: 9 additions & 0 deletions vendor/github.com/K-Phoen/grabana/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/K-Phoen/grabana/decoder/graph.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/K-Phoen/grabana/decoder/heatmap.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/K-Phoen/grabana/decoder/singlestat.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/K-Phoen/grabana/decoder/table.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions vendor/github.com/K-Phoen/grabana/decoder/target.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/K-Phoen/grabana/graph/graph.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/K-Phoen/grabana/heatmap/heatmap.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/K-Phoen/grabana/singlestat/singlestat.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/K-Phoen/grabana/table/table.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions vendor/github.com/K-Phoen/grabana/target/graphite/graphite.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cloud.google.com/go v0.46.3
cloud.google.com/go/compute/metadata
# github.com/K-Phoen/grabana v0.13.6
# github.com/K-Phoen/grabana v0.14.0
github.com/K-Phoen/grabana
github.com/K-Phoen/grabana/alert
github.com/K-Phoen/grabana/axis
Expand All @@ -11,6 +11,7 @@ github.com/K-Phoen/grabana/heatmap
github.com/K-Phoen/grabana/row
github.com/K-Phoen/grabana/singlestat
github.com/K-Phoen/grabana/table
github.com/K-Phoen/grabana/target/graphite
github.com/K-Phoen/grabana/target/prometheus
github.com/K-Phoen/grabana/target/stackdriver
github.com/K-Phoen/grabana/text
Expand Down

0 comments on commit a168cc3

Please sign in to comment.