Skip to content

Commit

Permalink
Adding stats to tsdb
Browse files Browse the repository at this point in the history
  • Loading branch information
aviaIguazio committed Jul 26, 2018
1 parent 0f84c1a commit 4a8d464
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 25 deletions.
36 changes: 36 additions & 0 deletions examples/schemas/tsdb_stocks_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"SETTINGS": {
"Format": "csv",
"Separator": ",",
"TSDBTime": "timestamp",
"TSDBName" : "level_0",
"TSDBValue" : "close",
"TSDBLables" : ""
},
"COLUMNS": [
{
"Index": 0,
"Type": "N",
"Name": "row_num",
"Nullable": true
},
{
"Index": 1,
"Type": "S",
"Name": "timestamp",
"Nullable": true
},
{
"Index": 2,
"Type": "S",
"Name": "level_0",
"Nullable": true
},
{
"Index": 3,
"Type": "N",
"Name": "close",
"Nullable": true
}
]
}
2 changes: 1 addition & 1 deletion examples/stats_2_tsdb_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title = "Workload example"
[global]
Duration = "160s"
server="192.168.206.22"
port="44001"
port="44002"
TLSMode=false
[global.StatusCodesAcceptance]
200 = 100.0 # upto 100% return status of 200
Expand Down
25 changes: 25 additions & 0 deletions httpblaster/csv_2_tsdb_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package httpblaster

import (
"testing"
)





func Test_csv_2_tstdb(t *testing.T) {

}












12 changes: 0 additions & 12 deletions httpblaster/data_generator/memoryGenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ func (self *MemoryGenerator) GenrateJsonArray(v *mem.VirtualMemoryStat) []string
f ,_ := getFloat(vl)
arr = append(arr, self.GenerateJsonByVal(s,f))
}




/* activePayload:= self.GenerateJsonByVal(float64(v.Active))
arr =append(arr, activePayload)
availiblePayload:= self.GenerateJsonByVal(float64(v.Available))
arr =append(arr, availiblePayload)
totalPayload:= self.GenerateJsonByVal(float64(v.Total))
arr =append(arr, totalPayload)
*/

return arr
}

Expand Down
8 changes: 1 addition & 7 deletions httpblaster/igz_data/emd_schema_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,13 @@ func (self *EmdSchemaParser) EmdFromCSVRecord(vals []string) string {
}

func (self *EmdSchemaParser) TSDBFromCSVRecord(vals []string) string {
// TSDBValues := strings.Split(self.tsdb_value, ",")
// for i := range TSDBValues{

// }

tsdb_item := NewTSDBItem()
tsdb_item.GenerateStruct(vals,self)
return string(tsdb_item.ToJsonString())
}


func (self *EmdSchemaParser) TSDBItemsFromCSVRecord(vals []string) []IgzTSDBItem {

func (self *EmdSchemaParser) TSDBItemsFromCSVRecord(vals []string) []string{
tsdb_item := NewTSDBItem()
tsdb_item.GenerateStruct(vals,self)
//return string(tsdb_item.ToJsonString())
Expand Down
4 changes: 1 addition & 3 deletions httpblaster/igz_data/igz_tsdb_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ type IgzTSDBItem struct {
}

func (self *IgzTSDBItem) GenerateStruct(vals []string,parser *EmdSchemaParser) error{
//self.InsertTSDBName(parser.tsdb_attributes_map,vals,T_STRING,vals[parser.tsdb_name_index])

self.InsertTSDBName(vals,parser)
self.InsertTime(vals ,parser)
self.InsertValue(vals[parser.tsdb_value_index])
Expand All @@ -41,7 +39,7 @@ func (self *IgzTSDBItem) InsertTSDBName(vals []string,parser *EmdSchemaParser) e
}
}
input :=""
if parser.tsdb_name_index > 0 {
if parser.tsdb_name_index > -1 {
input = vals[parser.tsdb_name_index]
} else {
input = parser.tsdb_name
Expand Down
3 changes: 1 addition & 2 deletions httpblaster/request_generators/stats2tsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"runtime"
"strings"
"sync"
"time"
//"strconv"

)
Expand Down Expand Up @@ -42,7 +41,7 @@ func (self *Stats2TSDB) generate_request(ch_records chan []string, ch_req chan *
//vals := parser.TSDBFromCSVRecord(r)

//json_payload := vals
time.Sleep(1 * time.Second)

json_payload:=gen.GenerateRandomData()
for _, payload :=range json_payload{
req := AcquireRequest()
Expand Down

0 comments on commit 4a8d464

Please sign in to comment.