Skip to content

Commit

Permalink
fix mon_folder variable not used and disable cgo
Browse files Browse the repository at this point in the history
Took 51 minutes
  • Loading branch information
agaurav committed Mar 27, 2023
1 parent 28b7cc1 commit a520a94
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
5 changes: 3 additions & 2 deletions libs/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ func GenTerraform(slosMv map[string]*SLOMultiVerse, c GenConf) (string, error) {
panic(err)
}

makeOSLODepGraph(slosMv, c)
//to be moved to conditional compilation later
//graph.MakeOSLODepGraph(slosMv, c)

return genTerraformForAlpha(slosAlpha, c)
}
Expand Down Expand Up @@ -275,7 +276,7 @@ func SetupOutDir(c GenConf) error {
{Path: filepath.Join(c.OutDir, ViewsFolder), Vars: nil},
{Path: filepath.Join(c.OutDir, MonitorsFolder), Vars: []string{VarNameMonRootFolder}},
{Path: filepath.Join(c.OutDir, DashboardsFolder), Vars: []string{VarNameDashRootFolder}},
{Path: filepath.Join(c.OutDir, NativeSLOFolder), Vars: []string{VarNameNativeSLORootFolder}},
{Path: filepath.Join(c.OutDir, NativeSLOFolder), Vars: []string{VarNameNativeSLORootFolder, VarNameSLOMonitorRootFolder}},
}
}

Expand Down
19 changes: 10 additions & 9 deletions libs/graph.go → libs/graph/graph.go
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
package libs
package graph

import (
"github.com/OpenSLO/slogen/libs"
"github.com/goccy/go-graphviz/cgraph"

"github.com/goccy/go-graphviz"
)

func makeOSLODepGraph(confs map[string]*SLOMultiVerse, c GenConf) *graphviz.Graphviz {
func MakeOSLODepGraph(confs map[string]*libs.SLOMultiVerse, c libs.GenConf) *graphviz.Graphviz {
g := graphviz.New()
graph, err := g.Graph()
if err != nil {
log.Fatal(err)
libs.Log().Fatal(err)
}
defer func() {
if err := graph.Close(); err != nil {
log.Fatal(err)
libs.Log().Fatal(err)
}
g.Close()
}()

err = createNodes(graph, confs)
if err != nil {
log.Errorw("error generating slo graph nodes", "err", err)
libs.Log().Errorw("error generating slo graph nodes", "err", err)
}

err = createEdges(graph, confs)
if err != nil {
log.Errorw("error generating slo graph edges", "err", err)
libs.Log().Errorw("error generating slo graph edges", "err", err)
}

filePath := c.OutDir + "/" + "slo-dep-graph.png"
Expand All @@ -36,7 +37,7 @@ func makeOSLODepGraph(confs map[string]*SLOMultiVerse, c GenConf) *graphviz.Grap
return g
}

func createNodes(graph *cgraph.Graph, confs map[string]*SLOMultiVerse) error {
func createNodes(graph *cgraph.Graph, confs map[string]*libs.SLOMultiVerse) error {

var err error
for _, v := range confs {
Expand Down Expand Up @@ -70,7 +71,7 @@ func createNodes(graph *cgraph.Graph, confs map[string]*SLOMultiVerse) error {
}

if err != nil {
log.Errorw("error generating slo graph", "err", err)
libs.Log().Errorw("error generating slo graph", "err", err)
return err
}
//node.
Expand All @@ -79,7 +80,7 @@ func createNodes(graph *cgraph.Graph, confs map[string]*SLOMultiVerse) error {
return nil
}

func createEdges(graph *cgraph.Graph, confs map[string]*SLOMultiVerse) error {
func createEdges(graph *cgraph.Graph, confs map[string]*libs.SLOMultiVerse) error {

for _, v := range confs {

Expand Down

0 comments on commit a520a94

Please sign in to comment.