Skip to content

Commit

Permalink
feat: agent
Browse files Browse the repository at this point in the history
  • Loading branch information
zenghur committed Jun 15, 2021
1 parent b0c203e commit 4a588bd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ func (a *Agent) collectAndSend(ctx context.Context, buf *bytes.Buffer, r *ring.R
}

body.Profile = pf
body.SendTime = time.Now().UnixNano()
body.SendTime = time.Now().Unix()
pp, err := gprofile.ParseData(buf.Bytes())
if err != nil {
return fmt.Errorf("fail to parse profile[%s] data: %w", profileType.String(), err)
}
body.CreateTime = pp.TimeNanos
body.CreateTime = pp.TimeNanos / 1e9

req := a.c.NewRequest().Post().WithPath("/v1/profile").WithJSONBody(&body)
resp, err := a.c.Do(ctx, req)
Expand Down
23 changes: 23 additions & 0 deletions script/tablestore.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package script

import (
"github.com/aliyun/aliyun-tablestore-go-sdk/v5/tablestore"
"github.com/xiaojiaoyu100/profiler/collector/env"
"go.uber.org/zap"
"golang.org/x/tools/go/ssa/interp/testdata/src/fmt"
)

func InitOTS(env *env.Env) {
createTableReq := tablestore.CreateTableRequest{
TableMeta: nil,
TableOption: nil,
ReservedThroughput: nil,
StreamSpec: nil,
IndexMetas: nil,
}
_, err := env.TablestoreClient().Client.CreateTable(&createTableReq)
if err != nil {
env.Logger().Info(fmt.Sprintf("fail to create table %s", env.TablestoreClient().TableName), zap.Error(err))
return
}
}

0 comments on commit 4a588bd

Please sign in to comment.