@@ -25,12 +25,8 @@ package main
2525import (
2626 "encoding/json"
2727 "errors"
28- "github.com/aws/aws-sdk-go/aws/credentials/stscreds"
2928 "strings"
3029
31- //"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
32- "github.com/thumbtack/go/lib/metrics"
33- //"github.com/thumbtack/go/lib/monitoring"
3430 "io/ioutil"
3531 "net/http"
3632 _ "net/http/pprof"
@@ -40,6 +36,7 @@ import (
4036 "time"
4137
4238 "github.com/aws/aws-sdk-go/aws"
39+ "github.com/aws/aws-sdk-go/aws/credentials/stscreds"
4340 "github.com/aws/aws-sdk-go/aws/session"
4441 "github.com/aws/aws-sdk-go/service/dynamodb"
4542 "github.com/aws/aws-sdk-go/service/dynamodbstreams"
@@ -61,7 +58,6 @@ var ddbTable = os.Getenv(paramCheckpointTable)
6158var ddbRegion = os .Getenv (paramCheckpointRegion )
6259var ddbEndpoint = os .Getenv (paramCheckpointEndpoint )
6360var ddbClient = ddbConfigConnect (ddbRegion , ddbEndpoint , maxRetries , * logger )
64- var metricsClient = newMetricsClient ()
6561
6662type config struct {
6763 SrcTable string `json:"src_table"`
@@ -77,7 +73,7 @@ type config struct {
7773 ReadQps int64 `json:"read_qps"`
7874 WriteQps int64 `json:"write_qps"`
7975 UpdateCheckpointThreshold int `json:"update_checkpoint_threshold"`
80- EnableStreaming * bool `json:"enable_streaming"`
76+ EnableStreaming * bool `json:"enable_streaming"`
8177}
8278
8379// Config file is read and dumped into this struct
@@ -108,12 +104,12 @@ func NewSyncState(tableConfig config) *syncState {
108104 var stream * dynamodbstreams.DynamoDBStreams
109105
110106 tr := & http.Transport {
111- MaxIdleConns : 2048 ,
112- MaxConnsPerHost : 1024 ,
107+ MaxIdleConns : 2048 ,
108+ MaxConnsPerHost : 1024 ,
113109 }
114110 httpClient := & http.Client {
115- Timeout :8 * time .Second ,
116- Transport :tr }
111+ Timeout : 8 * time .Second ,
112+ Transport : tr }
117113
118114 srcSess := session .Must (
119115 session .NewSession (
@@ -169,8 +165,8 @@ func NewSyncState(tableConfig config) *syncState {
169165}
170166
171167type appConfig struct {
172- sync []config
173- verbose bool
168+ sync []config
169+ verbose bool
174170}
175171
176172// The primary key of the Checkpoint ddb table, of the stream etc
@@ -199,15 +195,6 @@ func ddbConfigConnect(region string, endpoint string, maxRetries int, logger log
199195 )))
200196}
201197
202- func newMetricsClient () (client metrics.Client ) {
203- client , err := metrics .NewAlfredAppClient ()
204- if err != nil {
205- logger .WithFields (logging.Fields {"Error" :err }).Error ("Error in initializing metrics" )
206- os .Exit (1 )
207- }
208- return client
209- }
210-
211198// app constructor
212199func NewApp () * appConfig {
213200 logger .SetLevel (logging .InfoLevel )
@@ -239,8 +226,8 @@ func NewApp() *appConfig {
239226 }
240227
241228 return & appConfig {
242- sync : tableConfig ,
243- verbose : true ,
229+ sync : tableConfig ,
230+ verbose : true ,
244231 }
245232}
246233
@@ -277,7 +264,6 @@ func setDefaults(tableConfig []config) ([]config, error) {
277264 continue
278265 }
279266
280-
281267 if tableConfig [i ].ReadQps == 0 {
282268 tableConfig [i ].ReadQps = 500
283269 }
0 commit comments