khenaidoo | bf6e7bb | 2018-08-14 22:27:29 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 16 | package main |
| 17 | |
| 18 | import ( |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 19 | "context" |
| 20 | "errors" |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 21 | "fmt" |
khenaidoo | bf6e7bb | 2018-08-14 22:27:29 -0400 | [diff] [blame] | 22 | grpcserver "github.com/opencord/voltha-go/common/grpc" |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 23 | "github.com/opencord/voltha-go/common/log" |
David K. Bainbridge | b4a9ab0 | 2019-09-20 15:12:16 -0700 | [diff] [blame] | 24 | "github.com/opencord/voltha-go/common/probe" |
David K. Bainbridge | f430cd5 | 2019-05-28 15:00:35 -0700 | [diff] [blame] | 25 | "github.com/opencord/voltha-go/common/version" |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 26 | "github.com/opencord/voltha-go/db/kvstore" |
khenaidoo | 43c8212 | 2018-11-22 18:38:28 -0500 | [diff] [blame] | 27 | "github.com/opencord/voltha-go/kafka" |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 28 | "github.com/opencord/voltha-go/rw_core/config" |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 29 | c "github.com/opencord/voltha-go/rw_core/core" |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 30 | "github.com/opencord/voltha-go/rw_core/utils" |
khenaidoo | 2c6a099 | 2019-04-29 13:46:56 -0400 | [diff] [blame] | 31 | ic "github.com/opencord/voltha-protos/go/inter_container" |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 32 | "os" |
| 33 | "os/signal" |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 34 | "strconv" |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 35 | "syscall" |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 36 | "time" |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 37 | ) |
| 38 | |
| 39 | type rwCore struct { |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 40 | kvClient kvstore.Client |
| 41 | config *config.RWCoreFlags |
| 42 | halted bool |
| 43 | exitChannel chan int |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 44 | //kmp *kafka.KafkaMessagingProxy |
khenaidoo | 43c8212 | 2018-11-22 18:38:28 -0500 | [diff] [blame] | 45 | grpcServer *grpcserver.GrpcServer |
| 46 | kafkaClient kafka.Client |
| 47 | core *c.Core |
khenaidoo | abad44c | 2018-08-03 16:58:35 -0400 | [diff] [blame] | 48 | //For test |
khenaidoo | 7923270 | 2018-12-04 11:00:41 -0500 | [diff] [blame] | 49 | receiverChannels []<-chan *ic.InterContainerMessage |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 50 | } |
| 51 | |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 52 | func init() { |
khenaidoo | 2c6f167 | 2018-09-20 23:14:41 -0400 | [diff] [blame] | 53 | log.AddPackage(log.JSON, log.DebugLevel, nil) |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 54 | } |
| 55 | |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 56 | func newKVClient(storeType string, address string, timeout int) (kvstore.Client, error) { |
| 57 | |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 58 | log.Infow("kv-store-type", log.Fields{"store": storeType}) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 59 | switch storeType { |
| 60 | case "consul": |
| 61 | return kvstore.NewConsulClient(address, timeout) |
| 62 | case "etcd": |
| 63 | return kvstore.NewEtcdClient(address, timeout) |
| 64 | } |
| 65 | return nil, errors.New("unsupported-kv-store") |
| 66 | } |
| 67 | |
khenaidoo | ca30132 | 2019-01-09 23:06:32 -0500 | [diff] [blame] | 68 | func newKafkaClient(clientType string, host string, port int, instanceID string) (kafka.Client, error) { |
khenaidoo | 43c8212 | 2018-11-22 18:38:28 -0500 | [diff] [blame] | 69 | |
| 70 | log.Infow("kafka-client-type", log.Fields{"client": clientType}) |
| 71 | switch clientType { |
| 72 | case "sarama": |
| 73 | return kafka.NewSaramaClient( |
| 74 | kafka.Host(host), |
khenaidoo | 9084792 | 2018-12-03 14:47:51 -0500 | [diff] [blame] | 75 | kafka.Port(port), |
khenaidoo | ca30132 | 2019-01-09 23:06:32 -0500 | [diff] [blame] | 76 | kafka.ConsumerType(kafka.GroupCustomer), |
khenaidoo | 9084792 | 2018-12-03 14:47:51 -0500 | [diff] [blame] | 77 | kafka.ProducerReturnOnErrors(true), |
| 78 | kafka.ProducerReturnOnSuccess(true), |
| 79 | kafka.ProducerMaxRetries(6), |
khenaidoo | ca30132 | 2019-01-09 23:06:32 -0500 | [diff] [blame] | 80 | kafka.NumPartitions(3), |
| 81 | kafka.ConsumerGroupName(instanceID), |
| 82 | kafka.ConsumerGroupPrefix(instanceID), |
khenaidoo | 54e0ddf | 2019-02-27 16:21:33 -0500 | [diff] [blame] | 83 | kafka.AutoCreateTopic(true), |
khenaidoo | ca30132 | 2019-01-09 23:06:32 -0500 | [diff] [blame] | 84 | kafka.ProducerFlushFrequency(5), |
khenaidoo | 7923270 | 2018-12-04 11:00:41 -0500 | [diff] [blame] | 85 | kafka.ProducerRetryBackoff(time.Millisecond*30)), nil |
khenaidoo | 43c8212 | 2018-11-22 18:38:28 -0500 | [diff] [blame] | 86 | } |
| 87 | return nil, errors.New("unsupported-client-type") |
| 88 | } |
| 89 | |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 90 | func newRWCore(cf *config.RWCoreFlags) *rwCore { |
| 91 | var rwCore rwCore |
| 92 | rwCore.config = cf |
| 93 | rwCore.halted = false |
| 94 | rwCore.exitChannel = make(chan int, 1) |
khenaidoo | 7923270 | 2018-12-04 11:00:41 -0500 | [diff] [blame] | 95 | rwCore.receiverChannels = make([]<-chan *ic.InterContainerMessage, 0) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 96 | return &rwCore |
| 97 | } |
| 98 | |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 99 | func (rw *rwCore) setKVClient() error { |
| 100 | addr := rw.config.KVStoreHost + ":" + strconv.Itoa(rw.config.KVStorePort) |
| 101 | client, err := newKVClient(rw.config.KVStoreType, addr, rw.config.KVStoreTimeout) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 102 | if err != nil { |
Richard Jankowski | e4d7766 | 2018-10-17 13:53:21 -0400 | [diff] [blame] | 103 | rw.kvClient = nil |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 104 | log.Error(err) |
| 105 | return err |
| 106 | } |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 107 | rw.kvClient = client |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 108 | return nil |
| 109 | } |
| 110 | |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 111 | func toString(value interface{}) (string, error) { |
| 112 | switch t := value.(type) { |
| 113 | case []byte: |
| 114 | return string(value.([]byte)), nil |
| 115 | case string: |
| 116 | return value.(string), nil |
| 117 | default: |
| 118 | return "", fmt.Errorf("unexpected-type-%T", t) |
| 119 | } |
| 120 | } |
| 121 | |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 122 | func (rw *rwCore) start(ctx context.Context, instanceId string) { |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 123 | log.Info("Starting RW Core components") |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 124 | |
khenaidoo | 9084792 | 2018-12-03 14:47:51 -0500 | [diff] [blame] | 125 | // Setup KV Client |
Richard Jankowski | e4d7766 | 2018-10-17 13:53:21 -0400 | [diff] [blame] | 126 | log.Debugw("create-kv-client", log.Fields{"kvstore": rw.config.KVStoreType}) |
| 127 | err := rw.setKVClient() |
| 128 | if err == nil { |
| 129 | // Setup KV transaction context |
khenaidoo | 9cdc1a6 | 2019-01-24 21:57:40 -0500 | [diff] [blame] | 130 | txnPrefix := rw.config.KVStoreDataPrefix + "/transactions/" |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 131 | if err = c.SetTransactionContext(instanceId, |
khenaidoo | 9cdc1a6 | 2019-01-24 21:57:40 -0500 | [diff] [blame] | 132 | txnPrefix, |
Richard Jankowski | e4d7766 | 2018-10-17 13:53:21 -0400 | [diff] [blame] | 133 | rw.kvClient, |
| 134 | rw.config.KVStoreTimeout, |
Richard Jankowski | 199fd86 | 2019-03-18 14:49:51 -0400 | [diff] [blame] | 135 | rw.config.KVTxnKeyDelTime, |
khenaidoo | 1ce37ad | 2019-03-24 22:07:24 -0400 | [diff] [blame] | 136 | 1); err != nil { |
khenaidoo | 9cdc1a6 | 2019-01-24 21:57:40 -0500 | [diff] [blame] | 137 | log.Fatal("creating-transaction-context-failed") |
| 138 | } |
Richard Jankowski | e4d7766 | 2018-10-17 13:53:21 -0400 | [diff] [blame] | 139 | } |
| 140 | |
khenaidoo | 9084792 | 2018-12-03 14:47:51 -0500 | [diff] [blame] | 141 | // Setup Kafka Client |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 142 | if rw.kafkaClient, err = newKafkaClient("sarama", rw.config.KafkaAdapterHost, rw.config.KafkaAdapterPort, instanceId); err != nil { |
khenaidoo | 43c8212 | 2018-11-22 18:38:28 -0500 | [diff] [blame] | 143 | log.Fatal("Unsupported-kafka-client") |
| 144 | } |
| 145 | |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 146 | // Create the core service |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 147 | rw.core = c.NewCore(instanceId, rw.config, rw.kvClient, rw.kafkaClient) |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 148 | |
| 149 | // start the core |
| 150 | rw.core.Start(ctx) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 151 | } |
| 152 | |
David K. Bainbridge | b4a9ab0 | 2019-09-20 15:12:16 -0700 | [diff] [blame] | 153 | func (rw *rwCore) stop(ctx context.Context) { |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 154 | // Stop leadership tracking |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 155 | rw.halted = true |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 156 | |
| 157 | // send exit signal |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 158 | rw.exitChannel <- 0 |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 159 | |
| 160 | // Cleanup - applies only if we had a kvClient |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 161 | if rw.kvClient != nil { |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 162 | // Release all reservations |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 163 | if err := rw.kvClient.ReleaseAllReservations(); err != nil { |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 164 | log.Infow("fail-to-release-all-reservations", log.Fields{"error": err}) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 165 | } |
| 166 | // Close the DB connection |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 167 | rw.kvClient.Close() |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 168 | } |
khenaidoo | 43c8212 | 2018-11-22 18:38:28 -0500 | [diff] [blame] | 169 | |
David K. Bainbridge | b4a9ab0 | 2019-09-20 15:12:16 -0700 | [diff] [blame] | 170 | rw.core.Stop(ctx) |
khenaidoo | 43c8212 | 2018-11-22 18:38:28 -0500 | [diff] [blame] | 171 | |
| 172 | //if rw.kafkaClient != nil { |
| 173 | // rw.kafkaClient.Stop() |
| 174 | //} |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | func waitForExit() int { |
| 178 | signalChannel := make(chan os.Signal, 1) |
| 179 | signal.Notify(signalChannel, |
| 180 | syscall.SIGHUP, |
| 181 | syscall.SIGINT, |
| 182 | syscall.SIGTERM, |
| 183 | syscall.SIGQUIT) |
| 184 | |
| 185 | exitChannel := make(chan int) |
| 186 | |
| 187 | go func() { |
| 188 | s := <-signalChannel |
| 189 | switch s { |
| 190 | case syscall.SIGHUP, |
| 191 | syscall.SIGINT, |
| 192 | syscall.SIGTERM, |
| 193 | syscall.SIGQUIT: |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 194 | log.Infow("closing-signal-received", log.Fields{"signal": s}) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 195 | exitChannel <- 0 |
| 196 | default: |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 197 | log.Infow("unexpected-signal-received", log.Fields{"signal": s}) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 198 | exitChannel <- 1 |
| 199 | } |
| 200 | }() |
| 201 | |
| 202 | code := <-exitChannel |
| 203 | return code |
| 204 | } |
| 205 | |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 206 | func printBanner() { |
| 207 | fmt.Println(" ") |
| 208 | fmt.Println(" ______ ______ ") |
| 209 | fmt.Println("| _ \\ \\ / / ___|___ _ __ ___ ") |
| 210 | fmt.Println("| |_) \\ \\ /\\ / / | / _ \\| '__/ _ \\ ") |
| 211 | fmt.Println("| _ < \\ V V /| |__| (_) | | | __/ ") |
| 212 | fmt.Println("|_| \\_\\ \\_/\\_/ \\____\\___/|_| \\___| ") |
| 213 | fmt.Println(" ") |
| 214 | } |
| 215 | |
David K. Bainbridge | f430cd5 | 2019-05-28 15:00:35 -0700 | [diff] [blame] | 216 | func printVersion() { |
| 217 | fmt.Println("VOLTHA Read-Write Core") |
| 218 | fmt.Println(version.VersionInfo.String(" ")) |
| 219 | } |
| 220 | |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 221 | func main() { |
| 222 | start := time.Now() |
| 223 | |
| 224 | cf := config.NewRWCoreFlags() |
| 225 | cf.ParseCommandArguments() |
| 226 | |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 227 | // Set the instance ID as the hostname |
| 228 | var instanceId string |
| 229 | hostName := utils.GetHostName() |
| 230 | if len(hostName) > 0 { |
| 231 | instanceId = hostName |
| 232 | } else { |
| 233 | log.Fatal("HOSTNAME not set") |
| 234 | } |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 235 | |
| 236 | //Setup default logger - applies for packages that do not have specific logger set |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 237 | if _, err := log.SetDefaultLogger(log.JSON, cf.LogLevel, log.Fields{"instanceId": instanceId}); err != nil { |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 238 | log.With(log.Fields{"error": err}).Fatal("Cannot setup logging") |
| 239 | } |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 240 | |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 241 | // Update all loggers (provisioned via init) with a common field |
| 242 | if err := log.UpdateAllLoggers(log.Fields{"instanceId": instanceId}); err != nil { |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 243 | log.With(log.Fields{"error": err}).Fatal("Cannot setup logging") |
| 244 | } |
| 245 | |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 246 | // Update all loggers to log level specified as input parameter |
| 247 | log.SetAllLogLevel(cf.LogLevel) |
khenaidoo | 2c6a099 | 2019-04-29 13:46:56 -0400 | [diff] [blame] | 248 | |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 249 | //log.SetPackageLogLevel("github.com/opencord/voltha-go/rw_core/core", log.DebugLevel) |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 250 | |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 251 | defer log.CleanUp() |
| 252 | |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 253 | // Print version / build information and exit |
David K. Bainbridge | f430cd5 | 2019-05-28 15:00:35 -0700 | [diff] [blame] | 254 | if cf.DisplayVersionOnly { |
| 255 | printVersion() |
| 256 | return |
| 257 | } |
| 258 | |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 259 | // Print banner if specified |
| 260 | if cf.Banner { |
| 261 | printBanner() |
| 262 | } |
| 263 | |
| 264 | log.Infow("rw-core-config", log.Fields{"config": *cf}) |
| 265 | |
David K. Bainbridge | b4a9ab0 | 2019-09-20 15:12:16 -0700 | [diff] [blame] | 266 | // Create the core |
| 267 | rw := newRWCore(cf) |
| 268 | |
| 269 | // Create a context adding the status update channel |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 270 | ctx, cancel := context.WithCancel(context.Background()) |
| 271 | defer cancel() |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 272 | |
David K. Bainbridge | b4a9ab0 | 2019-09-20 15:12:16 -0700 | [diff] [blame] | 273 | /* |
| 274 | * Create and start the liveness and readiness container management probes. This |
| 275 | * is done in the main function so just in case the main starts multiple other |
| 276 | * objects there can be a single probe end point for the process. |
| 277 | */ |
| 278 | p := &probe.Probe{} |
Kent Hagerman | c461883 | 2019-10-07 12:24:36 -0400 | [diff] [blame^] | 279 | go p.ListenAndServe(fmt.Sprintf("%s:%d", rw.config.ProbeHost, rw.config.ProbePort)) |
David K. Bainbridge | b4a9ab0 | 2019-09-20 15:12:16 -0700 | [diff] [blame] | 280 | |
| 281 | // Add the probe to the context to pass to all the services started |
| 282 | probeCtx := context.WithValue(ctx, probe.ProbeContextKey, p) |
| 283 | |
| 284 | // Start the core |
| 285 | go rw.start(probeCtx, instanceId) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 286 | |
| 287 | code := waitForExit() |
khenaidoo | 5c11af7 | 2018-07-20 17:21:05 -0400 | [diff] [blame] | 288 | log.Infow("received-a-closing-signal", log.Fields{"code": code}) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 289 | |
| 290 | // Cleanup before leaving |
David K. Bainbridge | b4a9ab0 | 2019-09-20 15:12:16 -0700 | [diff] [blame] | 291 | rw.stop(probeCtx) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 292 | |
| 293 | elapsed := time.Since(start) |
khenaidoo | 631fe54 | 2019-05-31 15:44:43 -0400 | [diff] [blame] | 294 | log.Infow("rw-core-run-time", log.Fields{"core": instanceId, "time": elapsed / time.Second}) |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 295 | } |