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