Module: Juno + + + +
+-
+
- Defined in: +
- lib/juno/IO/constants.rb,
+ lib/juno/logger.rb,
lib/juno/version.rb,
lib/juno/Utils/utils.rb,
lib/juno/Config/config.rb,
lib/juno/server_status.rb,
lib/juno/IO/JunoMessage.rb,
lib/juno/Net/worker_pool.rb,
lib/juno/Net/io_processor.rb,
lib/juno/Net/ping_message.rb,
lib/juno/Config/properties.rb,
lib/juno/IO/ProtocolHeader.rb,
lib/juno/Net/request_queue.rb,
lib/juno/Client/cache_store.rb,
lib/juno/Client/sync_client.rb,
lib/juno/Net/base_processor.rb,
lib/juno/Net/client_handler.rb,
lib/juno/Utils/client_utils.rb,
lib/juno/Client/juno_request.rb,
lib/juno/Client/react_client.rb,
lib/juno/IO/OperationMessage.rb,
lib/juno/IO/PayloadComponent.rb,
lib/juno/Client/juno_response.rb,
lib/juno/Config/config_reader.rb,
lib/juno/IO/MetadataComponent.rb,
lib/juno/Client/operation_type.rb,
lib/juno/Client/record_context.rb,
lib/juno/Config/config_provider.rb,
lib/juno/Client/operation_status.rb,
lib/juno/Config/default_properties.rb,
lib/juno/IO/MetadataComponentTemplate.rb +
+
Overview
Top module for juno client
+ + +Defined Under Namespace
++ + + Modules: Client, ClientUtils, IO, Net + + + + Classes: Config, ConfigProvider, ConfigReader, DefaultProperties, Logger, Properties, ServerStatus, Utils + + +
+ + ++ Constant Summary + collapse +
+ +-
+
+
- VERSION = + + +
'0.1.0'
+
+
+ Class Method Summary + collapse +
+ +-
+
+
- + + + .configure ⇒ Object + + + + + + + + + + + + + + + + + + +
- + + + .juno_config ⇒ Object + + + + + + + + + + + + + + + + + + +
Class Method Details
+ + ++ + .configure ⇒ Object + + + + + +
+ + + +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122+ |
+
+ # File 'lib/juno/Config/config.rb', line 105 + +def self.configure + if @juno_config.nil? + config_reader = Juno::ConfigReader.new + yield config_reader + if !config_reader.file_path.nil? + @juno_config = Config.new(ConfigProvider.new(config_reader.file_path, config_reader.source_format, nil), + log_file: config_reader.log_file, ssl_cert_file: config_reader.ssl_cert_file, + ssl_key_file: config_reader.ssl_key_file) + @LOGGER = Juno::Logger.instance + elsif !config_reader.url.nil? # URL should URI Object + # @juno_config = Config.new(ConfigProvider.new(@juno_config.file_path, @juno_config.source_format, nil)) + else + raise 'No file or url provided' + end + else + Juno::Logger.instance.warn('Juno client cannot be reconfigured') + end +end+ |
+
+ + .juno_config ⇒ Object + + + + + +
+ + + +124 +125 +126 +127 +128+ |
+
+ # File 'lib/juno/Config/config.rb', line 124 + +def self.juno_config + raise 'Please configure the properties using Juno.configure' if @juno_config.nil? + + @juno_config +end+ |
+
+
+ #### Setup
+
+ ##### Configure proxy and storage to push metrics to otel endpoint
+
+- Juno proxy and storage services are configured to push the metrics on open telemetry collector endpoint http://localhost:4318/v1/metrics . Add/Update the [OTEL] section in the respective config.toml files
+
+```yaml
+[OTEL]
+ Enabled = true
+ Environment = "qa"
+ Host = "0.0.0.0"
+ Poolname = "junoserv-ai"
+ Port = 4318
+ Resolution = 10
+ UrlPath = "/v1/metrics"
+ UseTls = false
+
+```
+
+- Now the proxy and storage services are uploading metrics to otel endpoint.
+
+##### Set up otel-collector, prometheus and grafana
+- Open telemetry collector, prometheus and grafana are run as docker containers.
+- otel-collector , prometheus and grafana configurations are required to be mounted as volumes in the containers
+- docker-compose.yaml and configuration files for each of the services available in junodb/docker/monitoring
+
+
+```bash
+cd junodb/docker/monitoring
+
+docker compose up -d
+```
+
+- Check the running containers. prometheus, otel-collector and grafana should be running
+
+```bash
+CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+bcb1e7ece6b7 prom/prometheus "/bin/prometheus --c…" 3 hours ago Up 3 hours 0.0.0.0:9090->9090/tcp prometheus
+c3816c006f85 otel/opentelemetry-collector-contrib "/otelcol-contrib --…" 3 hours ago Up 3 hours 0.0.0.0:1888->1888/tcp, 0.0.0.0:4317-4318->4317-4318/tcp, 0.0.0.0:8888-8889->8888-8889/tcp, 0.0.0.0:13133->13133/tcp, 0.0.0.0:55679->55679/tcp, 55678/tcp otel-collector
+e41e33696606 grafana/grafana "/run.sh" 3 hours ago Up 3 hours 0.0.0.0:3000->3000/tcp grafana
+
+```
+
+- Check the promethus server running at
+
+
+
diff --git a/docs/prometheus.png b/docs/prometheus.png
new file mode 100644
index 00000000..d54cc18e
Binary files /dev/null and b/docs/prometheus.png differ
diff --git a/docs/swaphost.md b/docs/swaphost.md
new file mode 100644
index 00000000..6df77992
--- /dev/null
+++ b/docs/swaphost.md
@@ -0,0 +1,86 @@
+[](https://opensource.org/licenses/Apache-2.0)
+# Juno Host Swap Instruction
+Bad Juno nodes may have to be swapped out on a live cluster. The node that needs to be swapped can be running etcd (junoclusterserv), or juno storage or both. Following is a step-by-step guide to perform the swap.
+
+## Swapping a Storage Host
+### Step0 (optional)
+Pre-insert some data via junocli tool before host swap, after host swap, retrieve data and see if all data are able to be retrieved.
+
+### Step1
+Deploy junostorageserv (and or junoserv) on New_Host1, both services don't need to be start up, just deploy.
+update the junoclustercfg config.toml by changing old box into new box, make a package and deploy it to new box.
+
+```bash
+Old Config New Config
+SSHosts=[ SSHosts=[
+# Zone 0 # Zone 0
+[ [
+ "Host1" "New_Host1"
+], ],
+# Zone 1 # Zone 1
+[ [
+ "Host2" "Host2"
+], ],
+# Zone 2 # Zone 2
+[ [
+ "Host3" "Host3"
+],
+# Zone 3 # Zone 3
+[ [
+ "Host4" "Host4"
+], ],
+# Zone 4 # Zone 4
+[ [
+ "Host5" "Host5"
+] ]
+] ]
+```
+Make sure storageserv are up on all the boxes other than the bad box.
+
+### Step2
+If to be replaced box is a bad box, this step can be skipped. If to be replaced box is a good box, shutdown
+junostorageserv on to be replaced box, copy rocksdb_junostorageserv from it to new box on the same location.
+
+### Step3
+On the new box (the cluster config contains New_Host1), from junoclustercfg directory, run ./swaphost.sh.
+This step will bump up the junocluster config version in etcd and all the running junoserv and junostorageserv
+hosts will update their cluster map accordingly after script run.
+
+### Step4
+Start up junostorageserv (and or junoserv) on New_Host1. It will fetch the latest junoclustercfg from etcd.
+
+### Step5 (Optional)
+Validation - use junocli to retrieve pre-inserted data, all data should be able to retrieve.
+
+### Step6
+Once junoserv on New_Host1 works fine, if there is LB in front of junoserv, fix LB to replace Host1 with New_Host1
+
+Deploy the updated junoclustercfg package which contains New_Host1 to all the junoclustercfg boxes. All boxes have
+same version of junoclustercfg package after that.
+
+## Swapping host which has etcd server runs on
+The etcd cluster has three or five hosts depending on 3 quorum or 5 quorum - Host1^Host2^Host3^Host4^Host5
+
+Identify a new host (New_Host1) for the swap. Make sure etcd servers are up on all hosts except the bad one.
+Host1 is to be swapped with New_Host1
+
+### Step1
+Change the etcdsvr.txt under junoclusterserv
+```bash
+Old etcdsvr.txt New etcdsvr.txt
+[etcdsvr] [etcdsvr]
+initial_cluster = "Host1^Host2^Host3^Host4^Host5" initial_cluster = "New_Host1^Host2^Host3^Host4^Host5"
+```
+Build the junoclusterserv package and deploy to new box (New_Host1)
+
+### Step2
+On the old box (Host1), shutdown junoclusterserv by shutdown.sh under junoclusterserv
+
+On the new box(New_Host1), under junoclusterserv, first run join.sh, then run start.sh to have the new box
+join the members of quorum
+
+### Step3
+Deploy and start the new junoclusterserv package one by one to all other junoclusterserv boxes
+
+### Step4
+Fix LB of etcd to replace old Host1 with New_Host1.
diff --git a/go.mod b/go.mod
index b55c9d08..0c138506 100644
--- a/go.mod
+++ b/go.mod
@@ -1,4 +1,4 @@
-module juno
+module github.com/paypal/junodb
go 1.18
@@ -12,42 +12,42 @@ require (
github.com/satori/go.uuid v1.2.0
github.com/spaolacci/murmur3 v1.1.0
go.etcd.io/etcd/client/v3 v3.5.4
- go.opentelemetry.io/otel v1.11.2
- go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.34.0
- go.opentelemetry.io/otel/metric v0.34.0
- go.opentelemetry.io/otel/sdk v1.11.2
- go.opentelemetry.io/otel/sdk/metric v0.34.0
+ go.opentelemetry.io/otel v1.16.0
+ go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0
+ go.opentelemetry.io/otel/metric v1.16.0
+ go.opentelemetry.io/otel/sdk v1.16.0
+ go.opentelemetry.io/otel/sdk/metric v0.39.0
go.opentelemetry.io/proto/otlp v0.19.0
- google.golang.org/protobuf v1.28.1
+ google.golang.org/protobuf v1.30.0
)
require (
- github.com/golang/protobuf v1.5.2 // indirect
- github.com/kr/pretty v0.3.0 // indirect
- github.com/rogpeppe/go-internal v1.6.2 // indirect
- golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 // indirect
- golang.org/x/net v0.7.0 // indirect
- gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
- github.com/cenkalti/backoff/v4 v4.2.0 // indirect
+ github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
- github.com/go-logr/logr v1.2.3 // indirect
+ github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
+ github.com/golang/protobuf v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
+ github.com/kr/pretty v0.3.0 // indirect
+ github.com/rogpeppe/go-internal v1.6.2 // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
- go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect
- go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.34.0 // indirect
- go.opentelemetry.io/otel/trace v1.11.2 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect
+ go.opentelemetry.io/otel/trace v1.16.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.0 // indirect
- golang.org/x/sys v0.5.0 // indirect
- golang.org/x/text v0.7.0 // indirect
- google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect
- google.golang.org/grpc v1.51.0 // indirect
+ golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 // indirect
+ golang.org/x/net v0.8.0 // indirect
+ golang.org/x/sys v0.8.0 // indirect
+ golang.org/x/text v0.8.0 // indirect
+ google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
+ google.golang.org/grpc v1.55.0 // indirect
+ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
)
diff --git a/go.sum b/go.sum
index 3cd3cb01..f107fb29 100644
--- a/go.sum
+++ b/go.sum
@@ -50,8 +50,8 @@ github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
-github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4=
-github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
+github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
+github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
@@ -101,8 +101,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
-github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
-github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
+github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
+github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
@@ -112,8 +112,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
-github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
+github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -139,8 +139,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
-github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
+github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
@@ -248,7 +249,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
+github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -265,22 +266,22 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
-go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0=
-go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI=
-go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 h1:htgM8vZIF8oPSCxa341e3IZ4yr/sKxgu8KZYllByiVY=
-go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2/go.mod h1:rqbht/LlhVBgn5+k3M5QK96K5Xb0DvXpMJ5SFQpY6uw=
-go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.34.0 h1:kpskzLZ60cJ48SJ4uxWa6waBL+4kSV6nVK8rP+QM8Wg=
-go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.34.0/go.mod h1:4+x3i62TEegDHuzNva0bMcAN8oUi5w4liGb1d/VgPYo=
-go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.34.0 h1:t4Ajxj8JGjxkqoBtbkCOY2cDUl9RwiNE9LPQavooi9U=
-go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.34.0/go.mod h1:WO7omosl4P7JoanH9NgInxDxEn2F2M5YinIh8EyeT8w=
-go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8=
-go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8=
-go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU=
-go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU=
-go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo=
-go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ=
-go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0=
-go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA=
+go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s=
+go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4=
+go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 h1:t4ZwRPU+emrcvM2e9DHd0Fsf0JTPVcbfa/BhTDF03d0=
+go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0/go.mod h1:vLarbg68dH2Wa77g71zmKQqlQ8+8Rq3GRG31uc0WcWI=
+go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 h1:f6BwB2OACc3FCbYVznctQ9V6KK7Vq6CjmYXJ7DeSs4E=
+go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0/go.mod h1:UqL5mZ3qs6XYhDnZaW1Ps4upD+PX6LipH40AoeuIlwU=
+go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0 h1:IZXpCEtI7BbX01DRQEWTGDkvjMB6hEhiEZXS+eg2YqY=
+go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0/go.mod h1:xY111jIZtWb+pUUgT4UiiSonAaY2cD2Ts5zvuKLki3o=
+go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo=
+go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4=
+go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE=
+go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4=
+go.opentelemetry.io/otel/sdk/metric v0.39.0 h1:Kun8i1eYf48kHH83RucG93ffz0zGV1sh46FAScOTuDI=
+go.opentelemetry.io/otel/sdk/metric v0.39.0/go.mod h1:piDIRgjcK7u0HCL5pCA4e74qpK/jk3NiUoAHATVAmiI=
+go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs=
+go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw=
go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
@@ -369,8 +370,8 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
-golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
-golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
+golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
+golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -426,8 +427,8 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
-golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
+golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -435,8 +436,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
-golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
+golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -486,7 +487,7 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
-golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
+golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -549,8 +550,9 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
-google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE=
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
+google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA=
+google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
@@ -568,8 +570,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
-google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U=
-google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
+google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
+google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -583,8 +585,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
-google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
+google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
diff --git a/internal/cli/ctx.go b/internal/cli/ctx.go
index 022dbfd5..56965d87 100644
--- a/internal/cli/ctx.go
+++ b/internal/cli/ctx.go
@@ -20,9 +20,9 @@
package cli
import (
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/pkg/proto"
)
//GetResponse() != nil and GetError() != nil are mutually exclusive
diff --git a/internal/cli/proc.go b/internal/cli/proc.go
index 5a4719ce..d67c13b9 100644
--- a/internal/cli/proc.go
+++ b/internal/cli/proc.go
@@ -26,11 +26,11 @@ import (
"syscall"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- junoio "juno/pkg/io"
- "juno/pkg/proto"
- "juno/pkg/util"
+ junoio "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/util"
)
type (
diff --git a/internal/cli/processor.go b/internal/cli/processor.go
index be505974..cb7ee3ad 100644
--- a/internal/cli/processor.go
+++ b/internal/cli/processor.go
@@ -25,12 +25,12 @@ import (
"sync"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/io"
- "juno/pkg/logging"
- "juno/pkg/logging/cal"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/proto"
)
type IOError struct {
diff --git a/internal/cli/recinfo.go b/internal/cli/recinfo.go
index 6e3a752e..728bfb42 100644
--- a/internal/cli/recinfo.go
+++ b/internal/cli/recinfo.go
@@ -22,7 +22,7 @@ package cli
import (
"fmt"
"io"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/pkg/proto"
)
type RecordInfo struct {
diff --git a/internal/cli/tracker.go b/internal/cli/tracker.go
index 54a30021..28af2b13 100644
--- a/internal/cli/tracker.go
+++ b/internal/cli/tracker.go
@@ -23,9 +23,9 @@ import (
"fmt"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/util"
)
type PendingRequest struct {
diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go
index fb2eb5f1..fdaeca59 100644
--- a/pkg/cfg/cfg.go
+++ b/pkg/cfg/cfg.go
@@ -29,7 +29,7 @@ import (
"github.com/BurntSushi/toml"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
type (
diff --git a/pkg/client/clientimpl.go b/pkg/client/clientimpl.go
index 0648fd65..7ab57804 100644
--- a/pkg/client/clientimpl.go
+++ b/pkg/client/clientimpl.go
@@ -17,20 +17,22 @@
// limitations under the License.
//
+// Package client provides interfaces and implementations for communicating with a Juno server.
package client
import (
"fmt"
"runtime"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/internal/cli"
- "juno/pkg/io"
- "juno/pkg/logging"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/internal/cli"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/proto"
)
+// clientImplT is the default implementation of the IClient interface.
type clientImplT struct {
config Config
appName string
@@ -38,6 +40,7 @@ type clientImplT struct {
processor *cli.Processor
}
+// newProcessorWithConfig initializes a new Processor with the given configuration.
func newProcessorWithConfig(conf *Config) *cli.Processor {
if conf == nil {
return nil
@@ -51,6 +54,7 @@ func newProcessorWithConfig(conf *Config) *cli.Processor {
return c
}
+// New initializes a new IClient with the given configuration. Returns an error if configuration validation fails.
func New(conf Config) (IClient, error) {
if err := conf.validate(); err != nil {
return nil, err
@@ -68,6 +72,7 @@ func New(conf Config) (IClient, error) {
return client, nil
}
+// NewClient initializes a new IClient with the provided server address, namespace and app name.
func NewClient(server string, ns string, app string) (IClient, error) {
c := &clientImplT{
config: Config{
@@ -99,6 +104,8 @@ func NewClient(server string, ns string, app string) (IClient, error) {
}
///TODO to revisit
+
+// Close closes the client and cleans up resources.
func (c *clientImplT) Close() {
if c.processor != nil {
c.processor.Close()
@@ -106,6 +113,7 @@ func (c *clientImplT) Close() {
}
}
+// getOptions collects all provided options into an optionData object.
func (c *clientImplT) getOptions(opts ...IOption) *optionData {
data := &optionData{}
for _, op := range opts {
@@ -114,12 +122,14 @@ func (c *clientImplT) getOptions(opts ...IOption) *optionData {
return data
}
+// newContext creates a new context from the provided operational message.
func newContext(resp *proto.OperationalMessage) IContext {
recInfo := &cli.RecordInfo{}
recInfo.SetFromOpMsg(resp)
return recInfo
}
+// Create sends a Create operation request to the server.
func (c *clientImplT) Create(key []byte, value []byte, opts ...IOption) (context IContext, err error) {
glog.Verbosef("Create ")
var resp *proto.OperationalMessage
@@ -138,6 +148,7 @@ func (c *clientImplT) Create(key []byte, value []byte, opts ...IOption) (context
return
}
+// Get sends a Get operation request to the server.
func (c *clientImplT) Get(key []byte, opts ...IOption) (value []byte, context IContext, err error) {
var resp *proto.OperationalMessage
options := newOptionData(opts...)
@@ -161,6 +172,7 @@ func (c *clientImplT) Get(key []byte, opts ...IOption) (value []byte, context IC
return
}
+// Update sends an Update operation request to the server.
func (c *clientImplT) Update(key []byte, value []byte, opts ...IOption) (context IContext, err error) {
var resp *proto.OperationalMessage
options := newOptionData(opts...)
@@ -183,6 +195,7 @@ func (c *clientImplT) Update(key []byte, value []byte, opts ...IOption) (context
return
}
+// Set sends a Set operation request to the server.
func (c *clientImplT) Set(key []byte, value []byte, opts ...IOption) (context IContext, err error) {
var resp *proto.OperationalMessage
options := newOptionData(opts...)
@@ -200,6 +213,7 @@ func (c *clientImplT) Set(key []byte, value []byte, opts ...IOption) (context IC
return
}
+// Destroy sends a Destroy operation request to the server.
func (c *clientImplT) Destroy(key []byte, opts ...IOption) (err error) {
var resp *proto.OperationalMessage
options := newOptionData(opts...)
@@ -215,6 +229,7 @@ func (c *clientImplT) Destroy(key []byte, opts ...IOption) (err error) {
return
}
+// UDFGet sends a UDFGet operation request to the server.
func (c *clientImplT) UDFGet(key []byte, fname []byte, params []byte, opts ...IOption) (value []byte, context IContext, err error) {
var resp *proto.OperationalMessage
options := newOptionData(opts...)
@@ -239,6 +254,7 @@ func (c *clientImplT) UDFGet(key []byte, fname []byte, params []byte, opts ...IO
return
}
+// UDFSet sends a UDFSet operation request to the server.
func (c *clientImplT) UDFSet(key []byte, fname []byte, params []byte, opts ...IOption) (context IContext, err error) {
var resp *proto.OperationalMessage
options := newOptionData(opts...)
@@ -258,10 +274,13 @@ func (c *clientImplT) UDFSet(key []byte, fname []byte, params []byte, opts ...IO
}
///TODO temporary
+
+// Batch sends a batch of operation requests to the server.
func (c *clientImplT) Batch(requests []*proto.OperationalMessage) (responses []*proto.OperationalMessage, err error) {
return c.processor.ProcessBatchRequests(requests)
}
+// NewRequest creates a new OperationalMessage with the provided parameters.
func (c *clientImplT) NewRequest(op proto.OpCode, key []byte, value []byte, ttl uint32) (request *proto.OperationalMessage) {
///TODO: validate op
request = &proto.OperationalMessage{}
@@ -272,6 +291,7 @@ func (c *clientImplT) NewRequest(op proto.OpCode, key []byte, value []byte, ttl
return
}
+// NewUDFRequest creates a new UDF OperationalMessage with the provided parameters.
func (c *clientImplT) NewUDFRequest(op proto.OpCode, key []byte, fname []byte, params []byte, ttl uint32) (request *proto.OperationalMessage) {
///TODO: validate op
request = &proto.OperationalMessage{}
@@ -284,6 +304,7 @@ func (c *clientImplT) NewUDFRequest(op proto.OpCode, key []byte, fname []byte, p
return
}
+// checkResponse validates the response from the server against the original request.
func checkResponse(request *proto.OperationalMessage, response *proto.OperationalMessage, recInfo *cli.RecordInfo) (err error) {
opCode := request.GetOpCode()
if opCode != response.GetOpCode() {
diff --git a/pkg/client/config.go b/pkg/client/config.go
index 22a4d90e..860cf076 100644
--- a/pkg/client/config.go
+++ b/pkg/client/config.go
@@ -1,47 +1,49 @@
+// Copyright 2023 PayPal Inc.
//
-// Copyright 2023 PayPal Inc.
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// Package client handles the configuration for a Juno client.
package client
import (
"fmt"
"time"
- "juno/pkg/io"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/util"
)
+// Duration is a type alias for util.Duration.
type Duration = util.Duration
+// Config holds the configuration values for the Juno client.
type Config struct {
- Server io.ServiceEndpoint
- Appname string
- Namespace string
- RetryCount int
- DefaultTimeToLive int
- ConnectTimeout Duration
- ReadTimeout Duration
- WriteTimeout Duration
- RequestTimeout Duration
- ConnRecycleTimeout Duration
+ Server io.ServiceEndpoint // Server defines the ServiceEndpoint of the Juno server.
+ Appname string // Appname is the name of the application.
+ Namespace string // Namespace is the namespace of the application.
+ RetryCount int // RetryCount is the maximum number of retries.
+ DefaultTimeToLive int // DefaultTimeToLive is the default TTL (time to live) for requests.
+ ConnectTimeout Duration // ConnectTimeout is the timeout for establishing connections.
+ ReadTimeout Duration // ReadTimeout is the timeout for read operations.
+ WriteTimeout Duration // WriteTimeout is the timeout for write operations.
+ RequestTimeout Duration // RequestTimeout is the timeout for each request.
+ ConnRecycleTimeout Duration // ConnRecycleTimeout is the timeout for connection recycling.
}
+// defaultConfig defines the default configuration values.
var defaultConfig = Config{
RetryCount: 1,
DefaultTimeToLive: 1800,
@@ -52,10 +54,12 @@ var defaultConfig = Config{
ConnRecycleTimeout: Duration{9 * time.Second},
}
+// SetDefaultTimeToLive sets the default time to live (TTL) for the configuration.
func SetDefaultTimeToLive(ttl int) {
defaultConfig.DefaultTimeToLive = ttl
}
+// SetDefaultTimeout sets the default timeout durations for the configuration.
func SetDefaultTimeout(connect, read, write, request, connRecycle time.Duration) {
defaultConfig.ConnectTimeout.Duration = connect
defaultConfig.ReadTimeout.Duration = read
@@ -64,10 +68,14 @@ func SetDefaultTimeout(connect, read, write, request, connRecycle time.Duration)
defaultConfig.ConnRecycleTimeout.Duration = connRecycle
}
+// SetDefault updates the current Config to match the default Config.
func (c *Config) SetDefault() {
*c = defaultConfig
}
+// validate checks if the required fields of the Config are correctly populated.
+// It validates the Server field and checks if Appname and Namespace are specified.
+// It returns an error if any of the above conditions are not met.
func (c *Config) validate() error {
if err := c.Server.Validate(); err != nil {
return err
@@ -78,6 +86,6 @@ func (c *Config) validate() error {
if len(c.Namespace) == 0 {
return fmt.Errorf("Config.Namespace not specified.")
}
- /// TODO to validate others
+ // TODO to validate others
return nil
}
diff --git a/pkg/client/error.go b/pkg/client/error.go
index 18c7332b..5dd6991f 100644
--- a/pkg/client/error.go
+++ b/pkg/client/error.go
@@ -17,61 +17,66 @@
// limitations under the License.
//
+// client is a package that handles various error situations in the Juno application.
package client
import (
- "juno/internal/cli"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/internal/cli"
+ "github.com/paypal/junodb/pkg/proto"
)
+// Error variables for different scenarios in the application.
var (
- ErrNoKey error
- ErrUniqueKeyViolation error
- ErrBadParam error
- ErrConditionViolation error
+ ErrNoKey error // Error when no key is found.
+ ErrUniqueKeyViolation error // Error when there is a violation of a unique key.
+ ErrBadParam error // Error when a bad parameter is provided.
+ ErrConditionViolation error // Error when a condition violation occurs.
- ErrBadMsg error
- ErrNoStorage error
- ErrRecordLocked error
- ErrTTLExtendFailure error
- ErrBusy error
+ ErrBadMsg error // Error when a bad message is encountered.
+ ErrNoStorage error // Error when no storage is available.
+ ErrRecordLocked error // Error when a record is locked.
+ ErrTTLExtendFailure error // Error when TTL extension fails.
+ ErrBusy error // Error when the server is busy.
- ErrWriteFailure error
- ErrInternal error
- ErrOpNotSupported error
+ ErrWriteFailure error // Error when a write operation fails.
+ ErrInternal error // Error when an internal problem occurs.
+ ErrOpNotSupported error // Error when the operation is not supported.
)
+// errorMapping is a map between different operation status and their corresponding errors.
var errorMapping map[proto.OpStatus]error
+// init function initializes the error variables and the errorMapping map.
func init() {
- ErrNoKey = &cli.Error{"no key"}
- ErrUniqueKeyViolation = &cli.Error{"unique key violation"}
- ErrBadParam = &cli.Error{"bad parameter"}
- ErrConditionViolation = &cli.Error{"condition violation"} //version too old
- ErrTTLExtendFailure = &cli.Error{"fail to extend TTL"}
+ ErrNoKey = &cli.Error{"no key"} // Error when the key does not exist.
+ ErrUniqueKeyViolation = &cli.Error{"unique key violation"} // Error when unique key constraint is violated.
+ ErrBadParam = &cli.Error{"bad parameter"} // Error when a bad parameter is passed.
+ ErrConditionViolation = &cli.Error{"condition violation"} // Error when there is a condition violation.
+ ErrTTLExtendFailure = &cli.Error{"fail to extend TTL"} // Error when TTL extension fails.
- ErrBadMsg = &cli.RetryableError{"bad message"}
- ErrNoStorage = &cli.RetryableError{"no storage"}
- ErrRecordLocked = &cli.RetryableError{"record locked"}
- ErrBusy = &cli.RetryableError{"server busy"}
+ ErrBadMsg = &cli.RetryableError{"bad message"} // Error when an inappropriate message is received.
+ ErrNoStorage = &cli.RetryableError{"no storage"} // Error when there is no storage available.
+ ErrRecordLocked = &cli.RetryableError{"record locked"} // Error when a record is locked.
+ ErrBusy = &cli.RetryableError{"server busy"} // Error when the server is busy.
- ErrWriteFailure = &cli.Error{"write failure"}
- ErrInternal = &cli.Error{"internal error"}
- ErrOpNotSupported = &cli.Error{"Op not supported"}
+ ErrWriteFailure = &cli.Error{"write failure"} // Error when a write operation fails.
+ ErrInternal = &cli.Error{"internal error"} // Error when an internal error occurs.
+ ErrOpNotSupported = &cli.Error{"Op not supported"} // Error when the operation is not supported.
+ // Mapping between the operation status and the corresponding errors.
errorMapping = map[proto.OpStatus]error{
- proto.OpStatusNoError: nil,
- proto.OpStatusInconsistent: nil,
- proto.OpStatusBadMsg: ErrBadMsg,
- proto.OpStatusNoKey: ErrNoKey,
- proto.OpStatusDupKey: ErrUniqueKeyViolation,
- proto.OpStatusNoStorageServer: ErrNoStorage,
- proto.OpStatusBadParam: ErrBadParam,
- proto.OpStatusRecordLocked: ErrRecordLocked,
- proto.OpStatusVersionConflict: ErrConditionViolation,
- proto.OpStatusSSReadTTLExtendErr: ErrTTLExtendFailure,
- proto.OpStatusCommitFailure: ErrWriteFailure,
- proto.OpStatusBusy: ErrBusy,
- proto.OpStatusNotSupported: ErrOpNotSupported,
+ proto.OpStatusNoError: nil, // Status when there is no error.
+ proto.OpStatusInconsistent: nil, // Status when there is an inconsistency.
+ proto.OpStatusBadMsg: ErrBadMsg, // Status when a bad message is received.
+ proto.OpStatusNoKey: ErrNoKey, // Status when the key is not present.
+ proto.OpStatusDupKey: ErrUniqueKeyViolation, // Status when unique key constraint is violated.
+ proto.OpStatusNoStorageServer: ErrNoStorage, // Status when there is no storage server available.
+ proto.OpStatusBadParam: ErrBadParam, // Status when a bad parameter is passed.
+ proto.OpStatusRecordLocked: ErrRecordLocked, // Status when a record is locked.
+ proto.OpStatusVersionConflict: ErrConditionViolation, // Status when there is a version conflict.
+ proto.OpStatusSSReadTTLExtendErr: ErrTTLExtendFailure, // Status when TTL extension fails.
+ proto.OpStatusCommitFailure: ErrWriteFailure, // Status when a commit operation fails.
+ proto.OpStatusBusy: ErrBusy, // Status when the server is busy.
+ proto.OpStatusNotSupported: ErrOpNotSupported, // Status when the operation is not supported.
}
}
diff --git a/pkg/client/example_test.go b/pkg/client/example_test.go
index ebb7a991..2e1a8985 100644
--- a/pkg/client/example_test.go
+++ b/pkg/client/example_test.go
@@ -22,7 +22,7 @@ package client_test
import (
"fmt"
- "juno/pkg/client"
+ "github.com/paypal/junodb/pkg/client"
)
func Example_config() {
diff --git a/pkg/client/option.go b/pkg/client/option.go
index 849400b2..2e77f42c 100644
--- a/pkg/client/option.go
+++ b/pkg/client/option.go
@@ -17,16 +17,19 @@
// limitations under the License.
//
+// Package client provides functionalities for client configurations.
package client
import ()
+// optionData struct contains client options.
type optionData struct {
- ttl uint32
- context IContext
- correlationId string
+ ttl uint32 // Time to live value.
+ context IContext // Client context.
+ correlationId string // Correlation ID for tracking.
}
+// IOption type represents a function that applies options on optionData.
//type IOption interface {
// Apply(data *optionData) error
//}
@@ -46,34 +49,41 @@ type optionData struct {
type IOption func(data interface{})
+// WithTTL function returns an IOption that sets a TTL value.
func WithTTL(ttl uint32) IOption {
return func(i interface{}) {
+ // Check if the passed interface can be casted to *optionData
if data, ok := i.(*optionData); ok {
- data.ttl = ttl
+ data.ttl = ttl // Set the TTL value.
}
}
}
+// WithCond function returns an IOption that sets a context.
func WithCond(context IContext) IOption {
return func(i interface{}) {
+ // Check if the passed interface can be casted to *optionData
if data, ok := i.(*optionData); ok {
- data.context = context
+ data.context = context // Set the context.
}
}
}
+// WithCorrelationId function returns an IOption that sets a correlationId.
func WithCorrelationId(id string) IOption {
return func(i interface{}) {
+ // Check if the passed interface can be casted to *optionData
if data, ok := i.(*optionData); ok {
- data.correlationId = id
+ data.correlationId = id // Set the correlation ID.
}
}
}
+// newOptionData function applies the options passed in and returns an initialized optionData.
func newOptionData(opts ...IOption) *optionData {
- data := &optionData{}
+ data := &optionData{} // Initialize a new optionData.
for _, op := range opts {
- op(data)
+ op(data) // Apply each option on the optionData.
}
- return data
+ return data // Return the initialized optionData.
}
diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go
index 3b0827d7..57087fbe 100644
--- a/pkg/cluster/cluster.go
+++ b/pkg/cluster/cluster.go
@@ -32,7 +32,7 @@ import (
"syscall"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
"github.com/BurntSushi/toml"
)
diff --git a/pkg/cluster/clusterstats.go b/pkg/cluster/clusterstats.go
index 804c5134..058c4209 100644
--- a/pkg/cluster/clusterstats.go
+++ b/pkg/cluster/clusterstats.go
@@ -21,11 +21,13 @@ package cluster
import (
"fmt"
+ "strings"
"sync"
"time"
+ "github.com/paypal/junodb/pkg/util"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/pkg/logging/otel"
- "juno/pkg/util"
- "juno/third_party/forked/golang/glog"
)
type ProcStat struct {
@@ -180,6 +182,8 @@ func (c *ClusterStats) processStateChange(st *ProcStat) {
c.MarkdownTable[idx] = true
glog.Infof("markdown: node %d-%d, exp:%d, timout ct: %d",
st.zoneid, st.nodeid, c.MarkdownExpiration[idx], timeoutCnt)
+ targetSS := getIP(st.zoneid, st.nodeid)
+ otel.RecordCount(otel.SoftMark, []otel.Tags{{otel.Target, targetSS}, {otel.Status, otel.SSMarkDown}})
}
}
@@ -194,6 +198,20 @@ func (c *ClusterStats) processStateChange(st *ProcStat) {
}
}
+func getIP(zoneid uint32, nodeid uint32) string {
+ shardMgr := GetShardMgr()
+ // First check if the connInfo has the element.
+ if len(shardMgr.connInfo) < int(zoneid+1) || len(shardMgr.connInfo[zoneid]) < int(nodeid+1) {
+ return ""
+ }
+ i := strings.Index(shardMgr.connInfo[zoneid][nodeid], ":")
+
+ if i < 0 {
+ return shardMgr.connInfo[zoneid][nodeid]
+ }
+ return shardMgr.connInfo[zoneid][nodeid][:i]
+}
+
// Naive way of doing markup: markdown expired.
// Potentially can add probe logic so that we markup only if it's in good state.
func (c *ClusterStats) markup() {
@@ -215,6 +233,8 @@ func (c *ClusterStats) markup() {
glog.Infof("markup: host %d-%d", i, j)
c.MarkdownExpiration[idx] = 0
c.MarkdownTable[idx] = false
+ targetSS := getIP(i, j)
+ otel.RecordCount(otel.SoftMark, []otel.Tags{{otel.Target, targetSS}, {otel.Status, otel.SSMarkUp}})
}
}
}
diff --git a/pkg/cluster/lock_linux.go b/pkg/cluster/lock_linux.go
index e9188f3d..2c541515 100644
--- a/pkg/cluster/lock_linux.go
+++ b/pkg/cluster/lock_linux.go
@@ -20,8 +20,9 @@
package cluster
import (
- "juno/third_party/forked/golang/glog"
"syscall"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
func lockFile(fd int, mode int) bool {
diff --git a/pkg/cluster/node.go b/pkg/cluster/node.go
index 5451ce86..d9ed0c6c 100644
--- a/pkg/cluster/node.go
+++ b/pkg/cluster/node.go
@@ -26,7 +26,7 @@ import (
"strconv"
"strings"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
// Node class represent a logic node
diff --git a/pkg/cluster/shardmgr.go b/pkg/cluster/shardmgr.go
index 1d578316..78fa381b 100644
--- a/pkg/cluster/shardmgr.go
+++ b/pkg/cluster/shardmgr.go
@@ -28,14 +28,14 @@ import (
"sync/atomic"
"time"
- "juno/third_party/forked/golang/glog"
-
- "juno/pkg/io"
- "juno/pkg/logging"
- "juno/pkg/logging/cal"
- "juno/pkg/logging/otel"
- "juno/pkg/shard"
- "juno/pkg/util"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/logging/otel"
+ "github.com/paypal/junodb/pkg/shard"
+ "github.com/paypal/junodb/pkg/util"
)
var (
@@ -338,8 +338,8 @@ func (p *ShardManager) GetSSProcessor(zoneId int, nodeId int) *OutboundSSProcess
return p.processors[zoneId][nodeId]
}
-//used by request processor
-//the caller's responsibility to make sure
+// used by request processor
+// the caller's responsibility to make sure
// cap(procs) >= numZones and cap(pos) >= numZones
func (p *ShardManager) GetSSProcessors(key []byte, confNumWrites int, procs []*OutboundSSProcessor, pos []int) (shardId shard.ID, numProcs int) {
@@ -759,9 +759,9 @@ func (p *OutboundSSProcessor) GetNodeInfo() (zoneid int, hostid int) {
}
func (p *OutboundSSProcessor) OnConnectSuccess(conn io.Conn, connector *io.OutboundConnector, timeTaken time.Duration) {
+ netConn := conn.GetNetConn()
if cal.IsEnabled() {
b := logging.NewKVBuffer()
- netConn := conn.GetNetConn()
b.Add([]byte("raddr"), netConn.RemoteAddr().String())
b.Add([]byte("laddr"), netConn.LocalAddr().String())
@@ -771,10 +771,9 @@ func (p *OutboundSSProcessor) OnConnectSuccess(conn io.Conn, connector *io.Outbo
cal.AtomicTransaction(logging.CalMsgTypeSSConnect, p.Name(), cal.StatusSuccess, timeTaken, b.Bytes())
}
- if otel.IsEnabled() {
- netConn := conn.GetNetConn()
- otel.RecordSSConnection(netConn.RemoteAddr().String(), otel.StatusSuccess, timeTaken.Milliseconds())
- }
+
+ otel.RecordSSConnection(getIPAddress(netConn.RemoteAddr().String()), otel.StatusSuccess, timeTaken.Microseconds())
+
}
func (p *OutboundSSProcessor) OnConnectError(timeTaken time.Duration, connStr string, err error) {
@@ -784,9 +783,14 @@ func (p *OutboundSSProcessor) OnConnectError(timeTaken time.Duration, connStr st
b.Add([]byte("err"), err.Error())
cal.AtomicTransaction(logging.CalMsgTypeSSConnectError, p.Name(), cal.StatusSuccess, timeTaken, b.Bytes())
}
- if otel.IsEnabled() {
- otel.RecordSSConnection(connStr, otel.StatusError, timeTaken.Milliseconds())
- }
+
+ otel.RecordSSConnection(getIPAddress(connStr), otel.StatusError, timeTaken.Microseconds())
+
+}
+
+func getIPAddress(endpoint string) string {
+ s := strings.Split(endpoint, ":")
+ return s[0]
}
func (m *ZoneMarkDown) MarkDown(zoneid int32) {
diff --git a/pkg/cluster/util.go b/pkg/cluster/util.go
index 50f3220d..50c9f0cb 100644
--- a/pkg/cluster/util.go
+++ b/pkg/cluster/util.go
@@ -22,7 +22,7 @@ package cluster
import (
"fmt"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
func DisplayZones(zones []*Zone, header string) {
diff --git a/pkg/cluster/zone.go b/pkg/cluster/zone.go
index 0de13647..7fa97aca 100644
--- a/pkg/cluster/zone.go
+++ b/pkg/cluster/zone.go
@@ -23,7 +23,7 @@ import (
"fmt"
"sort"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
// Node class represent a logic node
diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go
index 2859cb76..aa405968 100644
--- a/pkg/cmd/cmd.go
+++ b/pkg/cmd/cmd.go
@@ -30,9 +30,9 @@ import (
"strings"
"text/tabwriter"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/version"
+ "github.com/paypal/junodb/pkg/version"
)
var (
diff --git a/pkg/etcd/config.go b/pkg/etcd/config.go
index a89f4c62..0aea1c02 100644
--- a/pkg/etcd/config.go
+++ b/pkg/etcd/config.go
@@ -24,7 +24,7 @@ import (
clientv3 "go.etcd.io/etcd/client/v3"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/util"
)
var (
diff --git a/pkg/etcd/etcd.go b/pkg/etcd/etcd.go
index 8fdd8d19..65e0d1d6 100644
--- a/pkg/etcd/etcd.go
+++ b/pkg/etcd/etcd.go
@@ -21,8 +21,9 @@ package etcd
import (
"errors"
- "juno/third_party/forked/golang/glog"
"sync"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
var (
diff --git a/pkg/etcd/etcdclient.go b/pkg/etcd/etcdclient.go
index 770c7de2..26c873b4 100644
--- a/pkg/etcd/etcdclient.go
+++ b/pkg/etcd/etcdclient.go
@@ -32,7 +32,7 @@ import (
clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/client/v3/namespace"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
var (
diff --git a/pkg/etcd/etcdreader.go b/pkg/etcd/etcdreader.go
index 00cead95..93bb0db9 100644
--- a/pkg/etcd/etcdreader.go
+++ b/pkg/etcd/etcdreader.go
@@ -28,11 +28,11 @@ import (
"strings"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/cluster"
- "juno/pkg/shard"
- "juno/pkg/stats/redist"
+ "github.com/paypal/junodb/pkg/cluster"
+ "github.com/paypal/junodb/pkg/shard"
+ "github.com/paypal/junodb/pkg/stats/redist"
)
// Implements cluster.IReader
diff --git a/pkg/etcd/etcdwriter.go b/pkg/etcd/etcdwriter.go
index 5bf10b10..d9a963c2 100644
--- a/pkg/etcd/etcdwriter.go
+++ b/pkg/etcd/etcdwriter.go
@@ -25,9 +25,9 @@ import (
"strconv"
"strings"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/cluster"
+ "github.com/paypal/junodb/pkg/cluster"
)
type IKVWriter interface {
diff --git a/pkg/initmgr/init.go b/pkg/initmgr/init.go
index 01092d9b..1818b276 100644
--- a/pkg/initmgr/init.go
+++ b/pkg/initmgr/init.go
@@ -32,8 +32,8 @@ import (
"syscall"
"time"
- "juno/pkg/logging"
- "juno/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/logging/cal"
)
var (
diff --git a/pkg/io/conn.go b/pkg/io/conn.go
index 226810f8..e5f98eb3 100644
--- a/pkg/io/conn.go
+++ b/pkg/io/conn.go
@@ -24,16 +24,19 @@ import (
"net"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/logging"
- "juno/pkg/logging/cal"
- "juno/pkg/logging/otel"
- "juno/pkg/sec"
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/logging/otel"
+ "github.com/paypal/junodb/pkg/sec"
)
type Conn interface {
GetStateString() string
+ GetTLSVersion() string
+ GetCipherName() string
+ DidResume() string
GetNetConn() net.Conn
IsTLS() bool
}
@@ -51,6 +54,17 @@ func (c *Connection) GetStateString() string {
return ""
}
+func (c *Connection) GetTLSVersion() string {
+ return ""
+}
+
+func (c *Connection) GetCipherName() string {
+ return ""
+}
+
+func (c *Connection) DidResume() string {
+ return ""
+}
func (c *Connection) GetNetConn() net.Conn {
return c.conn
}
@@ -91,13 +105,15 @@ func Connect(endpoint *ServiceEndpoint, connectTimeout time.Duration) (conn net.
cal.AtomicTransaction(cal.TxnTypeConnect, endpoint.Addr, status, time.Since(timeStart), b.Bytes())
}
}
- if otel.IsEnabled() {
- status := otel.StatusSuccess
- if err != nil {
- status = otel.StatusError
- }
- otel.RecordOutboundConnection(endpoint.Addr, status, time.Since(timeStart).Milliseconds())
+ status := otel.StatusSuccess
+
+ if err != nil {
+ status = otel.StatusError
+ } else {
+ otel.RecordCount(otel.TLSStatus, []otel.Tags{{otel.Endpoint, endpoint.Addr}, {otel.TLS_version, sslconn.GetTLSVersion()},
+ {otel.Cipher, sslconn.GetCipherName()}, {otel.Ssl_r, sslconn.DidResume()}})
}
+ otel.RecordOutboundConnection(endpoint.Addr, status, time.Since(timeStart).Microseconds())
} else {
if conn, err = net.DialTimeout("tcp", endpoint.Addr, connectTimeout); err == nil {
if glog.LOG_DEBUG {
@@ -115,13 +131,11 @@ func Connect(endpoint *ServiceEndpoint, connectTimeout time.Duration) (conn net.
}
cal.AtomicTransaction(cal.TxnTypeConnect, endpoint.GetConnString(), status, time.Since(timeStart), data)
}
- if otel.IsEnabled() {
- status := otel.StatusSuccess
- if err != nil {
- status = otel.StatusError
- }
- otel.RecordOutboundConnection(endpoint.GetConnString(), status, time.Since(timeStart).Milliseconds())
+ status := otel.StatusSuccess
+ if err != nil {
+ status = otel.StatusError
}
+ otel.RecordOutboundConnection(endpoint.GetConnString(), status, time.Since(timeStart).Microseconds())
}
return
diff --git a/pkg/io/connmgr.go b/pkg/io/connmgr.go
index f44f1c6a..c2250841 100644
--- a/pkg/io/connmgr.go
+++ b/pkg/io/connmgr.go
@@ -23,7 +23,7 @@ import (
"sync"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
type InboundConnManager struct {
diff --git a/pkg/io/inboundconnector.go b/pkg/io/inboundconnector.go
index bfc8a862..bc477cd0 100644
--- a/pkg/io/inboundconnector.go
+++ b/pkg/io/inboundconnector.go
@@ -29,13 +29,13 @@ import (
"sync/atomic"
"time"
- "juno/third_party/forked/golang/glog"
-
- "juno/pkg/debug"
- "juno/pkg/io/ioutil"
- "juno/pkg/logging/cal"
- "juno/pkg/proto"
- "juno/pkg/util"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/pkg/debug"
+ "github.com/paypal/junodb/pkg/io/ioutil"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/util"
+ "github.com/paypal/junodb/pkg/logging/otel"
)
type Connector struct {
@@ -83,6 +83,7 @@ func (c *Connector) Close() {
cal.Event(cal.TxnTypeClose, rhost, cal.StatusSuccess, []byte(addr))
}
}
+ otel.RecordCount(otel.Close, []otel.Tags{})
c.cancelCtx()
})
}
diff --git a/pkg/io/ioconfig.go b/pkg/io/ioconfig.go
index 107b8253..6aae8148 100644
--- a/pkg/io/ioconfig.go
+++ b/pkg/io/ioconfig.go
@@ -22,7 +22,7 @@ package io
import (
"time"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/util"
)
var (
diff --git a/pkg/io/ioutil/logerr.go b/pkg/io/ioutil/logerr.go
index 5af8f8f5..63568e48 100644
--- a/pkg/io/ioutil/logerr.go
+++ b/pkg/io/ioutil/logerr.go
@@ -25,7 +25,7 @@ import (
"os"
"syscall"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
func LogError(err error) {
diff --git a/pkg/io/listener.go b/pkg/io/listener.go
index c93f3fba..ae43d305 100644
--- a/pkg/io/listener.go
+++ b/pkg/io/listener.go
@@ -25,10 +25,10 @@ import (
"os"
"time"
- "juno/pkg/logging/cal"
- "juno/pkg/logging/otel"
- "juno/pkg/util"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/logging/otel"
+ "github.com/paypal/junodb/pkg/util"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
const (
@@ -148,10 +148,10 @@ func (l *Listener) AcceptAndServe() error {
cal.Event(cal.TxnTypeAccept, rhost, cal.StatusSuccess, []byte("raddr="+raddr+"&laddr="+conn.LocalAddr().String()))
}
}
- if otel.IsEnabled() {
- otel.RecordCount(otel.Accept, nil)
- }
+ otel.RecordCount(otel.Accept, []otel.Tags{{otel.Status, otel.Success}})
l.startNewConnector(conn)
+ } else {
+ otel.RecordCount(otel.Accept, []otel.Tags{{otel.Status, otel.Error}})
}
//log the error in caller if needed
return err
diff --git a/pkg/io/mayflyreqctx.go b/pkg/io/mayflyreqctx.go
index 8cf0a1f7..386896f9 100644
--- a/pkg/io/mayflyreqctx.go
+++ b/pkg/io/mayflyreqctx.go
@@ -26,13 +26,13 @@ import (
"io"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/logging"
- "juno/pkg/logging/cal"
- "juno/pkg/proto"
- "juno/pkg/proto/mayfly"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/proto/mayfly"
+ "github.com/paypal/junodb/pkg/util"
)
type (
diff --git a/pkg/io/outboundconnector.go b/pkg/io/outboundconnector.go
index db737560..5449405d 100644
--- a/pkg/io/outboundconnector.go
+++ b/pkg/io/outboundconnector.go
@@ -31,13 +31,13 @@ import (
"sync/atomic"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/io/ioutil"
- "juno/pkg/logging/cal"
- "juno/pkg/proto"
- "juno/pkg/proto/mayfly"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/io/ioutil"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/proto/mayfly"
+ "github.com/paypal/junodb/pkg/util"
)
const (
diff --git a/pkg/io/outboundprocessor.go b/pkg/io/outboundprocessor.go
index 48fcbf28..102299a1 100644
--- a/pkg/io/outboundprocessor.go
+++ b/pkg/io/outboundprocessor.go
@@ -28,14 +28,14 @@ import (
"sync/atomic"
"time"
- "juno/third_party/forked/golang/glog"
-
- "juno/pkg/errors"
- "juno/pkg/logging"
- "juno/pkg/logging/cal"
- "juno/pkg/logging/otel"
- "juno/pkg/proto"
- "juno/pkg/util"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+
+ "github.com/paypal/junodb/pkg/errors"
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/logging/otel"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/util"
)
type (
@@ -114,9 +114,7 @@ func (p *OutboundProcessor) GetRequestCh() chan IRequestContext {
return p.reqCh
}
-//
// Non-blocking send
-//
func (p *OutboundProcessor) sendRequest(req IRequestContext) (err *errors.Error) {
// send request
select {
@@ -314,18 +312,16 @@ func (p *OutboundProcessor) OnConnectSuccess(conn Conn, connector *OutboundConne
cal.AtomicTransaction(cal.TxnTypeConnect, p.connInfo.GetConnString(), cal.StatusSuccess, timeTaken, data)
}
- if otel.IsEnabled() {
- otel.RecordOutboundConnection(p.connInfo.GetConnString(), otel.StatusSuccess, timeTaken.Milliseconds())
- }
+ otel.RecordOutboundConnection(p.connInfo.GetConnString(), otel.StatusSuccess, timeTaken.Microseconds())
+ otel.RecordCount(otel.TLSStatus, []otel.Tags{{otel.Endpoint, p.connInfo.GetConnString()}, {otel.TLS_version, conn.GetTLSVersion()},
+ {otel.Cipher, conn.GetCipherName()}, {otel.Ssl_r, conn.DidResume()}})
}
func (p *OutboundProcessor) OnConnectError(timeTaken time.Duration, connStr string, err error) {
if cal.IsEnabled() {
cal.AtomicTransaction(cal.TxnTypeConnect, connStr, cal.StatusError, timeTaken, []byte(err.Error()))
}
- if otel.IsEnabled() {
- otel.RecordOutboundConnection(connStr, otel.StatusError, timeTaken.Milliseconds())
- }
+ otel.RecordOutboundConnection(connStr, otel.StatusError, timeTaken.Microseconds())
}
func (p *OutboundProcessor) connect(connCh chan *OutboundConnector, id int, connector *OutboundConnector) {
diff --git a/pkg/io/requestcontext.go b/pkg/io/requestcontext.go
index 25c06f24..96cf9cd5 100644
--- a/pkg/io/requestcontext.go
+++ b/pkg/io/requestcontext.go
@@ -26,11 +26,11 @@ import (
"io"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/proto"
- "juno/pkg/proto/mayfly"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/proto/mayfly"
+ "github.com/paypal/junodb/pkg/util"
)
var oResponsePool = util.NewChanPool(10000, func() interface{} {
diff --git a/pkg/io/ssllistener.go b/pkg/io/ssllistener.go
index db623292..157411fc 100644
--- a/pkg/io/ssllistener.go
+++ b/pkg/io/ssllistener.go
@@ -26,11 +26,11 @@ import (
"syscall"
"time"
- "juno/third_party/forked/golang/glog"
-
- "juno/pkg/logging"
- "juno/pkg/logging/cal"
- "juno/pkg/sec"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/sec"
+ "github.com/paypal/junodb/pkg/logging/otel"
)
type SslListener struct {
@@ -66,6 +66,8 @@ func (l *SslListener) AcceptAndServe() error {
cal.Event(cal.TxnTypeAccept, rhost, cal.StatusSuccess, b.Bytes())
}
}
+ otel.RecordCount(otel.Accept, []otel.Tags{{otel.Status, otel.Success}, {otel.TLS_version, sslConn.GetTLSVersion()},
+ {otel.Cipher, sslConn.GetCipherName()}, {otel.Ssl_r, sslConn.DidResume()}})
l.startNewConnector(sslConn.GetNetConn())
} else {
logAsWarning := true
@@ -95,6 +97,15 @@ func (l *SslListener) AcceptAndServe() error {
cal.Event(cal.TxnTypeAccept, rhost, st, b.Bytes())
}
}
+
+ otelStatus := otel.Success
+ if logAsWarning {
+ otelStatus = otel.Warn
+ }
+
+ otel.RecordCount(otel.Accept, []otel.Tags{{otel.Status, otelStatus}, {otel.TLS_version, sslConn.GetTLSVersion()},
+ {otel.Cipher, sslConn.GetCipherName()}, {otel.Ssl_r, sslConn.DidResume()}})
+
if logAsWarning {
glog.Warning("handshaking error: ", err)
} else {
diff --git a/pkg/logging/cal/config/calconfig.go b/pkg/logging/cal/config/calconfig.go
index 993c8471..12cf3dc0 100644
--- a/pkg/logging/cal/config/calconfig.go
+++ b/pkg/logging/cal/config/calconfig.go
@@ -20,7 +20,7 @@
package config
import (
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
var CalConfig *Config
diff --git a/pkg/logging/cal/logger.go b/pkg/logging/cal/logger.go
index d0a8b4a6..dcd6cb49 100644
--- a/pkg/logging/cal/logger.go
+++ b/pkg/logging/cal/logger.go
@@ -27,11 +27,11 @@ import (
"strings"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/logging/cal/config"
- "juno/pkg/logging/cal/net/io"
- "juno/pkg/logging/cal/net/protocol"
+ "github.com/paypal/junodb/pkg/logging/cal/config"
+ "github.com/paypal/junodb/pkg/logging/cal/net/io"
+ "github.com/paypal/junodb/pkg/logging/cal/net/protocol"
)
// CAL message Status field values
@@ -126,7 +126,7 @@ func LogAtomicTransaction(txnType, eventName, status string, duration time.Durat
client.Send(msg)
}
-//SendEvent logs an event of eventType with a sub-classification of
+// SendEvent logs an event of eventType with a sub-classification of
// eventName. The event may optionally contain extra eventData.
func LogEvent(eventType, eventName, status string, eventData map[string]interface{}) {
// TODO guard against bad eventType/eventName (perhaps in NewMsg())
diff --git a/pkg/logging/cal/net/io/client.go b/pkg/logging/cal/net/io/client.go
index a735200e..38137347 100644
--- a/pkg/logging/cal/net/io/client.go
+++ b/pkg/logging/cal/net/io/client.go
@@ -32,11 +32,11 @@ import (
"sync/atomic"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/logging/cal/config"
- "juno/pkg/logging/cal/net/protocol"
- "juno/pkg/logging/cal/util"
+ "github.com/paypal/junodb/pkg/logging/cal/config"
+ "github.com/paypal/junodb/pkg/logging/cal/net/protocol"
+ "github.com/paypal/junodb/pkg/logging/cal/util"
)
var logFile *os.File
@@ -259,9 +259,7 @@ func (c *client) sendFileLoop() {
}
}
-//
// Sender need to make should not send message after Shutdown()
-//
func (c *client) Send(m *protocol.CalMessage) {
if m == nil {
glog.V(2).Info("Cal: Message can not be nil.")
@@ -282,7 +280,7 @@ func (c *client) Send(m *protocol.CalMessage) {
}
}
-//If you close client connection you wouldnt be able to log anything using logger.
+// If you close client connection you wouldnt be able to log anything using logger.
// This should be called when parent process Shutdown.
func (c *client) Shutdown() {
c.closeOnce.Do(func() {
@@ -307,7 +305,7 @@ func (c *client) Shutdown() {
})
}
-//Flush blocks till the messages are processed by the channel
+// Flush blocks till the messages are processed by the channel
func (c *client) Flush() {
c.wg.Wait()
if logFile != nil {
diff --git a/pkg/logging/cal/net/io/clientapi.go b/pkg/logging/cal/net/io/clientapi.go
index fd0155ef..c9105393 100644
--- a/pkg/logging/cal/net/io/clientapi.go
+++ b/pkg/logging/cal/net/io/clientapi.go
@@ -21,10 +21,11 @@ package io
import (
"bufio"
- "juno/pkg/logging/cal/net/protocol"
"net"
"sync"
"sync/atomic"
+
+ "github.com/paypal/junodb/pkg/logging/cal/net/protocol"
)
// Client is a CAL client. It is used to configure and organize
diff --git a/pkg/logging/cal/net/protocol/message.go b/pkg/logging/cal/net/protocol/message.go
index f096318c..1ebb2896 100644
--- a/pkg/logging/cal/net/protocol/message.go
+++ b/pkg/logging/cal/net/protocol/message.go
@@ -22,11 +22,12 @@ package protocol
import (
"bytes"
"fmt"
- "juno/third_party/forked/golang/glog"
"strconv"
"strings"
"time"
"unicode"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
// Msg is a single log message.
diff --git a/pkg/logging/cal/test/main.go b/pkg/logging/cal/test/main.go
index 9d107065..75b2e0fb 100644
--- a/pkg/logging/cal/test/main.go
+++ b/pkg/logging/cal/test/main.go
@@ -20,21 +20,21 @@
package main
import (
- "juno/pkg/logging/cal"
- logger "juno/pkg/logging/cal"
- "juno/pkg/logging/cal/config"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ logger "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/logging/cal/config"
"github.com/BurntSushi/toml"
- //"juno/pkg/logging/cal/config"
+ //"github.com/paypal/junodb/pkg/logging/cal/config"
"flag"
"fmt"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
//"io"
// "log"
- //"juno/pkg/logging/cal/net/protocol"
+ //"github.com/paypal/junodb/pkg/logging/cal/net/protocol"
//"os"
// "runtime"
// "net/http"
diff --git a/pkg/logging/cal/util/util.go b/pkg/logging/cal/util/util.go
index c5760ea0..c2919beb 100644
--- a/pkg/logging/cal/util/util.go
+++ b/pkg/logging/cal/util/util.go
@@ -22,13 +22,14 @@ package util
import (
"fmt"
"hash/fnv"
- "juno/pkg/logging/cal/net/protocol"
"net"
"os"
"path"
"runtime"
"strconv"
"time"
+
+ "github.com/paypal/junodb/pkg/logging/cal/net/protocol"
)
const (
diff --git a/pkg/logging/calstatus.go b/pkg/logging/calstatus.go
index 8ff37d8a..4e89d1f7 100644
--- a/pkg/logging/calstatus.go
+++ b/pkg/logging/calstatus.go
@@ -20,8 +20,8 @@
package logging
import (
- "juno/pkg/logging/cal"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/proto"
)
type Status int
diff --git a/pkg/logging/logging.go b/pkg/logging/logging.go
index 061cc7bd..b219aeec 100644
--- a/pkg/logging/logging.go
+++ b/pkg/logging/logging.go
@@ -26,11 +26,11 @@ import (
"strconv"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/logging/cal"
- "juno/pkg/proto"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/util"
)
type KeyValueBuffer struct {
@@ -360,7 +360,7 @@ func (b *KeyValueBuffer) AddOpRequestInfo(request *proto.OperationalMessage) *Ke
return b
}
-//difference from AddOpRequestInfo(): namespace and key not logged
+// difference from AddOpRequestInfo(): namespace and key not logged
func (b *KeyValueBuffer) AddOpRequest(request *proto.OperationalMessage) *KeyValueBuffer {
b.Add(logDataKeyRid, request.GetRequestIDString())
reqParam := &KeyValueBuffer{delimiter: ':', pairDelimiter: '|'}
diff --git a/pkg/logging/otel/config/otelconfig.go b/pkg/logging/otel/config/otelconfig.go
index 458dc90a..6f305c11 100644
--- a/pkg/logging/otel/config/otelconfig.go
+++ b/pkg/logging/otel/config/otelconfig.go
@@ -1,50 +1,54 @@
+// Copyright 2023 PayPal Inc.
//
-// Copyright 2023 PayPal Inc.
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+// http://www.apache.org/licenses/LICENSE-2.0
//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package config
import (
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
var OtelConfig *Config
+type HistBuckets struct {
+ Replication []float64
+ SsConnect []float64
+ Inbound []float64
+ OutboundConnection []float64
+}
+
type Config struct {
- Host string
- Port uint32
- Environment string
- Poolname string
- Enabled bool
- Resolution uint32
- UseTls bool
+ Host string
+ Port uint32
+ UrlPath string
+ Environment string
+ Poolname string
+ Enabled bool
+ Resolution uint32
+ UseTls bool
+ HistogramBuckets HistBuckets
}
func (c *Config) Validate() {
if len(c.Poolname) <= 0 {
glog.Fatal("Error: Otel Poolname is required.")
}
+ c.setDefaultIfNotDefined()
}
-func (c *Config) SetPoolName(name string) {
- c.Poolname = name
-}
-
-func (c *Config) Default() {
+func (c *Config) setDefaultIfNotDefined() {
if c.Host == "" {
c.Host = "127.0.0.1"
}
@@ -55,7 +59,22 @@ func (c *Config) Default() {
c.Resolution = 60
}
if c.Environment == "" {
- c.Environment = "OpenSource"
+ c.Environment = "PayPal"
+ }
+ if c.UrlPath == "" {
+ c.UrlPath = "v1/datapoint"
+ }
+ if c.HistogramBuckets.Inbound == nil {
+ c.HistogramBuckets.Inbound = []float64{200, 400, 800, 1200, 2400, 3600, 7200, 10800, 21600, 43200, 86400, 172800}
+ }
+ if c.HistogramBuckets.OutboundConnection == nil {
+ c.HistogramBuckets.OutboundConnection = []float64{200, 400, 800, 1200, 2400, 3600, 7200, 10800, 21600, 43200, 86400, 172800}
+ }
+ if c.HistogramBuckets.Replication == nil {
+ c.HistogramBuckets.Replication = []float64{200, 400, 800, 1200, 2400, 3600, 7200, 10800, 21600, 43200, 86400, 172800}
+ }
+ if c.HistogramBuckets.SsConnect == nil {
+ c.HistogramBuckets.SsConnect = []float64{100, 200, 300, 400, 800, 1200, 2400, 3600, 10800, 21600, 86400, 172800}
}
}
@@ -65,5 +84,10 @@ func (c *Config) Dump() {
glog.Infof("Environment: %s", c.Environment)
glog.Infof("Poolname: %s", c.Poolname)
glog.Infof("Resolution: %d", c.Resolution)
- glog.Info("UseTls: %b", c.UseTls)
+ glog.Infof("UseTls: %t", c.UseTls)
+ glog.Infof("UrlPath: %s", c.UrlPath)
+ glog.Info("Inbound Bucket: ", c.HistogramBuckets.Inbound)
+ glog.Info("OutboundConnection Bucket: ", c.HistogramBuckets.OutboundConnection)
+ glog.Info("Replication Bucket: ", c.HistogramBuckets.Replication)
+ glog.Info("SsConnect Bucket: ", c.HistogramBuckets.SsConnect)
}
diff --git a/pkg/logging/otel/defs.go b/pkg/logging/otel/defs.go
new file mode 100644
index 00000000..7421864b
--- /dev/null
+++ b/pkg/logging/otel/defs.go
@@ -0,0 +1,267 @@
+//
+// Copyright 2023 PayPal Inc.
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+package otel
+
+import (
+ "sync"
+ "time"
+
+ instrument "go.opentelemetry.io/otel/metric"
+ "go.opentelemetry.io/otel/sdk/metric"
+)
+
+//*************************** Constants ****************************
+const (
+ RRDropMaxRetry CMetric = CMetric(iota)
+ RRDropQueueFull
+ RRDropRecExpired
+ SSL_CLIENT_INFO
+ CLIENT_INFO
+ Accept
+ Close
+ RAPI
+ ReqProc
+ ProcErr
+ SoftMark
+ TLSStatus
+ Inbound
+ Replication
+ OutboundConnection
+ SSConnection
+)
+
+const (
+ Target = string("target")
+ Endpoint = string("target_ip_port")
+ Operation = string("operation")
+ Client = string("client_app")
+ Status = string("status")
+ Fatal = string("Fatal")
+ Error = string("Error")
+ Warn = string("Warning")
+ Success = string("Success")
+ SS_RB_expire = string("SS_RB_expire")
+ SSReqTimeout = string("SSReqTimeout")
+ SSMarkDown = string("Down")
+ SSMarkUp = string("Up")
+ TLS_version = string("tls_version")
+ Cipher = string("cipher")
+ Ssl_r = string("ssl_r")
+)
+
+const (
+ SvrTypeProxy = ServerType(1)
+ SvrTypeStorage = ServerType(2)
+ SvrTypeClusterMgr = ServerType(3)
+ SvrTypeAll = ServerType(6)
+)
+
+// OTEl Status
+const (
+ StatusSuccess string = "SUCCESS"
+ StatusFatal string = "FATAL"
+ StatusError string = "ERROR"
+ StatusWarning string = "WARNING"
+ StatusUnknown string = "UNKNOWN"
+)
+
+const (
+ MachineCpuUsed string = string("machineCpuUsed")
+ ProcessCpuUsed string = string("machineCpuUsed")
+ MachineMemoryUsed
+ ProcessMemoryUsed
+)
+
+// default OTEL configurations point to QA collector
+const DEFAULT_OTEL_COLLECTOR_PROTOCOL string = "http"
+const DEFAULT_OTEL_COLLECTOR__IP string = "0.0.0.0"
+const DEFAULT_GRPC_OTEL_COLLECTOR_PORT string = "4317"
+const DEFAULT_HTTP_OTEL_COLLECTOR_PORT string = "4318"
+const COLLECTOR_POLLING_INTERVAL_SECONDS int32 = 5
+
+const JUNO_METRIC_PREFIX = "juno.server."
+const MeterName = "juno-server-meter"
+const histChannelSize = 1000
+const counterChannelSize = 1000
+
+//****************************** variables ***************************
+
+var (
+ apiHistogramOnce sync.Once
+ replicationHistogramOnce sync.Once
+ connectHistogramOnce sync.Once
+ ssConnectHistogramOnce sync.Once
+ rrDropMaxRetryCounterOnce sync.Once
+ rrDropQueueFullCounterOnce sync.Once
+ rrDropRecExpiredCounterOnce sync.Once
+ acceptCounterOnce sync.Once
+ closeCounterOnce sync.Once
+ rapiCounterOnce sync.Once
+ reqProcCounterOnce sync.Once
+ procErrCounterOnce sync.Once
+ softMarkCounterOnce sync.Once
+ tlsStatusCounterOnce sync.Once
+ sslClientInfoOnce sync.Once
+ clientInfoOnce sync.Once
+)
+
+var apiHistogram instrument.Int64Histogram
+var replicationHistogram instrument.Int64Histogram
+var connectHistogram instrument.Int64Histogram
+var ssConnectHistogram instrument.Int64Histogram
+
+var opsHistChannel chan DataPoint
+var replHistChannel chan DataPoint
+var ssConnHistChannel chan DataPoint
+var outBoundHistChannel chan DataPoint
+var counterChannel chan DataPoint
+
+var opsHistDoneCh chan bool
+var replHistCh chan bool
+var ssConnHistCh chan bool
+var outBoundHistCh chan bool
+
+var countMetricMap map[CMetric]*countMetric = map[CMetric]*countMetric{
+ RRDropMaxRetry: {"RR_Drop_MaxRetry", "Records dropped in replication queue due to max retry failures", nil, &rrDropMaxRetryCounterOnce, nil, nil},
+ RRDropQueueFull: {"RR_Drop_QueueFull", "Records dropped in replication queue due to queue is full", nil, &rrDropQueueFullCounterOnce, nil, nil},
+ RRDropRecExpired: {"RR_Drop_RecExpired", "Records dropped in replication queue due to expiry of records", nil, &rrDropRecExpiredCounterOnce, nil, nil},
+ SSL_CLIENT_INFO: {"SSL_CLIENT_INFO", "Client app Info", nil, &sslClientInfoOnce, nil, nil},
+ CLIENT_INFO: {"CLIENT_INFO", "Client app Info", nil, &clientInfoOnce, nil, nil},
+ Accept: {"accept", "Accepting incoming connections", nil, &acceptCounterOnce, nil, nil},
+ Close: {"close", "Closing incoming connections", nil, &closeCounterOnce, nil, nil},
+ RAPI: {"rapi", "Processing of replicated requests", nil, &rapiCounterOnce, nil, nil},
+ ReqProc: {"ReqProc", "Request processor", nil, &reqProcCounterOnce, nil, nil},
+ ProcErr: {"ProcErr", "Request processor Error", nil, &procErrCounterOnce, nil, nil},
+ SoftMark: {"SoftMark", "Proxy marks down storage instances", nil, &softMarkCounterOnce, nil, nil},
+ TLSStatus: {"TLS_Status", "TLS connection state", nil, &tlsStatusCounterOnce, nil, nil},
+}
+
+var histMetricMap map[CMetric]*histogramMetric = map[CMetric]*histogramMetric{
+ Inbound: {PopulateJunoMetricNamePrefix("inbound"), "Histogram for Juno API", "ms", nil, &apiHistogramOnce, nil, nil},
+ Replication: {PopulateJunoMetricNamePrefix("replication"), "Histogram for Juno replication", "ms", nil, &replicationHistogramOnce, nil, nil},
+ OutboundConnection: {PopulateJunoMetricNamePrefix("outbound_connection"), "Histogram for Juno connection", "us", nil, &connectHistogramOnce, nil, nil},
+ SSConnection: {PopulateJunoMetricNamePrefix("ssConnection"), "Histogram for Juno SS connection", "us", nil, &ssConnectHistogramOnce, nil, nil},
+}
+
+var (
+ meterProvider *metric.MeterProvider
+)
+
+var (
+ machineCpuUsedOnce sync.Once
+ processCpuUsedOnce sync.Once
+ machineMemoryUsedOnce sync.Once
+ processMemoryUsedOnce sync.Once
+ diskIOUtilization sync.Once
+ badShardOnce sync.Once
+ alertShardOnce sync.Once
+ warningShardOnce sync.Once
+ keyCountOnce sync.Once
+ freeStorageOnce sync.Once
+ usedStorageOnce sync.Once
+ LNLevelOnce sync.Once
+ compSecOnce sync.Once
+ compCountOnce sync.Once
+ pendingCompOnce sync.Once
+ stallOnce sync.Once
+ TCPConnCountOnce sync.Once
+ SSLConnCountOnce sync.Once
+)
+
+var (
+ machTime time.Time
+ machCpuTick uint16
+ machUser uint64
+ machSystem uint64
+)
+
+var GaugeMetricList = []*GaugeMetric{
+ {"pCPU", "proc_cpu_used", "CPU utilization of individual Juno instance", nil, nil, &processCpuUsedOnce, SvrTypeAll},
+ {"pMem", "proc_mem_used", "Memory utilization of individual Juno instance", nil, nil, &processMemoryUsedOnce, SvrTypeAll},
+
+ {"nBShd", "bad_shard", "Number of bad shards", nil, nil, &badShardOnce, SvrTypeProxy},
+ {"nAShd", "alert_shard", "number of shards with no redundancy", nil, nil, &alertShardOnce, SvrTypeProxy},
+ {"nWShd", "warning_shard", "number of shards with bad SS", nil, nil, &warningShardOnce, SvrTypeProxy},
+
+ {"conns", "conns_count", "number of current TCP connections", nil, nil, &TCPConnCountOnce, SvrTypeProxy},
+ {"ssl_conns", "conns_ssl_count", "number of current SSL connections", nil, nil, &SSLConnCountOnce, SvrTypeProxy},
+ {"keys", "key_count", "Key Counte in rocksDB", nil, nil, &keyCountOnce, SvrTypeStorage},
+ {"free", "free_mb_storage_space", "Free Storage Space (mbytes)", nil, nil, &freeStorageOnce, SvrTypeStorage},
+ {"used", "storage_used_mb", "Used Storage Space (mbytes)", nil, nil, &usedStorageOnce, SvrTypeStorage},
+ {"LN", "LN_level", "Max LN Level in Rocksdb", nil, nil, &LNLevelOnce, SvrTypeStorage},
+ {"compSec", "compaction_sec", "Compaction Sec", nil, nil, &compSecOnce, SvrTypeStorage},
+ {"compCount", "compaction_count", "Compaction Count", nil, nil, &compCountOnce, SvrTypeStorage},
+ {"pCompKB", "pending_compaction", "Pending Compaction KBytes", nil, nil, &pendingCompOnce, SvrTypeStorage},
+ {"stall", "stall_write_rate", "Actural Delayed Write Rate", nil, nil, &stallOnce, SvrTypeStorage},
+}
+
+var otelIngestToken string
+
+// ************************************ Types ****************************
+type CMetric int
+
+type Tags struct {
+ TagName string
+ TagValue string
+}
+
+type countMetric struct {
+ metricName string
+ metricDesc string
+ counter instrument.Int64Counter
+ createCounter *sync.Once
+ counterCh chan DataPoint
+ doneCh chan bool
+}
+
+type histogramMetric struct {
+ metricName string
+ metricDesc string
+ metricUnit string
+ histogram instrument.Int64Histogram
+ createHistogram *sync.Once
+ histogramCh chan DataPoint
+ doneCh chan bool
+}
+
+type (
+ ServerType int
+)
+
+type GaugeMetric struct {
+ MetricShortName string
+ MetricName string
+ metricDesc string
+ gaugeMetric instrument.Float64ObservableGauge
+ stats []StateData
+ createGauge *sync.Once
+ stype ServerType
+}
+
+// Represents stats by a worker
+type StateData struct {
+ Name string
+ Value float64
+ Dimensions instrument.MeasurementOption
+}
+
+type DataPoint struct {
+ attr instrument.MeasurementOption
+ data int64
+}
diff --git a/pkg/logging/otel/logger.go b/pkg/logging/otel/logger.go
index 5559085e..e226be8b 100644
--- a/pkg/logging/otel/logger.go
+++ b/pkg/logging/otel/logger.go
@@ -1,156 +1,47 @@
+// Copyright 2023 PayPal Inc.
//
-// Copyright 2023 PayPal Inc.
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+// http://www.apache.org/licenses/LICENSE-2.0
//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package otel
import (
- "bufio"
"context"
"errors"
"fmt"
- "io"
"log"
"os"
- "strings"
- "sync"
+
"time"
- otelCfg "juno/pkg/logging/otel/config"
- "juno/third_party/forked/golang/glog"
+ otelCfg "github.com/paypal/junodb/pkg/logging/otel/config"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/proto"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp"
- "go.opentelemetry.io/otel/metric/global"
- "go.opentelemetry.io/otel/metric/instrument"
- "go.opentelemetry.io/otel/metric/instrument/syncint64"
- "go.opentelemetry.io/otel/metric/unit"
+ instrument "go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/metric/aggregation"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
"go.opentelemetry.io/otel/sdk/resource"
- semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
-)
-
-var (
- apiHistogramOnce sync.Once
- replicationHistogramOnce sync.Once
- connectHistogramOnce sync.Once
- ssConnectHistogramOnce sync.Once
- rrDropMaxRetryCounterOnce sync.Once
- rrDropQueueFullCounterOnce sync.Once
- rrDropRecExpiredCounterOnce sync.Once
- acceptCounterOnce sync.Once
- closeCounterOnce sync.Once
- rapiCounterOnce sync.Once
- reqProcCounterOnce sync.Once
- procErrCounterOnce sync.Once
-)
-
-var apiHistogram syncint64.Histogram
-var replicationHistogram syncint64.Histogram
-var connectHistogram syncint64.Histogram
-var ssConnectHistogram syncint64.Histogram
-
-type CMetric int
-
-const (
- RRDropMaxRetry CMetric = CMetric(iota)
- RRDropQueueFull
- RRDropRecExpired
- Accept
- Close
- RAPI
- ReqProc
- ProcErr
-)
-
-type Tags struct {
- TagName string
- TagValue string
-}
-
-const (
- Target = string("target")
- Endpoint = string("endpoint")
- Operation = string("operation")
- Status = string("status")
- Fatal = string("Fatal")
- Error = string("Error")
- Warn = string("Warning")
- Success = string("Success")
- SS_RB_expire = string("SS_RB_expire")
- SSReqTimeout = string("SSReqTimeout")
-)
-
-type countMetric struct {
- metricName string
- metricDesc string
- counter syncint64.Counter
- createCounter *sync.Once
-}
-
-var countMetricMap map[CMetric]*countMetric = map[CMetric]*countMetric{
- RRDropMaxRetry: {"RR_Drop_MaxRetry", "Records dropped in replication queue due to max retry failures", nil, &rrDropMaxRetryCounterOnce},
- RRDropQueueFull: {"RR_Drop_QueueFull", "Records dropped in replication queue due to queue is full", nil, &rrDropQueueFullCounterOnce},
- RRDropRecExpired: {"RR_Drop_RecExpired", "Records dropped in replication queue due to expiry of records", nil, &rrDropRecExpiredCounterOnce},
- Accept: {"accept", "Accepting incoming connections", nil, &acceptCounterOnce},
- Close: {"close", "Closing incoming connections", nil, &closeCounterOnce},
- RAPI: {"rapi", "Processing of replicated requests", nil, &rapiCounterOnce},
- ReqProc: {"ReqProc", "Processing of replicated requests", nil, &reqProcCounterOnce},
- ProcErr: {"ProcErr", "Processing of replicated requests", nil, &procErrCounterOnce},
-}
-
-type (
- ServerType int
-)
-
-const (
- SvrTypeProxy = ServerType(1)
- SvrTypeStorage = ServerType(2)
- SvrTypeClusterMgr = ServerType(3)
- SvrTypeAll = ServerType(6)
)
-// default OTEL configurations point to QA collector
-var DEFAULT_OTEL_COLLECTOR_PROTOCOL string = "http"
-var DEFAULT_GRPC_OTEL_COLLECTOR_PORT string = "30705"
-var DEFAULT_HTTP_OTEL_COLLECTOR_PORT string = "30706"
-var COLLECTOR_POLLING_INTERVAL_SECONDS int32 = 5
-
-const JUNO_METRIC_PREFIX = "juno.server."
-const MeterName = "juno-server-meter"
-
var OTEL_COLLECTOR_PROTOCOL string = DEFAULT_OTEL_COLLECTOR_PROTOCOL
-// OTEl Status
-const (
- StatusSuccess string = "SUCCESS"
- StatusFatal string = "FATAL"
- StatusError string = "ERROR"
- StatusWarning string = "WARNING"
- StatusUnknown string = "UNKNOWN"
-)
-
-var (
- meterProvider *metric.MeterProvider
-)
-
func Initialize(args ...interface{}) (err error) {
glog.Info("Juno OTEL initialized")
sz := len(args)
@@ -166,6 +57,7 @@ func Initialize(args ...interface{}) (err error) {
glog.Error(err)
return
}
+ c.Validate()
c.Dump()
if c.Enabled {
// Initialize only if OTEL is enabled
@@ -174,36 +66,84 @@ func Initialize(args ...interface{}) (err error) {
return
}
+func Finalize() {
+ // Shutdown the Go routines for histograms
+ for _, val := range histMetricMap {
+ if val.histogram != nil && val.doneCh != nil {
+ close(val.doneCh)
+ }
+ }
+
+ // Shutdown the Go routines for counters that are active
+ for _, val := range countMetricMap {
+ if val.counter != nil && val.doneCh != nil {
+ close(val.doneCh)
+ }
+ }
+}
+
func InitMetricProvider(config *otelCfg.Config) {
if meterProvider != nil {
- fmt.Printf("Retrung as meter is already available")
return
}
- //TODO Remove this after testing
otelCfg.OtelConfig = config
ctx := context.Background()
-
// View to customize histogram buckets and rename a single histogram instrument.
repBucketsView := metric.NewView(
metric.Instrument{
- Name: "*replication*",
+ Name: PopulateJunoMetricNamePrefix("replication"),
Scope: instrumentation.Scope{Name: MeterName},
},
metric.Stream{
- Name: "replication",
Aggregation: aggregation.ExplicitBucketHistogram{
- Boundaries: []float64{64, 128, 256, 512, 1024, 2048, 4096},
+ Boundaries: config.HistogramBuckets.Replication,
},
- })
+ },
+ )
+
+ ssConnBucketsView := metric.NewView(
+ metric.Instrument{
+ Name: PopulateJunoMetricNamePrefix("ssConnection"),
+ Scope: instrumentation.Scope{Name: MeterName},
+ },
+ metric.Stream{
+ Aggregation: aggregation.ExplicitBucketHistogram{
+ Boundaries: config.HistogramBuckets.SsConnect,
+ },
+ },
+ )
+
+ inboundBucketsView := metric.NewView(
+ metric.Instrument{
+ Name: PopulateJunoMetricNamePrefix("inbound"),
+ Scope: instrumentation.Scope{Name: MeterName},
+ },
+ metric.Stream{
+ Aggregation: aggregation.ExplicitBucketHistogram{
+ Boundaries: config.HistogramBuckets.Inbound,
+ },
+ },
+ )
+
+ outboundBucketsView := metric.NewView(
+ metric.Instrument{
+ Name: PopulateJunoMetricNamePrefix("outbound_connection"),
+ Scope: instrumentation.Scope{Name: MeterName},
+ },
+ metric.Stream{
+ Aggregation: aggregation.ExplicitBucketHistogram{
+ Boundaries: config.HistogramBuckets.OutboundConnection,
+ },
+ },
+ )
- provider, err := NewMeterProvider(ctx, *config, repBucketsView)
+ var err error
+ meterProvider, err = NewMeterProvider(ctx, *config, repBucketsView, ssConnBucketsView, inboundBucketsView, outboundBucketsView)
if err != nil {
log.Fatal(err)
}
- provider.Meter(MeterName)
- global.SetMeterProvider(provider)
}
func NewMeterProvider(ctx context.Context, cfg otelCfg.Config, vis ...metric.View) (*metric.MeterProvider, error) {
@@ -216,32 +156,32 @@ func NewMeterProvider(ctx context.Context, cfg otelCfg.Config, vis ...metric.Vie
// Set the reader collection periord to 10 seconds (default 60).
reader := metric.NewPeriodicReader(exp, metric.WithInterval(time.Duration(cfg.Resolution)*time.Second))
- meterProvider = metric.NewMeterProvider(
+ metProvider := metric.NewMeterProvider(
metric.WithResource(res),
metric.WithReader(reader),
metric.WithView(vis...),
)
- return meterProvider, nil
+ return metProvider, nil
}
func NewHTTPExporter(ctx context.Context) (metric.Exporter, error) {
+ header := make(map[string]string)
var deltaTemporalitySelector = func(metric.InstrumentKind) metricdata.Temporality { return metricdata.DeltaTemporality }
if otelCfg.OtelConfig.UseTls == true {
return otlpmetrichttp.New(
ctx,
otlpmetrichttp.WithEndpoint(otelCfg.OtelConfig.Host+":"+fmt.Sprintf("%d", otelCfg.OtelConfig.Port)),
- //otlpmetrichttp.WithInsecure(),
// WithTimeout sets the max amount of time the Exporter will attempt an
// export.
- //func(metric.InstrumentKindSyncHistogram){return metricdata.DeltaTemporality}
- otlpmetrichttp.WithTimeout(7*time.Second),
+ otlpmetrichttp.WithTimeout(20*time.Second),
otlpmetrichttp.WithCompression(otlpmetrichttp.NoCompression),
otlpmetrichttp.WithTemporalitySelector(deltaTemporalitySelector),
+ otlpmetrichttp.WithHeaders(header),
otlpmetrichttp.WithRetry(otlpmetrichttp.RetryConfig{
// Enabled indicates whether to not retry sending batches in case
// of export failure.
- Enabled: true,
+ Enabled: false,
// InitialInterval the time to wait after the first failure before
// retrying.
InitialInterval: 1 * time.Second,
@@ -252,8 +192,9 @@ func NewHTTPExporter(ctx context.Context) (metric.Exporter, error) {
// MaxElapsedTime is the maximum amount of time (including retries)
// spent trying to send a request/batch. Once this value is
// reached, the data is discarded.
- MaxElapsedTime: 240 * time.Second,
+ MaxElapsedTime: 20 * time.Second,
}),
+ otlpmetrichttp.WithURLPath(otelCfg.OtelConfig.UrlPath),
)
} else {
return otlpmetrichttp.New(
@@ -263,12 +204,14 @@ func NewHTTPExporter(ctx context.Context) (metric.Exporter, error) {
otlpmetrichttp.WithTimeout(7*time.Second),
otlpmetrichttp.WithCompression(otlpmetrichttp.NoCompression),
otlpmetrichttp.WithTemporalitySelector(deltaTemporalitySelector),
+ otlpmetrichttp.WithHeaders(header),
otlpmetrichttp.WithRetry(otlpmetrichttp.RetryConfig{
Enabled: true,
InitialInterval: 1 * time.Second,
MaxInterval: 10 * time.Second,
MaxElapsedTime: 240 * time.Second,
}),
+ otlpmetrichttp.WithURLPath(otelCfg.OtelConfig.UrlPath),
)
}
@@ -284,73 +227,43 @@ func IsEnabled() bool {
return meterProvider != nil
}
-func GetHistogramForOperation() (syncint64.Histogram, error) {
- var err error
- apiHistogramOnce.Do(func() {
- meter := global.Meter(MeterName)
- apiHistogram, err = meter.SyncInt64().Histogram(
- PopulateJunoMetricNamePrefix("inbound"),
- instrument.WithDescription("Histogram for Juno API"),
- instrument.WithUnit(unit.Milliseconds),
- )
-
- })
- return apiHistogram, err
-}
-
-func GetHistogramForReplication() (syncint64.Histogram, error) {
- var err error
- replicationHistogramOnce.Do(func() {
- meter := global.Meter(MeterName)
- replicationHistogram, err = meter.SyncInt64().Histogram(
- PopulateJunoMetricNamePrefix("replication"),
- instrument.WithDescription("Histogram for Juno replication"),
- instrument.WithUnit(unit.Milliseconds),
- )
-
- })
- return replicationHistogram, err
-}
-
-func GetHistogramForReplicationConnect() (syncint64.Histogram, error) {
- var err error
- connectHistogramOnce.Do(func() {
- meter := global.Meter(MeterName)
- connectHistogram, err = meter.SyncInt64().Histogram(
- PopulateJunoMetricNamePrefix("outbound_connection"),
- instrument.WithDescription("Histogram for Juno connection"),
- instrument.WithUnit(unit.Milliseconds),
- )
-
- })
- return connectHistogram, err
-}
-
-func GetHistogramForSSConnect() (syncint64.Histogram, error) {
- var err error
- ssConnectHistogramOnce.Do(func() {
- meter := global.Meter(MeterName)
- ssConnectHistogram, err = meter.SyncInt64().Histogram(
- PopulateJunoMetricNamePrefix("ssConnection"),
- instrument.WithDescription("Histogram for Juno SS connection failure"),
- instrument.WithUnit(unit.Milliseconds),
- )
-
- })
- return ssConnectHistogram, err
+func getHistogram(histName CMetric) (chan DataPoint, error) {
+ if histMetric, ok := histMetricMap[histName]; ok {
+ histMetric.createHistogram.Do(func() {
+ meter := meterProvider.Meter(MeterName)
+ histMetric.histogram, _ = meter.Int64Histogram(
+ histMetric.metricName,
+ instrument.WithDescription(histMetric.metricDesc),
+ instrument.WithUnit(histMetric.metricUnit),
+ )
+ histMetric.doneCh = make(chan bool)
+ histMetric.histogramCh = make(chan DataPoint, histChannelSize)
+ go doWriteHistogram(histMetric.histogramCh, histMetric.doneCh, histMetric.histogram)
+ })
+ if histMetric.histogramCh != nil {
+ return histMetric.histogramCh, nil
+ } else {
+ return nil, errors.New("Histogram Object not Ready")
+ }
+ } else {
+ return nil, errors.New("No Such Histogram exists")
+ }
}
-func GetCounter(counterName CMetric) (syncint64.Counter, error) {
+func GetCounter(counterName CMetric) (chan DataPoint, error) {
if counterMetric, ok := countMetricMap[counterName]; ok {
counterMetric.createCounter.Do(func() {
- meter := global.Meter(MeterName)
- counterMetric.counter, _ = meter.SyncInt64().Counter(
+ meter := meterProvider.Meter(MeterName)
+ counterMetric.counter, _ = meter.Int64Counter(
PopulateJunoMetricNamePrefix(counterMetric.metricName),
instrument.WithDescription(counterMetric.metricDesc),
)
+ counterMetric.doneCh = make(chan bool)
+ counterMetric.counterCh = make(chan DataPoint, counterChannelSize)
+ go doWriteCounter(counterMetric.counterCh, counterMetric.doneCh, counterMetric.counter)
})
- if counterMetric.counter != nil {
- return counterMetric.counter, nil
+ if counterMetric.counterCh != nil {
+ return counterMetric.counterCh, nil
} else {
return nil, errors.New("Counter Object not Ready")
}
@@ -360,154 +273,130 @@ func GetCounter(counterName CMetric) (syncint64.Counter, error) {
}
// This is the pp.app.intbound metric
-func RecordOperation(opType string, status string, latency int64) {
- ctx := context.Background()
- if operation, err := GetHistogramForOperation(); err == nil {
- commonLabels := []attribute.KeyValue{
- attribute.String("operation", opType),
- attribute.String("status", status),
+func RecordOperation(opType string, status proto.OpStatus, latency int64) {
+ if IsEnabled() {
+ if opsHistChannel, err := getHistogram(Inbound); err == nil {
+ commonLabels := instrument.WithAttributes(
+ attribute.String("endpoint", opType),
+ attribute.String("error_reason", status.ShortNameString()),
+ attribute.String("status", logging.CalStatus(status).CalStatus()),
+ )
+ dataPoint := DataPoint{commonLabels, latency}
+ if opsHistChannel != nil && len(opsHistChannel) < histChannelSize {
+ opsHistChannel <- dataPoint
+ }
}
- operation.Record(ctx, latency, commonLabels...)
}
}
func RecordReplication(opType string, status string, destination string, latency int64) {
- ctx := context.Background()
- if replication, err := GetHistogramForReplication(); err == nil {
- commonLabels := []attribute.KeyValue{
- attribute.String("operation", opType),
- attribute.String("status", status),
- attribute.String("dest_az", destination),
+ if IsEnabled() {
+ if replHistChannel, err := getHistogram(Replication); err == nil {
+ commonLabels := instrument.WithAttributes(
+ attribute.String("operation", opType),
+ attribute.String("status", status),
+ attribute.String("dest_az", destination),
+ )
+ dataPoint := DataPoint{commonLabels, latency}
+ if replHistChannel != nil && len(replHistChannel) < histChannelSize {
+ replHistChannel <- dataPoint
+ }
}
- replication.Record(ctx, latency, commonLabels...)
}
}
func RecordSSConnection(endpoint string, status string, latency int64) {
- ctx := context.Background()
- if ssConnect, err := GetHistogramForSSConnect(); err == nil {
- commonLabels := []attribute.KeyValue{
- attribute.String("endpoint", endpoint),
- attribute.String("status", status),
+ if IsEnabled() {
+ if ssConnHistChannel, err := getHistogram(SSConnection); err == nil {
+ commonLabels := instrument.WithAttributes(
+ attribute.String("endpoint", endpoint),
+ attribute.String("status", status),
+ )
+ dataPoint := DataPoint{commonLabels, latency}
+ if ssConnHistChannel != nil && len(ssConnHistChannel) < histChannelSize {
+ ssConnHistChannel <- dataPoint
+ }
}
- ssConnect.Record(ctx, latency, commonLabels...)
}
}
func RecordOutboundConnection(endpoint string, status string, latency int64) {
- ctx := context.Background()
- if requestLatency, err := GetHistogramForReplicationConnect(); err == nil {
- commonLabels := []attribute.KeyValue{
- attribute.String("endpoint", endpoint),
- attribute.String("status", status),
+ if IsEnabled() {
+ if outBoundHistChannel, err := getHistogram(OutboundConnection); err == nil {
+ commonLabels := instrument.WithAttributes(
+ attribute.String(Endpoint, endpoint),
+ attribute.String("status", status),
+ )
+ dataPoint := DataPoint{commonLabels, latency}
+ if outBoundHistChannel != nil && len(outBoundHistChannel) < histChannelSize {
+ outBoundHistChannel <- dataPoint
+ }
}
- requestLatency.Record(ctx, latency, commonLabels...)
}
}
func RecordCount(counterName CMetric, tags []Tags) {
- ctx := context.Background()
- if counter, err := GetCounter(counterName); err == nil {
- if len(tags) != 0 {
- // commonLabels := []attribute.KeyValue{
- // attribute.String("endpoint", endpoint),
- // }
- commonLabels := covertTagsToOTELAttributes(tags)
- counter.Add(ctx, 1, commonLabels...)
+ if IsEnabled() {
+ if counterChannel, err := GetCounter(counterName); err == nil {
+ var commonLabels instrument.MeasurementOption
+ if len(tags) != 0 {
+ commonLabels = covertTagsToOTELAttributes(tags)
+ }
+ dataPoint := DataPoint{commonLabels, 1}
+ if counterChannel != nil && len(counterChannel) < counterChannelSize {
+ counterChannel <- dataPoint
+ }
} else {
- counter.Add(ctx, 1)
+ glog.Error(err)
}
- } else {
- glog.Error(err)
}
}
-func covertTagsToOTELAttributes(tags []Tags) (attr []attribute.KeyValue) {
- attr = make([]attribute.KeyValue, len(tags))
+func covertTagsToOTELAttributes(tags []Tags) instrument.MeasurementOption {
+ attr := make([]attribute.KeyValue, len(tags))
for i := 0; i < len(tags); i++ {
attr[i] = attribute.String(tags[i].TagName, tags[i].TagValue)
}
- return
+ return instrument.WithAttributes(attr...)
}
func PopulateJunoMetricNamePrefix(metricName string) string {
return JUNO_METRIC_PREFIX + metricName
}
-// getEnvFromSyshieraYaml returns the env: line from /etc/syshiera.yaml
-func getEnvFromSyshieraYaml() (string, error) {
- filePath := "/etc/syshiera.yaml"
- file, err := os.Open(filePath)
- if err != nil {
- return "", err
- }
- defer file.Close()
- fileReader := bufio.NewReader(file)
- scanner := bufio.NewScanner(fileReader)
- for scanner.Scan() {
- line := scanner.Text()
- err = scanner.Err()
- if err != nil {
- if err == io.EOF {
- break
- }
- return "", err
- }
- pos := strings.Index(line, "pp_az: ")
- if pos == -1 {
- continue
- }
- return strings.TrimSpace(line[3:len(line)]), nil
- }
- err = errors.New("dc: not found in /etc/syshiera.yaml")
- return "", err
-}
-
func getResourceInfo(appName string) *resource.Resource {
- colo, _err := getEnvFromSyshieraYaml()
- if _err != nil {
- colo = "qa"
- }
hostname, _ := os.Hostname()
-
resource := resource.NewWithAttributes("empty resource",
- semconv.HostNameKey.String(hostname),
- semconv.HostTypeKey.String("BM"),
- semconv.ServiceNameKey.String(appName),
- attribute.String("az", colo),
+ attribute.String("host", hostname),
attribute.String("application", appName),
)
return resource
}
-// func NewGRPCExporter(ctx context.Context) (metric.Exporter, error) {
-// ctx, cancel := context.WithTimeout(ctx, time.Second*10)
-// defer cancel()
-
-// // Exponential back-off strategy.
-// backoffConf := backoff.DefaultConfig
-// // You can also change the base delay, multiplier, and jitter here.
-// backoffConf.MaxDelay = 240 * time.Second
-
-// conn, err := grpc.DialContext(
-// ctx,
-// string(DEFAULT_OTEL_COLLECTOR__IP+":"+DEFAULT_GRPC_OTEL_COLLECTOR_PORT),
-// grpc.WithInsecure(),
-// grpc.WithBlock(),
-// grpc.WithConnectParams(grpc.ConnectParams{
-// Backoff: backoffConf,
-// // Connection timeout.
-// MinConnectTimeout: 5 * time.Second,
-// }),
-// )
-// if err != nil {
-// return nil, err
-// }
-
-// return otlpmetricgrpc.New(ctx,
-// otlpmetricgrpc.WithGRPCConn(conn),
-// // WithTimeout sets the max amount of time the Exporter will attempt an
-// // export.
-// otlpmetricgrpc.WithTimeout(7*time.Second),
-// )
-// }
+func doWriteHistogram(histChannel chan DataPoint, doneCh chan bool, hist instrument.Int64Histogram) {
+ ctx := context.Background()
+ for {
+ select {
+ case dataPoint := <-histChannel:
+ hist.Record(ctx, dataPoint.data, dataPoint.attr)
+ case <-doneCh:
+ return
+ }
+ }
+}
+
+func doWriteCounter(counterChannel chan DataPoint, doneCh chan bool, count instrument.Int64Counter) {
+ ctx := context.Background()
+ for {
+ select {
+ case dataPoint := <-counterChannel:
+ if dataPoint.attr != nil {
+ count.Add(ctx, dataPoint.data, dataPoint.attr)
+ } else {
+ count.Add(ctx, dataPoint.data)
+ }
+ case <-doneCh:
+ return
+ }
+ }
+}
diff --git a/pkg/logging/otel/statsLogger.go b/pkg/logging/otel/statsLogger.go
index f93031f5..a0c9e7e4 100644
--- a/pkg/logging/otel/statsLogger.go
+++ b/pkg/logging/otel/statsLogger.go
@@ -1,194 +1,103 @@
+// Copyright 2023 PayPal Inc.
//
-// Copyright 2023 PayPal Inc.
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+// http://www.apache.org/licenses/LICENSE-2.0
//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package otel
import (
"context"
"errors"
"fmt"
- "juno/pkg/stats"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
"runtime"
"strconv"
- "sync"
- "time"
-
- "go.opentelemetry.io/otel/attribute"
- "go.opentelemetry.io/otel/metric/global"
- "go.opentelemetry.io/otel/metric/instrument"
- "go.opentelemetry.io/otel/metric/instrument/asyncfloat64"
-)
-
-const (
- MachineCpuUsed string = string("machineCpuUsed")
- ProcessCpuUsed string = string("machineCpuUsed")
- MachineMemoryUsed
- ProcessMemoryUsed
-)
-var (
- machineCpuUsedOnce sync.Once
- processCpuUsedOnce sync.Once
- machineMemoryUsedOnce sync.Once
- processMemoryUsedOnce sync.Once
- badShardOnce sync.Once
- alertShardOnce sync.Once
- warningShardOnce sync.Once
- keyCountOnce sync.Once
- freeStorageOnce sync.Once
- usedStorageOnce sync.Once
- LNLevelOnce sync.Once
- compSecOnce sync.Once
- compCountOnce sync.Once
- pendingCompOnce sync.Once
- stallOnce sync.Once
-)
+ "github.com/paypal/junodb/pkg/stats"
-var (
- machTime time.Time
- machCpuTick uint16
- machUser uint64
- machSystem uint64
+ "go.opentelemetry.io/otel/attribute"
+ "go.opentelemetry.io/otel/metric"
)
-type GaugeMetric struct {
- MetricName string
- metricDesc string
- gaugeMetric asyncfloat64.Gauge
- createGauge *sync.Once
- stype ServerType
-}
-
-var GaugeMetricMap map[string]*GaugeMetric = map[string]*GaugeMetric{
- "mCPU": {"machCpuUsed", "CPU utilization of the host", nil, &machineCpuUsedOnce, SvrTypeAll},
- "pCPU": {"procCpuUsed", "CPU utilization of individual Juno instance", nil, &processCpuUsedOnce, SvrTypeAll},
- "mMem": {"machMemUsed", "Memory utilization of the host", nil, &machineMemoryUsedOnce, SvrTypeAll},
- "pMem": {"procMemUsed", "Memory utilization of individual Juno instance", nil, &processMemoryUsedOnce, SvrTypeAll},
-
- "nBShd": {"badShard", "Number of bad shards", nil, &badShardOnce, SvrTypeProxy},
- "nAShd": {"alertShard", "number of shards with no redundancy", nil, &alertShardOnce, SvrTypeProxy},
- "nWShd": {"warningShard", "number of shards with bad SS", nil, &warningShardOnce, SvrTypeProxy},
-
- "keys": {"key_count", "Key Counte in rocksDB", nil, &keyCountOnce, SvrTypeStorage},
- "free": {"free_mb_storage_space", "Free Storage Space (mbytes)", nil, &freeStorageOnce, SvrTypeStorage},
- "used": {"storage_used_mb", "Used Storage Space (mbytes)", nil, &usedStorageOnce, SvrTypeStorage},
- "LN": {"LN_level", "Max LN Level in Rocksdb", nil, &LNLevelOnce, SvrTypeStorage},
- "compSec": {"comp_sec", "Compaction Sec", nil, &compSecOnce, SvrTypeStorage},
- "compCount": {"comp_count", "Compaction Count", nil, &compCountOnce, SvrTypeStorage},
- "pCompKB": {"pending_comp_kbytes", "Pending Compaction KBytes", nil, &pendingCompOnce, SvrTypeStorage},
- "stall": {"stall_write_rate", "Actural Delayed Write Rate", nil, &stallOnce, SvrTypeStorage},
-}
-
-// Represents the list of workers with stats
-type CurrentStatsData struct {
- WorkerState []WorkerStats
-}
-
-// Represents list of stats emitted by a worker
-type WorkerStats struct {
- StatData []StateData
-}
-
-// Represents stats by worker
-type StateData struct {
- Name string
- Value float64
- Dimensions []attribute.KeyValue
-}
-
-var CurrStatsData CurrentStatsData
-
func InitSystemMetrics(serverType ServerType, workerStats [][]stats.IState) {
- meter := global.Meter(MeterName)
- var stateLogGauge []instrument.Asynchronous = make([]instrument.Asynchronous, len(GaugeMetricMap))
- var i int = 0
- //InitMachCpuUsage()
- for _, element := range GaugeMetricMap {
+ meter := meterProvider.Meter(MeterName)
+ var metricList []metric.Observable = make([]metric.Observable, 0, len(GaugeMetricList))
+ for _, element := range GaugeMetricList {
if element.stype == serverType || element.stype == SvrTypeAll {
element.createGauge.Do(func() {
- // TODO instead of element use GaugeMetricMap[index]
- element.gaugeMetric, _ = meter.AsyncFloat64().Gauge(
+ var err error
+ element.gaugeMetric, err = meter.Float64ObservableGauge(
PopulateJunoMetricNamePrefix(element.MetricName),
- //instrument.WithUnit(unit.Dimensionless),
- instrument.WithDescription(element.metricDesc),
+ metric.WithDescription(element.metricDesc),
)
- stateLogGauge[i] = element.gaugeMetric
- i++
+ metricList = append(metricList, element.gaugeMetric)
+ if err != nil {
+ glog.Error("FloatObservable creation failed : ", err.Error())
+ }
})
}
}
- if err := meter.RegisterCallback(
- stateLogGauge,
- func(ctx context.Context) {
- wstate := getMetricData(workerStats)
- for _, workerState := range wstate {
- for _, state := range workerState.StatData {
- gMetric, ok := GaugeMetricMap[state.Name]
- if ok {
- if gMetric.gaugeMetric != nil {
- gMetric.gaugeMetric.Observe(ctx, state.Value, state.Dimensions...)
- }
- }
+ if _, err := meter.RegisterCallback(func(_ context.Context, o metric.Observer) error {
+ getMetricData(workerStats)
+ for _, metric := range GaugeMetricList {
+ if metric.gaugeMetric != nil {
+ for _, stat := range metric.stats {
+ o.ObserveFloat64(metric.gaugeMetric, stat.Value, stat.Dimensions)
}
}
- },
- ); err != nil {
- ///Just ignore
+ }
+ return nil
+ }, metricList...); err != nil {
+ glog.Error("Error Registering call back : ", err.Error())
}
+
}
-func getMetricData(workerStats [][]stats.IState) []WorkerStats {
+func getMetricData(workerStats [][]stats.IState) {
numWorkers := len(workerStats)
- var wsd []WorkerStats
- wsd = make([]WorkerStats, numWorkers)
- for wi := 0; wi < numWorkers; wi++ { // For number of workers
- var sdata []StateData
- sdata = make([]StateData, 0, len(workerStats[wi]))
- for _, v := range workerStats[wi] { // For number of statistics
- if fl, err := strconv.ParseFloat(v.State(), 64); err == nil {
- if wrstats, err := writeMetricsData(wi, v.Header(), fl); err == nil {
- sdata = append(sdata, wrstats)
+ for _, metric := range GaugeMetricList {
+ if metric.gaugeMetric != nil {
+ metric.stats = make([]StateData, 0, numWorkers)
+ for wi := 0; wi < numWorkers; wi++ { // For number of workers
+ for _, v := range workerStats[wi] { // For number of statistics
+ if metric.MetricShortName == v.Header() {
+ if fl, err := strconv.ParseFloat(v.State(), 64); err == nil {
+ if wrstats, err := writeMetricsData(wi, v.Header(), fl); err == nil {
+ metric.stats = append(metric.stats, wrstats)
+ }
+ }
+ }
}
}
}
- wsd[wi].StatData = sdata
}
-
- return wsd
+ return
}
func writeMetricsData(wid int, key string, value float64) (StateData, error) {
var data StateData
- _, ok := GaugeMetricMap[key]
- if !ok {
- // Only record the metrics in the map
- return data, errors.New("Metirc not found in Map")
- }
- if (key == "mCPU" || key == "mMem") && wid != 0 {
+ if (key == "free" || key == "used") && wid != 0 {
// Log system metric only for worker 0
return data, errors.New("Do not log machine resource utilization for all workers except for worker 0")
}
data.Name = key
data.Value = value
- data.Dimensions = []attribute.KeyValue{attribute.String("id", fmt.Sprintf("%d", wid))}
+ data.Dimensions = metric.WithAttributes(attribute.String("id", fmt.Sprintf("%d", wid)))
return data, nil
}
diff --git a/pkg/logging/otel/test/logger_test.go b/pkg/logging/otel/test/logger_test.go
index f8117449..555ec431 100644
--- a/pkg/logging/otel/test/logger_test.go
+++ b/pkg/logging/otel/test/logger_test.go
@@ -19,15 +19,16 @@
// This test uses a mock to validate the metrics and the sends the metric to
// QA OTEL collector for verifying the results in Sfx UI.
-package test
+package otel
import (
"fmt"
- "juno/pkg/logging/otel"
- config "juno/pkg/logging/otel/config"
- "juno/pkg/stats"
"testing"
"time"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/logging/otel"
+ config "github.com/paypal/junodb/pkg/logging/otel/config"
+ "github.com/paypal/junodb/pkg/stats"
)
var exportinterval int = 10
@@ -50,13 +51,13 @@ func TestJunoOperation(t *testing.T) {
time.Sleep(time.Duration(1) * time.Second)
- otel.RecordOperation("Create", "SUCCESS", 2000)
- otel.RecordOperation("Get", "SUCCESS", 1000)
- otel.RecordOperation("Update", "SUCCESS", 3000)
- otel.RecordOperation("Destroy", "SUCCESS", 500)
- otel.RecordOperation("Set", "SUCCESS", 2500)
+ otel.RecordOperation("Create", proto.OpStatusNoError, 2000)
+ otel.RecordOperation("Get", proto.OpStatusNoError, 1000)
+ otel.RecordOperation("Update", proto.OpStatusNoError, 3000)
+ otel.RecordOperation("Destroy", proto.OpStatusNoError, 500)
+ otel.RecordOperation("Set", proto.OpStatusNoError, 2500)
- otel.RecordOperation("Create", "ERROR", 2000)
+ otel.RecordOperation("Create", proto.OpStatusBadParam, 2000)
time.Sleep(time.Duration(SfxConfig.Resolution) * time.Second)
@@ -357,14 +358,14 @@ func TestJunoStats(t *testing.T) {
for i := 0; i < 2; i++ {
workerStats[i] = append(workerStats[i],
[]stats.IState{
- stats.NewUint32State(&mcpu, "mCPU", "Machine CPU usage"),
+ stats.NewUint32State(&mcpu, "pCPU", "Process CPU usage"),
stats.NewUint16State(&bshd, "nBShd", "number of Bad Shards"),
}...)
}
otel.InitSystemMetrics(otel.SvrTypeProxy, workerStats)
- time.Sleep(time.Duration(SfxConfig.Resolution) * time.Second)
+ time.Sleep(time.Duration(SfxConfig.Resolution+10) * time.Second)
v1m := mc.GetMetrics()
@@ -372,11 +373,11 @@ func TestJunoStats(t *testing.T) {
t.Errorf("Test fail")
} else {
for i := 0; i < 2; i++ {
- if v1m[i].GetName() == "juno.server.machCpuUsed" {
+ if v1m[i].GetName() == "pp.juno.server.proc_cpu_used" {
if v1m[i].GetGauge().DataPoints[0].GetAsDouble() != 30 {
t.Errorf("CPU utilization is incorrect %f", v1m[i].GetGauge().DataPoints[0].GetAsDouble())
}
- } else if v1m[i].GetName() == "juno.server.badShard" {
+ } else if v1m[i].GetName() == "pp.juno.server.bad_shard" {
if v1m[i].GetGauge().DataPoints[0].GetAsDouble() != 5 {
t.Errorf("Bad Shard Count is incorrect %f", v1m[i].GetGauge().DataPoints[0].GetAsDouble())
}
diff --git a/pkg/logging/otel/test/mock_collector.go b/pkg/logging/otel/test/mock_collector.go
index 5b29af06..fc8c1989 100644
--- a/pkg/logging/otel/test/mock_collector.go
+++ b/pkg/logging/otel/test/mock_collector.go
@@ -16,7 +16,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
-package test
+package otel
import (
"bytes"
@@ -31,6 +31,7 @@ import (
"encoding/pem"
"fmt"
"io"
+ "io/ioutil"
"math/big"
mathrand "math/rand"
"net"
@@ -112,7 +113,7 @@ func (c *mockCollector) serveMetrics(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
return
}
-
+ // fmt.Println("---------------raw req--------------", rawRequest)
request, err := unmarshalMetricsRequest(rawRequest, r.Header.Get("content-type"))
if err != nil {
w.WriteHeader(http.StatusBadRequest)
@@ -122,7 +123,7 @@ func (c *mockCollector) serveMetrics(w http.ResponseWriter, r *http.Request) {
c.spanLock.Lock()
defer c.spanLock.Unlock()
- // fmt.Println("---------------serveMetrics--------------", request)
+ fmt.Println("---------------serveMetrics--------------", request)
c.metricsStorage.AddMetrics(request)
}
@@ -161,7 +162,7 @@ func readRequest(r *http.Request) ([]byte, error) {
if r.Header.Get("Content-Encoding") == "gzip" {
return readGzipBody(r.Body)
}
- return io.ReadAll(r.Body)
+ return ioutil.ReadAll(r.Body)
}
func readGzipBody(body io.Reader) ([]byte, error) {
@@ -334,8 +335,13 @@ func NewMetricsStorage() MetricsStorage {
func (s *MetricsStorage) AddMetrics(request *collectormetricpb.ExportMetricsServiceRequest) {
for _, rm := range request.GetResourceMetrics() {
// TODO (rghetia) handle multiple resource and library info.
+ fmt.Println("---------------AddMetrics------------------", rm)
+
if len(rm.ScopeMetrics) > 0 {
s.metrics = append(s.metrics, rm.ScopeMetrics[0].Metrics...)
+ fmt.Println("Metric added successfully")
+ } else {
+ fmt.Println("Metrics added filed")
}
// if len(rm.InstrumentationLibraryMetrics) > 0 {
diff --git a/pkg/net/netutil/netutil.go b/pkg/net/netutil/netutil.go
index 03665f71..90c46f8c 100644
--- a/pkg/net/netutil/netutil.go
+++ b/pkg/net/netutil/netutil.go
@@ -22,7 +22,7 @@ package netutil
import (
"net"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
var (
diff --git a/pkg/proto/cryptoks.go b/pkg/proto/cryptoks.go
index 71f04d14..8cf9a153 100644
--- a/pkg/proto/cryptoks.go
+++ b/pkg/proto/cryptoks.go
@@ -24,7 +24,7 @@ import (
"errors"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
type (
diff --git a/pkg/proto/decode.go b/pkg/proto/decode.go
index 2273be5d..43baccbe 100644
--- a/pkg/proto/decode.go
+++ b/pkg/proto/decode.go
@@ -22,9 +22,9 @@ package proto
import (
"io"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/util"
)
const (
@@ -69,7 +69,7 @@ func (dec *Decoder) Decode(op *OperationalMessage) error {
return op.decode(raw, &header, true)
}
-//Caller's responsibility to have op zeroed
+// Caller's responsibility to have op zeroed
func (op *OperationalMessage) decode(raw []byte, msgHeader *messageHeaderT, copyData bool) error {
offset := 0
szBuf := len(raw)
diff --git a/pkg/proto/mayfly/mapping.go b/pkg/proto/mayfly/mapping.go
index b9d292c8..f4d8ab99 100644
--- a/pkg/proto/mayfly/mapping.go
+++ b/pkg/proto/mayfly/mapping.go
@@ -23,9 +23,9 @@ import (
"encoding/binary"
"net"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/pkg/proto"
)
func opCodeToJuno(mfop OpCode) (opcode proto.OpCode, err error) {
@@ -69,7 +69,7 @@ func toMayflyOpCode(jop proto.OpCode) (opcode OpCode, err error) {
return
}
-///TODO to be reviewed
+// /TODO to be reviewed
var opStatusJunoToMayflyMapping []OpStatus = []OpStatus{
OpStatusdNoError, //Ok, 0
OpStatusBadMsg, //BadMsg, 1
diff --git a/pkg/proto/mayfly/msg.go b/pkg/proto/mayfly/msg.go
index 97b52762..643af4d7 100644
--- a/pkg/proto/mayfly/msg.go
+++ b/pkg/proto/mayfly/msg.go
@@ -25,7 +25,7 @@ import (
"fmt"
"io"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/util"
)
type Msg struct {
diff --git a/pkg/proto/mayfly/msg_test.go b/pkg/proto/mayfly/msg_test.go
index 46dbca45..1988eff9 100644
--- a/pkg/proto/mayfly/msg_test.go
+++ b/pkg/proto/mayfly/msg_test.go
@@ -23,7 +23,7 @@ import (
"bytes"
"testing"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/util"
)
func testRequestResponse(t *testing.T, rawRequest []byte, rawResponse []byte) {
diff --git a/pkg/proto/mayfly/opmsg.go b/pkg/proto/mayfly/opmsg.go
index a1eddce7..8a3c4b7c 100644
--- a/pkg/proto/mayfly/opmsg.go
+++ b/pkg/proto/mayfly/opmsg.go
@@ -30,8 +30,8 @@ import (
"sync/atomic"
"time"
- "juno/pkg/net/netutil"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/net/netutil"
+ "github.com/paypal/junodb/pkg/util"
)
type (
diff --git a/pkg/proto/metaField.go b/pkg/proto/metaField.go
index aace1d4c..c5f45776 100644
--- a/pkg/proto/metaField.go
+++ b/pkg/proto/metaField.go
@@ -18,53 +18,53 @@
//
/*
- ==============================
- *** Predefined Field Types ***
- ==============================
-
- Tag/ID | Field | SizeType
- -------+--------------------------------------+------
- 0x01 | TimeToLive | 0x01
- 0x02 | Version | 0x01
- 0x03 | Creation Time | 0x01
- 0x04 | Expiration Time | 0x01
- 0x05 | RequestID/UUID | 0x03
- 0x06 | Source Info | 0
- 0x07 | Last Modification time (nano second) | 0x02
- 0x08 | Originator RequestID/UUID | 0x03
- 0x09 | Correlation ID | 0
- 0x0a | RequestHandlingTime | 0x01
- 0x0b | UDF Name | 0
- -------+--------------------------------------+------
-
-
- Tag/ID: 0x06
- +-----------------------------------------------------------------------------------------------+
- | 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7|
- | 0| 1| 2| 3|
- +-----------+-----------+--------------------+--+-----------------------+-----------------------+
- | size (include padding)| app name length | T| Port |
- +-----------------------+--------------------+--+-----------------------------------------------+
- | IPv4 address if T is 0 or IPv6 address if T is 1 |
- +-----------------------------------------------------------------------------------------------+
- | application name, padding to 4-byte aligned |
- +-----------------------------------------------------------------------------------------------+
-
- Tag/ID: 0x09; 0x0b
- +----+-------------------------------------------
- | 0 | field size (including padding)
- +----+-------------------------------------------
- | 1 | octet sequence length
- +----+-------------------------------------------
- | | octet sequence, padding to 4-byte aligned
- +----+-------------------------------------------
+ ==============================
+ *** Predefined Field Types ***
+ ==============================
+
+ Tag/ID | Field | SizeType
+ -------+--------------------------------------+------
+ 0x01 | TimeToLive | 0x01
+ 0x02 | Version | 0x01
+ 0x03 | Creation Time | 0x01
+ 0x04 | Expiration Time | 0x01
+ 0x05 | RequestID/UUID | 0x03
+ 0x06 | Source Info | 0
+ 0x07 | Last Modification time (nano second) | 0x02
+ 0x08 | Originator RequestID/UUID | 0x03
+ 0x09 | Correlation ID | 0
+ 0x0a | RequestHandlingTime | 0x01
+ 0x0b | UDF Name | 0
+ -------+--------------------------------------+------
+
+
+ Tag/ID: 0x06
+ +-----------------------------------------------------------------------------------------------+
+ | 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7| 0| 1| 2| 3| 4| 5| 6| 7|
+ | 0| 1| 2| 3|
+ +-----------+-----------+--------------------+--+-----------------------+-----------------------+
+ | size (include padding)| app name length | T| Port |
+ +-----------------------+--------------------+--+-----------------------------------------------+
+ | IPv4 address if T is 0 or IPv6 address if T is 1 |
+ +-----------------------------------------------------------------------------------------------+
+ | application name, padding to 4-byte aligned |
+ +-----------------------------------------------------------------------------------------------+
+
+ Tag/ID: 0x09; 0x0b
+ +----+-------------------------------------------
+ | 0 | field size (including padding)
+ +----+-------------------------------------------
+ | 1 | octet sequence length
+ +----+-------------------------------------------
+ | | octet sequence, padding to 4-byte aligned
+ +----+-------------------------------------------
*/
package proto
import (
"net"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
// Meta Component Field Tag
@@ -173,7 +173,7 @@ func (t requestHandlingTimeT) tagAndSizeTypeByte() uint8 {
return kFieldTagRequestHandlingTime | kMetaField_4Bytes
}
-//uint64 meta field
+// uint64 meta field
func (t uint64T) isSet() bool {
return t != 0
}
@@ -212,7 +212,7 @@ func (t lastModificationTimeT) tagAndSizeTypeByte() uint8 {
return kFieldTagLastModificationTime | kMetaField_8Bytes
}
-//16-byte meta field
+// 16-byte meta field
func (t *requestIdBaseT) value() []byte {
return t.Bytes()
}
@@ -270,7 +270,7 @@ func (t *originatorT) tagAndSizeTypeByte() uint8 {
return kFieldTagOriginatorRequestID | kMetaField_16Bytes
}
-//sourceinfo
+// sourceinfo
func (t *sourceInfoT) isSet() bool {
if (len(t.ip) != 0) || (t.port != 0) || (len(t.appName) != 0) {
return true
@@ -379,7 +379,7 @@ func (t sourceInfoT) tagAndSizeTypeByte() uint8 {
return kFieldTagSourceInfo | kMetaFieldVariableSize
}
-//byte sequence
+// byte sequence
func (t byteSequenceT) isSet() bool {
return len(t) != 0
}
diff --git a/pkg/proto/opMsg.go b/pkg/proto/opMsg.go
index 74ddd893..f2616587 100644
--- a/pkg/proto/opMsg.go
+++ b/pkg/proto/opMsg.go
@@ -27,7 +27,7 @@ import (
uuid "github.com/satori/go.uuid"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/util"
)
type OperationalMessage struct {
diff --git a/pkg/proto/opMsg_test.go b/pkg/proto/opMsg_test.go
index 555a03b4..fd4946a4 100644
--- a/pkg/proto/opMsg_test.go
+++ b/pkg/proto/opMsg_test.go
@@ -23,8 +23,9 @@ import (
"bytes"
"encoding/binary"
"fmt"
- "juno/pkg/util"
"testing"
+
+ "github.com/paypal/junodb/pkg/util"
)
func testRequestResponse(t *testing.T, rawRequest []byte, rawResponse []byte) {
diff --git a/pkg/proto/payload.go b/pkg/proto/payload.go
index e1bf4bdf..ae61c152 100644
--- a/pkg/proto/payload.go
+++ b/pkg/proto/payload.go
@@ -28,9 +28,9 @@ import (
"fmt"
"io"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/util"
"github.com/golang/snappy"
)
@@ -106,7 +106,7 @@ func (p *Payload) SetWithClearValue(value []byte) {
p.data = value
}
-///TODO
+// /TODO
func (p *Payload) GetClearValue() (value []byte, err error) {
if p.GetLength() == 0 {
return
diff --git a/pkg/proto/rawmessage.go b/pkg/proto/rawmessage.go
index 5fb11782..ea2e7e6e 100644
--- a/pkg/proto/rawmessage.go
+++ b/pkg/proto/rawmessage.go
@@ -23,10 +23,10 @@ import (
"bytes"
"io"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/debug"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/debug"
+ "github.com/paypal/junodb/pkg/util"
)
type RawMessage struct {
@@ -95,9 +95,7 @@ func (m *RawMessage) allocateBuffer(size int) {
m.body = m.buf.Bytes()
}
-//
// Note: read timeout is set at conn level
-//
func (msg *RawMessage) Read(r io.Reader) (n int, err error) {
var hBuffer [kMessageHeaderSize]byte
@@ -152,9 +150,7 @@ func (msg *RawMessage) ReadWithHeader(header []byte, r io.Reader) (n int, err er
return
}
-//
// Note: this api is not thread safe
-//
func (m *RawMessage) Write(w io.Writer) (n int, err error) {
var mheader [kMessageHeaderSize]byte
raw := mheader[:]
diff --git a/pkg/sec/certs.go b/pkg/sec/certs.go
index cacc680e..fa0b4666 100644
--- a/pkg/sec/certs.go
+++ b/pkg/sec/certs.go
@@ -20,8 +20,9 @@
package sec
import (
- "juno/third_party/forked/golang/glog"
"os"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
type localFileProtectedT struct {
diff --git a/pkg/sec/certs_test.go b/pkg/sec/certs_test.go
index a1a39e0b..d598b285 100644
--- a/pkg/sec/certs_test.go
+++ b/pkg/sec/certs_test.go
@@ -20,10 +20,11 @@
package sec
import (
- "juno/third_party/forked/golang/glog"
"os"
"reflect"
"testing"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
// Sample secrets crt, not a real crt
diff --git a/pkg/sec/gotlsimpl.go b/pkg/sec/gotlsimpl.go
index 47b026a5..07d7a4fa 100644
--- a/pkg/sec/gotlsimpl.go
+++ b/pkg/sec/gotlsimpl.go
@@ -27,9 +27,10 @@ import (
"time"
"crypto/tls"
- "juno/third_party/forked/golang/glog"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+
+ "github.com/paypal/junodb/pkg/proto"
)
type (
@@ -67,6 +68,108 @@ func (c *TlsConn) GetStateString() string {
return statStr
}
+func (c *TlsConn) GetTLSVersion() string {
+ if c.conn != nil {
+ stat := c.conn.ConnectionState()
+ return GetVersionName(stat.Version)
+ }
+ return "none"
+}
+
+func GetVersionName(ver uint16) string {
+ switch ver {
+ case tls.VersionTLS10:
+ return "TLSv1"
+ case tls.VersionTLS11:
+ return "TLSv1.1"
+ case tls.VersionTLS12:
+ return "TLSv1.2"
+ case tls.VersionTLS13:
+ return "TLSv1.3"
+ default:
+ return ""
+ }
+}
+
+func (c *TlsConn) GetCipherName() string {
+ if c.conn != nil {
+ stat := c.conn.ConnectionState()
+ return GetCipherName(stat.CipherSuite)
+ }
+ return "none"
+}
+
+func GetCipherName(cipher uint16) string {
+ switch cipher {
+ case tls.TLS_RSA_WITH_RC4_128_SHA:
+ return "RSA-RC4-128-SHA"
+ case tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA:
+ return "RSA-3DES-EDE-CBC-SHA"
+ case tls.TLS_RSA_WITH_AES_128_CBC_SHA:
+ return "AES128-SHA"
+ case tls.TLS_RSA_WITH_AES_256_CBC_SHA:
+ return "AES256-SHA"
+ case tls.TLS_RSA_WITH_AES_128_CBC_SHA256:
+ return "RSA-AES-128-CBC-SHA256"
+ case tls.TLS_RSA_WITH_AES_128_GCM_SHA256:
+ return "RSA-AES-128-GCM-SHA256"
+ case tls.TLS_RSA_WITH_AES_256_GCM_SHA384:
+ return "RSA-AES-256-GCM-SHA384"
+ case tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:
+ return "ECDHE_ECDSA_RC4_128_SHA"
+ case tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:
+ return "ECDHE_ECDSA_AES128_CBC_SHA"
+ case tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:
+ return "ECDHE_ECDSA_AES_256_CBC_SHA"
+ case tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA:
+ return "ECDHE_RSA_RC4_128_SHA"
+ case tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:
+ return "ECDHE_RSA_3DES_EDE_CBC_SHA"
+ case tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:
+ return "ECDHE_RSA_AES128_CBC_SHA"
+ case tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:
+ return "ECDHE_RSA_AES_256_CBC_SHA"
+ case tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:
+ return "ECDHE_ECDSA_AES128_CBC_SHA256"
+ case tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:
+ return "ECDHE_RSA_AES128_CBC_SHA256"
+ case tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:
+ return "ECDHE_RSA_AES128_GCM_SHA256"
+ case tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:
+ return "ECDHE_ECDSA_AES128_GCM_SHA256"
+ case tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:
+ return "ECDHE_RSA_AES256_GCM_SHA384"
+ case tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:
+ return "ECDHE_ECDSA_AES256_GCM_SHA384"
+ case tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305:
+ return "ECDHE_RSA_CHACHA20_POLY1305"
+ case tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305:
+ return "ECDHE_ECDSA_CHACHA20_POLY1305"
+ case tls.TLS_AES_128_GCM_SHA256:
+ return "TLS_AES_128_GCM_SHA256"
+ case tls.TLS_AES_256_GCM_SHA384:
+ return "TLS_AES_256_GCM_SHA384"
+ case tls.TLS_CHACHA20_POLY1305_SHA256:
+ return "TLS_CHACHA20_POLY1305_SHA256"
+ case tls.TLS_FALLBACK_SCSV:
+ return "TLS_FALLBACK_SCSV"
+ default:
+ return "unknown"
+ }
+}
+
+func (c *TlsConn) DidResume() string {
+ if c.conn != nil {
+ stat := c.conn.ConnectionState()
+ if stat.DidResume {
+ return "Yes"
+ } else {
+ return "No"
+ }
+ }
+ return "No"
+}
+
func (c *TlsConn) IsServer() bool {
return c.isServer
}
diff --git a/pkg/sec/keystore.go b/pkg/sec/keystore.go
index ba29de85..d7728d7e 100644
--- a/pkg/sec/keystore.go
+++ b/pkg/sec/keystore.go
@@ -23,10 +23,11 @@ import (
"encoding/hex"
"errors"
"fmt"
- "juno/pkg/proto"
- "juno/third_party/forked/golang/glog"
"time"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+
"github.com/BurntSushi/toml"
)
diff --git a/pkg/sec/keystore_test.go b/pkg/sec/keystore_test.go
index 3a8c0389..3e7eb737 100644
--- a/pkg/sec/keystore_test.go
+++ b/pkg/sec/keystore_test.go
@@ -20,10 +20,11 @@
package sec
import (
- "juno/pkg/proto"
"os"
"reflect"
"testing"
+
+ "github.com/paypal/junodb/pkg/proto"
)
var tomlData = []byte(`# Sample Keystore
diff --git a/pkg/sec/seccfg.go b/pkg/sec/seccfg.go
index b57344a2..883d147a 100644
--- a/pkg/sec/seccfg.go
+++ b/pkg/sec/seccfg.go
@@ -23,7 +23,7 @@ import (
"fmt"
"sync/atomic"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
var (
diff --git a/pkg/sec/secinit.go b/pkg/sec/secinit.go
index 1817dcc6..4733936c 100644
--- a/pkg/sec/secinit.go
+++ b/pkg/sec/secinit.go
@@ -23,12 +23,12 @@ import (
"fmt"
"sync"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/initmgr"
- "juno/pkg/logging"
- "juno/pkg/logging/cal"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/pkg/initmgr"
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/proto"
)
const (
@@ -60,10 +60,10 @@ var (
type Flag uint8
/*
- Two arguments required
- arg 0: *Config
- arg 1: uint8 bitmask flag
- arg 2: isServerManager (optional)
+Two arguments required
+arg 0: *Config
+arg 1: uint8 bitmask flag
+arg 2: isServerManager (optional)
*/
func Initialize(args ...interface{}) (err error) {
var cfg *Config
diff --git a/pkg/sec/sslctx.go b/pkg/sec/sslctx.go
index 1dfa0bde..0b4af3ed 100644
--- a/pkg/sec/sslctx.go
+++ b/pkg/sec/sslctx.go
@@ -28,6 +28,9 @@ import (
type (
Conn interface {
GetStateString() string
+ GetTLSVersion() string
+ GetCipherName() string
+ DidResume() string
IsServer() bool
Handshake() error
GetNetConn() net.Conn
diff --git a/pkg/service/servermgr.go b/pkg/service/servermgr.go
index 53f0bad6..d6182581 100644
--- a/pkg/service/servermgr.go
+++ b/pkg/service/servermgr.go
@@ -28,7 +28,7 @@ import (
"strings"
"syscall"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
type (
diff --git a/pkg/service/service.go b/pkg/service/service.go
index 96629915..2dff0053 100644
--- a/pkg/service/service.go
+++ b/pkg/service/service.go
@@ -27,10 +27,10 @@ import (
"sync/atomic"
"syscall"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/io"
- "juno/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/logging/cal"
)
type Service struct {
diff --git a/pkg/service/svccfg.go b/pkg/service/svccfg.go
index fc808cf5..b1971d01 100644
--- a/pkg/service/svccfg.go
+++ b/pkg/service/svccfg.go
@@ -24,8 +24,8 @@ import (
"strings"
"time"
- "juno/pkg/io"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/util"
)
const (
diff --git a/pkg/stats/appnsstats.go b/pkg/stats/appnsstats.go
index 44230817..9a2ffbe9 100644
--- a/pkg/stats/appnsstats.go
+++ b/pkg/stats/appnsstats.go
@@ -23,7 +23,7 @@ import (
"sync"
"sync/atomic"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/pkg/proto"
)
const (
diff --git a/pkg/stats/redist/stats.go b/pkg/stats/redist/stats.go
index 8674f88c..02a10b64 100644
--- a/pkg/stats/redist/stats.go
+++ b/pkg/stats/redist/stats.go
@@ -21,12 +21,13 @@ package redist
import (
"fmt"
- "juno/pkg/logging"
- "juno/pkg/util"
"strconv"
"strings"
"sync/atomic"
"time"
+
+ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/util"
)
var (
diff --git a/pkg/stats/sharedstats.go b/pkg/stats/sharedstats.go
index 9d9d7e35..2563ec89 100644
--- a/pkg/stats/sharedstats.go
+++ b/pkg/stats/sharedstats.go
@@ -23,9 +23,9 @@ import (
"fmt"
"os"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/shm"
+ "github.com/paypal/junodb/pkg/shm"
)
type (
diff --git a/pkg/stats/statelog.go b/pkg/stats/statelog.go
index 214cacd0..0a368273 100644
--- a/pkg/stats/statelog.go
+++ b/pkg/stats/statelog.go
@@ -28,9 +28,9 @@ import (
"time"
"unsafe"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/pkg/proto"
)
const (
diff --git a/pkg/udf/udfmgr_test.go b/pkg/udf/udfmgr_test.go
index d1aca400..ed35ea09 100644
--- a/pkg/udf/udfmgr_test.go
+++ b/pkg/udf/udfmgr_test.go
@@ -21,7 +21,8 @@ package udf
import (
"encoding/binary"
- "juno/third_party/forked/golang/glog"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
"fmt"
"testing"
diff --git a/pkg/udf/udfplugin.go b/pkg/udf/udfplugin.go
index 80a8e5a1..fcd3dc6e 100644
--- a/pkg/udf/udfplugin.go
+++ b/pkg/udf/udfplugin.go
@@ -26,7 +26,7 @@ import (
"plugin"
"strings"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
func loadOneUDFbyName(dir string, name string) (iudf IUDF, err error) {
diff --git a/pkg/util/cmap.go b/pkg/util/cmap.go
index 7d32db7e..762d5778 100644
--- a/pkg/util/cmap.go
+++ b/pkg/util/cmap.go
@@ -20,9 +20,10 @@
package util
import (
- "github.com/spaolacci/murmur3"
- "juno/third_party/forked/golang/glog"
"sync"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+ "github.com/spaolacci/murmur3"
)
type MapPartition struct {
diff --git a/pkg/version/version.go b/pkg/version/version.go
index 36f49f8c..028fb4fe 100644
--- a/pkg/version/version.go
+++ b/pkg/version/version.go
@@ -27,7 +27,7 @@ import (
"path/filepath"
"runtime"
- "juno/pkg/debug"
+ "github.com/paypal/junodb/pkg/debug"
)
var (
diff --git a/script/deploy.sh b/script/deploy.sh
index 27733dc3..4261eef6 100755
--- a/script/deploy.sh
+++ b/script/deploy.sh
@@ -54,12 +54,7 @@ do
$i/shutdown.sh
fi
- if [ $i != "junoclustercfg" ]; then
- cp $BUILDTOP/package_config/package/${i}/script/shutdown.sh $i
- cp $BUILDTOP/package_config/package/${i}/script/start.sh $i
- fi
-
- cp $BUILDTOP/package_config/package/${i}/script/postinstall.sh $i
+ cp $BUILDTOP/package_config/package/${i}/script/*.sh $i
cp $BUILDTOP/package_config/script/postuninstall.sh $i
cp $BUILDTOP/package_config/script/logstate.sh $i
cp $BUILDTOP/package_config/script/log.sh $i
diff --git a/test/drv/bulkload/bulkload.go b/test/drv/bulkload/bulkload.go
index 066d6c28..f7460e3f 100644
--- a/test/drv/bulkload/bulkload.go
+++ b/test/drv/bulkload/bulkload.go
@@ -21,7 +21,7 @@
//
// Tool to create a set of random keys, which can be accessed by
// [-get|-update|-set|-delete] in a subsequent command.
-//=================================================================
+// =================================================================
package main
import (
@@ -35,10 +35,10 @@ import (
"strings"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/client"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/util"
)
type CmdLine struct {
diff --git a/test/drv/junoload/dbstats.go b/test/drv/junoload/dbstats.go
index ed8b5f24..8cf414b8 100644
--- a/test/drv/junoload/dbstats.go
+++ b/test/drv/junoload/dbstats.go
@@ -22,10 +22,10 @@ package main
import (
"fmt"
- "juno/third_party/forked/golang/glog"
- "juno/third_party/forked/tecbot/gorocksdb"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/tecbot/gorocksdb"
- stor "juno/cmd/storageserv/storage/db"
+ stor "github.com/paypal/junodb/cmd/storageserv/storage/db"
)
func PrintDbStats(name string) {
diff --git a/test/drv/junoload/junoload.go b/test/drv/junoload/junoload.go
index 9297f651..ea3f2aa9 100644
--- a/test/drv/junoload/junoload.go
+++ b/test/drv/junoload/junoload.go
@@ -24,20 +24,23 @@ import (
"fmt"
"math/rand"
"net/http"
+ _ "net/http/pprof"
"os"
+ "strconv"
"strings"
"sync"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
"github.com/BurntSushi/toml"
- "juno/pkg/client"
- "juno/pkg/cmd"
- "juno/pkg/logging/cal"
- "juno/pkg/sec"
- "juno/pkg/version"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/cmd"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/sec"
+ "github.com/paypal/junodb/pkg/util"
+ "github.com/paypal/junodb/pkg/version"
)
type (
@@ -75,6 +78,8 @@ type (
logLevel string
isVariable bool
disableGetTTL bool
+ keys string
+ randomize bool
}
)
@@ -96,6 +101,7 @@ const (
func (d *SyncTestDriver) setDefaultConfig() {
d.config.SetDefault()
+
d.config.Sec = sec.DefaultConfig
d.config.Cal.Default()
d.config.Cal.Poolname = "junoload"
@@ -112,6 +118,9 @@ func (d *SyncTestDriver) setDefaultConfig() {
d.config.StatOutputRate = kDefaultStatOutputRate
d.config.isVariable = false
d.config.disableGetTTL = false
+ d.config.sKey = -1
+ d.config.eKey = -1
+ d.config.randomize = false
}
func (d *SyncTestDriver) Init(name string, desc string) {
@@ -141,6 +150,8 @@ func (d *SyncTestDriver) Init(name string, desc string) {
d.StringOption(&d.cmdOpts.dbpath, "dbpath", "", "to display rocksdb stats")
d.StringOption(&d.cmdOpts.logLevel, "log-level", "info", "specify log level")
d.BoolOption(&d.cmdOpts.disableGetTTL, "disableGetTTL", false, "not use random ttl for get operation")
+ d.StringOption(&d.cmdOpts.keys, "keys", "", "key strange, separated with ,")
+ d.BoolOption(&d.cmdOpts.randomize, "r|randomize", false, "randomize, get/update/delete")
t := &SyncTestDriver{}
t.setDefaultConfig()
@@ -160,7 +171,28 @@ func (d *SyncTestDriver) Init(name string, desc string) {
d.AddExample(name+" -s 127.0.0.1:8080 -ssl",
"\trun the driver with SSL")
d.AddExample(name+" -c config.toml", "\trun the driver with options specified in config.toml")
+}
+
+func parseKeys(key string) (start int, last int) {
+ var err error
+ list := strings.Split(key, ",")
+ start, err = strconv.Atoi(list[0])
+ if err != nil {
+ glog.Exitf("%s", err)
+ }
+ if len(list) < 2 {
+ last = start + 1
+ } else {
+ last, err = strconv.Atoi(list[1])
+ if err != nil {
+ glog.Exitf("%s", err)
+ }
+ }
+ if start < 0 || last < 0 {
+ glog.Exitf("Negative range params are not allowed.")
+ }
+ return
}
func (d *SyncTestDriver) Parse(args []string) (err error) {
@@ -235,6 +267,14 @@ func (d *SyncTestDriver) Parse(args []string) (err error) {
d.config.HttpMonAddr = ":" + d.config.HttpMonAddr
}
+ if d.cmdOpts.keys != "" {
+ start, end := parseKeys(d.cmdOpts.keys)
+ d.config.sKey = int64(start)
+ d.config.eKey = int64(end)
+ }
+
+ d.config.randomize = d.cmdOpts.randomize
+
d.config.Cal.Default()
if d.config.Cal.Enabled {
@@ -303,6 +343,10 @@ func (d *SyncTestDriver) Exec() {
var wg sync.WaitGroup
chDone := make(chan bool)
+ var numRunningExecutors util.AtomicCounter
+ numRunningExecutors.Reset()
+ numRunningExecutors.Add(int32(d.config.NumExecutor))
+
if d.config.NumExecutor > 0 {
wg.Add(1)
go func() {
@@ -322,9 +366,14 @@ func (d *SyncTestDriver) Exec() {
case <-ticker.C:
d.movingStats.PrettyPrint(os.Stdout)
d.movingStats.Reset()
+ if numRunningExecutors.Get() == 0 {
+ timer.Stop()
+ ticker.Stop()
+ close(chDone)
+ break loop
+ }
}
}
-
}()
} else {
glog.Errorf("number of executor specified is zero")
@@ -333,15 +382,17 @@ func (d *SyncTestDriver) Exec() {
d.tmStart = time.Now()
d.stats.Init()
d.movingStats.Init()
+ var start int = -1
+ var end int = -1
+
for i := 0; i < d.config.NumExecutor; i++ {
- size := d.cmdOpts.numKeys / 2
- num := size / d.config.NumExecutor
- offGet := i*num + size
+ if d.config.sKey >= 0 && d.config.eKey > d.config.sKey {
+ range_size := (d.config.eKey - d.config.sKey + int64(d.config.NumExecutor-1)) / int64(d.config.NumExecutor)
- if size > MaxDeletes {
- size = MaxDeletes
+ start = i*int(range_size) + int(d.config.sKey)
+ end = start + int(range_size) - 1 //pad
}
- offDel := i * (size / d.config.NumExecutor)
+ //fmt.Printf("s=%d, e=%d\n", start, end)
cli, err := client.New(d.config.Config)
if err != nil {
glog.Error(err)
@@ -350,15 +401,18 @@ func (d *SyncTestDriver) Exec() {
eng := &TestEngine{
rdgen: d.randgen,
recStore: RecordStore{
- numKeys: num,
- offsetDel: offDel,
- offsetGet: offGet},
+ nextKey: int(start),
+ sKey: int(start),
+ eKey: int(end),
+ randomize: d.config.randomize,
+ },
reqSequence: d.reqSequence,
// chDone: chDone,
client: cli,
stats: &d.stats,
movingStats: &d.movingStats,
numReqPerSecond: d.config.NumReqPerSecond,
+ numRunningExec: &numRunningExecutors,
}
eng.Init()
wg.Add(1)
diff --git a/test/drv/junoload/tdscfg.go b/test/drv/junoload/tdscfg.go
index 46fb27e6..2880f270 100644
--- a/test/drv/junoload/tdscfg.go
+++ b/test/drv/junoload/tdscfg.go
@@ -20,9 +20,9 @@
package main
import (
- "juno/pkg/client"
- "juno/pkg/logging/cal/config"
- "juno/pkg/sec"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/logging/cal/config"
+ "github.com/paypal/junodb/pkg/sec"
)
type (
@@ -43,5 +43,8 @@ type (
StatOutputRate int
isVariable bool
disableGetTTL bool
+ sKey int64
+ eKey int64
+ randomize bool
}
)
diff --git a/test/drv/junoload/tsteng.go b/test/drv/junoload/tsteng.go
index a9970bfc..8cdd77f8 100644
--- a/test/drv/junoload/tsteng.go
+++ b/test/drv/junoload/tsteng.go
@@ -16,20 +16,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
-
package main
import (
"encoding/binary"
+ "errors"
"fmt"
"math"
"math/rand"
"sync"
"time"
- "juno/pkg/client"
+ "github.com/paypal/junodb/pkg/client"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/third_party/forked/golang/glog"
+ "juno/pkg/util"
uuid "github.com/satori/go.uuid"
)
@@ -43,7 +45,7 @@ const (
kNumRequestTypes
)
-const MaxDeletes = 10000
+var ErrNoMoreKeys = errors.New("no more keys")
type (
RequestType uint8
@@ -53,14 +55,11 @@ type (
}
RecordStore struct {
- records []Record
- // Used for preloaded keys
- numKeys int
- currGet int
- nextDelete int
- offsetDel int
- offsetGet int
- LastDelete bool
+ records []Record
+ sKey int
+ eKey int
+ nextKey int
+ randomize bool
}
TestEngine struct {
@@ -73,6 +72,7 @@ type (
stats *Statistics
movingStats *Statistics
numReqPerSecond int
+ numRunningExec *util.AtomicCounter
}
InvokeFunc func() error
)
@@ -128,27 +128,35 @@ func (r *Record) isExpired() bool {
}
func (s *RecordStore) Add(rec Record) {
- if s.numKeys > 0 {
+ if s.isKeyRange() {
return
}
+
s.records = append(s.records, rec)
}
func (s *RecordStore) display() {
- glog.Infof("numKeys=%d currGet=%d nextDelete=%d offsetDel=%d offsetGet=%d",
- s.numKeys, s.currGet, s.nextDelete, s.offsetDel, s.offsetGet)
+ /*
+ glog.Infof("numKeys=%d currGet=%d nextDelete=%d offsetDel=%d offsetGet=%d",
+ s.numKeys, s.currGet, s.nextDelete, s.offsetDel, s.offsetGet)*/
}
func (s *RecordStore) takeRecord() (rec Record, err error) {
- if s.numKeys > 0 { // preloaded keys
- rec = Record{
- key: NewRandomKey(s.offsetDel + s.nextDelete),
+ if s.isKeyRange() {
+ var key_id int
+ if s.randomize {
+ key_id = s.sKey + rand.Intn(s.eKey-s.sKey+1)
+ } else {
+ if s.nextKey > s.eKey {
+ err = ErrNoMoreKeys
+ return
+ }
+ key_id = s.nextKey
+ s.nextKey++
}
- if s.endOfDelete() {
- err = fmt.Errorf("no more record for destroy")
- return
+ rec = Record{
+ key: NewRandomKey(key_id),
}
- s.nextDelete++
return
}
@@ -164,17 +172,23 @@ func (s *RecordStore) takeRecord() (rec Record, err error) {
}
func (s *RecordStore) getRecord() (rec Record, err error) {
- if s.numKeys > 0 { // preloaded keys
- count := s.numKeys
- if s.numKeys >= MaxDeletes {
- count = s.numKeys >> 2
+ if s.isKeyRange() {
+ var key_id int
+ if s.randomize {
+ key_id = s.sKey + rand.Intn(s.eKey-s.sKey+1)
+ } else {
+ if s.nextKey > s.eKey {
+ err = ErrNoMoreKeys
+ return
+ }
+ key_id = s.nextKey
+ s.nextKey++
}
- k := expRand(count)
- s.currGet = k
rec = Record{
- key: NewRandomKey(s.offsetGet + k),
+ key: NewRandomKey(key_id),
}
+
return
}
@@ -193,32 +207,26 @@ func (s *RecordStore) getRecord() (rec Record, err error) {
}
func (s *RecordStore) empty() bool {
- return len(s.records) == 0 && s.numKeys == 0
-}
-
-func (s *RecordStore) endOfDelete() bool {
- return s.numKeys > 0 &&
- (s.nextDelete >= s.numKeys || s.nextDelete >= MaxDeletes)
+ return len(s.records) == 0 && s.isKeyRange() == false
}
func (s *RecordStore) Get() (rec Record, err error) {
for !s.empty() {
rec, err = s.getRecord()
- if err == nil {
- return
- }
+ return
}
err = fmt.Errorf("no record")
return
}
func (s *RecordStore) Take() (rec Record, err error) {
- for !s.empty() && !s.endOfDelete() {
+ if s.isKeyRange() {
+ return s.takeRecord()
+ }
+
+ if !s.empty() {
rec, err = s.takeRecord()
- if err == nil && !rec.isExpired() {
- if s.endOfDelete() {
- s.LastDelete = true
- }
+ if err == nil {
return
}
}
@@ -226,6 +234,23 @@ func (s *RecordStore) Take() (rec Record, err error) {
return
}
+func (s *RecordStore) getNextKey() (key []byte) {
+ if s.sKey == -1 {
+ key = newTestKey()
+ } else {
+ if s.nextKey > s.eKey {
+ return nil
+ }
+ key = NewRandomKey(s.nextKey)
+ s.nextKey++
+ }
+ return
+}
+
+func (s *RecordStore) isKeyRange() bool {
+ return s.sKey > -1
+}
+
func (e *TestEngine) Init() {
e.invokeFuncs = make([]InvokeFunc, kNumRequestTypes)
e.invokeFuncs[kRequestTypeCreate] = e.invokeCreate
@@ -235,70 +260,35 @@ func (e *TestEngine) Init() {
e.invokeFuncs[kRequestTypeDestroy] = e.invokeDestroy
}
-func (e *TestEngine) restoreData() {
- if e.recStore.numKeys <= 0 || e.recStore.nextDelete <= 0 {
- return
- }
-
- count := e.recStore.nextDelete
-
- // Add back deleted keys
- glog.Infof("Add back deleted keys: count=%d", count)
- for i := 0; i < count; i++ {
-
- now := time.Now()
-
- key := NewRandomKey(e.recStore.offsetDel + i)
- _, err := e.client.Create(key, e.rdgen.createPayload())
- tm := time.Since(now)
-
- e.stats.Put(kRequestTypeCreate, tm, err)
- e.movingStats.Put(kRequestTypeCreate, tm, err)
- if err != nil {
- glog.Errorf("%s error: %s", kRequestTypeCreate.String(), err)
- e.recStore.display()
- }
- }
-}
-
func (e *TestEngine) Run(wg *sync.WaitGroup, chDone <-chan bool) {
defer wg.Done()
+ defer e.numRunningExec.Add(-1)
startTime := time.Now()
var numreq int = 0
errCount := 0
+
for {
for _, item := range e.reqSequence.items {
- if e.recStore.numKeys > 0 &&
- item.reqType == kRequestTypeCreate {
- continue
- }
for i := 0; i < item.numRequests; i++ {
select {
case <-chDone:
- e.restoreData()
return
default:
now := time.Now()
err := e.invoke(item.reqType)
tm := time.Since(now)
- if item.reqType == kRequestTypeDestroy &&
- e.recStore.endOfDelete() {
- if e.recStore.LastDelete {
- e.recStore.LastDelete = false
- } else {
- continue
- }
+ if errors.Is(err, ErrNoMoreKeys) {
+ return
}
+
e.stats.Put(item.reqType, tm, err)
e.movingStats.Put(item.reqType, tm, err)
if err != nil {
glog.Errorf("%s error: %s", item.reqType.String(), err)
- if e.recStore.numKeys > 0 {
- e.recStore.display()
- errCount++
- if errCount > 100 {
- return
- }
+ e.recStore.display()
+ errCount++
+ if errCount > 100 {
+ //return
}
}
diff := now.Sub(startTime)
@@ -355,10 +345,13 @@ func (e *TestEngine) checkSpeedForVariableTp(now time.Time, numReq int, startTim
}
func (e *TestEngine) invokeCreate() (err error) {
- if e.recStore.numKeys > 0 {
+
+ key := e.recStore.getNextKey()
+ if key == nil {
+ err = ErrNoMoreKeys
return
}
- key := newTestKey()
+
var ctx client.IContext
if ctx, err = e.client.Create(key, e.rdgen.createPayload(), client.WithTTL(e.rdgen.getTTL())); err == nil {
@@ -405,9 +398,6 @@ func (e *TestEngine) invokeSet() (err error) {
func (e *TestEngine) invokeDestroy() (err error) {
var rec Record
- if e.recStore.endOfDelete() {
- return nil
- }
if rec, err = e.recStore.Take(); err == nil {
err = e.client.Destroy(rec.key)
}
diff --git a/test/fakess/config.go b/test/fakess/config.go
index f6169bca..39521e64 100644
--- a/test/fakess/config.go
+++ b/test/fakess/config.go
@@ -1,23 +1,24 @@
-//
+//
// Copyright 2023 PayPal Inc.
-//
+//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-
-// +build
+//
+
+//go:build ignore
+// +build ignore
package main
@@ -25,13 +26,13 @@ import (
"math"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
"github.com/BurntSushi/toml"
- "juno/pkg/io"
- cal "juno/pkg/logging/cal/config"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/io"
+ cal "github.com/paypal/junodb/pkg/logging/cal/config"
+ "github.com/paypal/junodb/pkg/util"
)
var Conf = Config{
diff --git a/test/fakess/main.go b/test/fakess/main.go
index cf0c2eba..fd5ef392 100644
--- a/test/fakess/main.go
+++ b/test/fakess/main.go
@@ -1,34 +1,36 @@
-//
+//
// Copyright 2023 PayPal Inc.
-//
+//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-
-// +build
+//
+
+//go:build ignore
+// +build ignore
package main
import (
"flag"
- "juno/pkg/logging/cal"
- "juno/pkg/service"
"net"
"strconv"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/service"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
var (
diff --git a/test/fakess/requesthandler.go b/test/fakess/requesthandler.go
index ebc03ab3..837949b5 100644
--- a/test/fakess/requesthandler.go
+++ b/test/fakess/requesthandler.go
@@ -1,34 +1,36 @@
-//
+//
// Copyright 2023 PayPal Inc.
-//
+//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-
-// +build
+//
+
+//go:build ignore
+// +build ignore
package main
import (
- "juno/pkg/io"
- _ "juno/pkg/logging"
- "juno/pkg/proto"
"math/rand"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/pkg/io"
+ _ "github.com/paypal/junodb/pkg/logging"
+ "github.com/paypal/junodb/pkg/proto"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
//type IRequestHandler interface {
diff --git a/test/functest/create_test.go b/test/functest/create_test.go
index 1e4e261a..206539e0 100644
--- a/test/functest/create_test.go
+++ b/test/functest/create_test.go
@@ -24,11 +24,11 @@ import (
"testing"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/client"
- "juno/pkg/util"
- "juno/test/testutil"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/util"
+ "github.com/paypal/junodb/test/testutil"
)
/***************************************************
diff --git a/test/functest/delete_test.go b/test/functest/delete_test.go
index 0b0dfb6b..6ebb9603 100644
--- a/test/functest/delete_test.go
+++ b/test/functest/delete_test.go
@@ -21,10 +21,11 @@ package functest
import (
// "encoding/hex"
- "juno/pkg/client"
- "juno/test/testutil"
"testing"
"time"
+
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/test/testutil"
)
/************************************************************************
diff --git a/test/functest/get_test.go b/test/functest/get_test.go
index 1a8640fa..2013fd13 100644
--- a/test/functest/get_test.go
+++ b/test/functest/get_test.go
@@ -20,13 +20,14 @@
package functest
import (
- "juno/pkg/client"
- "juno/pkg/util"
- "juno/test/testutil"
"testing"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/util"
+ "github.com/paypal/junodb/test/testutil"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
/***********************************************************************
diff --git a/test/functest/set_test.go b/test/functest/set_test.go
index fc333ef9..b7133914 100644
--- a/test/functest/set_test.go
+++ b/test/functest/set_test.go
@@ -20,13 +20,14 @@
package functest
import (
- "juno/pkg/client"
- "juno/test/testutil"
"strconv"
"testing"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/test/testutil"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
/*************************************************
diff --git a/test/functest/setup_test.go b/test/functest/setup_test.go
index e5244527..27dd384e 100644
--- a/test/functest/setup_test.go
+++ b/test/functest/setup_test.go
@@ -30,19 +30,19 @@ import (
"testing"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
"github.com/BurntSushi/toml"
- "juno/cmd/proxy/config"
- "juno/pkg/client"
- "juno/pkg/cluster"
- "juno/pkg/etcd"
- "juno/pkg/io"
- "juno/pkg/logging/cal"
- "juno/pkg/sec"
- "juno/pkg/util"
- "juno/test/testutil/server"
+ "github.com/paypal/junodb/cmd/proxy/config"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/cluster"
+ "github.com/paypal/junodb/pkg/etcd"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/logging/cal"
+ "github.com/paypal/junodb/pkg/sec"
+ "github.com/paypal/junodb/pkg/util"
+ "github.com/paypal/junodb/test/testutil/server"
)
var testConfig = server.ClusterConfig{
diff --git a/test/functest/update_test.go b/test/functest/update_test.go
index 28697e15..bbc4eed4 100644
--- a/test/functest/update_test.go
+++ b/test/functest/update_test.go
@@ -24,10 +24,10 @@ import (
"testing"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/client"
- "juno/test/testutil"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/test/testutil"
)
/****************************************************
diff --git a/test/mockss/mockss.go b/test/mockss/mockss.go
index e1d87588..bc22f2fb 100644
--- a/test/mockss/mockss.go
+++ b/test/mockss/mockss.go
@@ -22,8 +22,9 @@ package main
import (
"flag"
"fmt"
- "juno/test/testutil/mock"
- "juno/third_party/forked/golang/glog"
+
+ "github.com/paypal/junodb/test/testutil/mock"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
func main() {
diff --git a/test/testutil/log/frwk/frwk.go b/test/testutil/log/frwk/frwk.go
index 63b55fae..55570efa 100644
--- a/test/testutil/log/frwk/frwk.go
+++ b/test/testutil/log/frwk/frwk.go
@@ -20,7 +20,7 @@
package frwk
import (
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
var (
diff --git a/test/testutil/mock/client.go b/test/testutil/mock/client.go
index 9cedae1e..189ab15c 100644
--- a/test/testutil/mock/client.go
+++ b/test/testutil/mock/client.go
@@ -26,11 +26,11 @@ import (
"net"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/client"
- "juno/pkg/cluster"
- "juno/pkg/proto"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/cluster"
+ "github.com/paypal/junodb/pkg/proto"
)
type MockClient struct {
diff --git a/test/testutil/mock/common.go b/test/testutil/mock/common.go
index 1d6184ed..9d203733 100644
--- a/test/testutil/mock/common.go
+++ b/test/testutil/mock/common.go
@@ -26,7 +26,7 @@ import (
"testing"
"time"
- . "juno/pkg/proto"
+ . "github.com/paypal/junodb/pkg/proto"
)
const (
diff --git a/test/testutil/mock/config.go b/test/testutil/mock/config.go
index 93a98c75..dcd03d5c 100644
--- a/test/testutil/mock/config.go
+++ b/test/testutil/mock/config.go
@@ -23,9 +23,9 @@ import (
"math"
"time"
- "juno/pkg/io"
- "juno/pkg/service"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/service"
+ "github.com/paypal/junodb/pkg/util"
)
type SSConfig struct {
diff --git a/test/testutil/mock/ssreqhandler.go b/test/testutil/mock/ssreqhandler.go
index c5942b06..40d4d86a 100644
--- a/test/testutil/mock/ssreqhandler.go
+++ b/test/testutil/mock/ssreqhandler.go
@@ -25,13 +25,13 @@ import (
"sync"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- // "juno/cmd/proxy/handler"
- "juno/pkg/io"
- "juno/pkg/proto"
- "juno/pkg/service"
- "juno/pkg/util"
+ // "github.com/paypal/junodb/cmd/proxy/handler"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/service"
+ "github.com/paypal/junodb/pkg/util"
)
var _ io.IRequestHandler = (*RequestHandler)(nil)
diff --git a/test/testutil/server/cluster.go b/test/testutil/server/cluster.go
index 4467ef7e..1d9d287b 100644
--- a/test/testutil/server/cluster.go
+++ b/test/testutil/server/cluster.go
@@ -31,16 +31,16 @@ import (
"syscall"
"time"
- "juno/third_party/forked/golang/glog"
-
- "juno/cmd/proxy/handler"
- "juno/cmd/proxy/stats"
- "juno/pkg/cluster"
- "juno/pkg/etcd"
- "juno/pkg/net/netutil"
- "juno/pkg/util"
- "juno/test/testutil/log/frwk"
- "juno/test/testutil/mock"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+
+ "github.com/paypal/junodb/cmd/proxy/handler"
+ "github.com/paypal/junodb/cmd/proxy/stats"
+ "github.com/paypal/junodb/pkg/cluster"
+ "github.com/paypal/junodb/pkg/etcd"
+ "github.com/paypal/junodb/pkg/net/netutil"
+ "github.com/paypal/junodb/pkg/util"
+ "github.com/paypal/junodb/test/testutil/log/frwk"
+ "github.com/paypal/junodb/test/testutil/mock"
)
type ICluster interface {
diff --git a/test/testutil/server/config.go b/test/testutil/server/config.go
index dde5a67f..9899ac15 100644
--- a/test/testutil/server/config.go
+++ b/test/testutil/server/config.go
@@ -20,11 +20,11 @@
package server
import (
- "juno/cmd/proxy/config"
- "juno/pkg/io"
- cal "juno/pkg/logging/cal/config"
- "juno/pkg/sec"
- "juno/pkg/util"
+ "github.com/paypal/junodb/cmd/proxy/config"
+ "github.com/paypal/junodb/pkg/io"
+ cal "github.com/paypal/junodb/pkg/logging/cal/config"
+ "github.com/paypal/junodb/pkg/sec"
+ "github.com/paypal/junodb/pkg/util"
)
type ServerDef struct {
diff --git a/test/testutil/server/inprocsrv.go b/test/testutil/server/inprocsrv.go
index 69ef735b..217c14d7 100644
--- a/test/testutil/server/inprocsrv.go
+++ b/test/testutil/server/inprocsrv.go
@@ -23,10 +23,10 @@ import (
"fmt"
"sync"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/service"
- "juno/test/testutil/log/frwk"
+ "github.com/paypal/junodb/pkg/service"
+ "github.com/paypal/junodb/test/testutil/log/frwk"
)
var _ IServer = (*InProcessServer)(nil)
diff --git a/test/testutil/server/server.go b/test/testutil/server/server.go
index 88871815..9f1c0c10 100644
--- a/test/testutil/server/server.go
+++ b/test/testutil/server/server.go
@@ -22,7 +22,6 @@ package server
import (
"fmt"
pkgio "io"
- "juno/third_party/forked/golang/glog"
"net"
"net/http"
"os"
@@ -31,11 +30,13 @@ import (
"strings"
"time"
- "juno/internal/cli"
- "juno/pkg/io"
- "juno/pkg/net/netutil"
- "juno/pkg/proto"
- "juno/test/testutil/log/frwk"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+
+ "github.com/paypal/junodb/internal/cli"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/net/netutil"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/test/testutil/log/frwk"
)
const (
diff --git a/test/testutil/server/ssnode.go b/test/testutil/server/ssnode.go
index dcd2994a..105d0469 100644
--- a/test/testutil/server/ssnode.go
+++ b/test/testutil/server/ssnode.go
@@ -23,10 +23,10 @@ import (
"fmt"
"net"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/client"
- "juno/test/testutil/ssclient"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/test/testutil/ssclient"
)
type SSNode struct {
diff --git a/test/testutil/ssclient/advssclient.go b/test/testutil/ssclient/advssclient.go
index 876e69e7..ffe0abfe 100644
--- a/test/testutil/ssclient/advssclient.go
+++ b/test/testutil/ssclient/advssclient.go
@@ -24,11 +24,11 @@ import (
"net"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/pkg/etcd"
- "juno/pkg/proto"
- "juno/pkg/util"
+ "github.com/paypal/junodb/pkg/etcd"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/util"
)
type Config struct {
diff --git a/test/testutil/ssclient/ssclient.go b/test/testutil/ssclient/ssclient.go
index 273704e0..a5a4b82a 100644
--- a/test/testutil/ssclient/ssclient.go
+++ b/test/testutil/ssclient/ssclient.go
@@ -24,12 +24,12 @@ import (
"io"
"net"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/internal/cli"
- "juno/pkg/client"
- "juno/pkg/proto"
- "juno/pkg/util"
+ "github.com/paypal/junodb/internal/cli"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/pkg/util"
)
type Record struct {
diff --git a/test/testutil/testhelper.go b/test/testutil/testhelper.go
index 537e36ee..7ac9b6cc 100644
--- a/test/testutil/testhelper.go
+++ b/test/testutil/testhelper.go
@@ -34,17 +34,17 @@ import (
"testing"
"time"
- "juno/third_party/forked/golang/glog"
-
- "juno/cmd/proxy/config"
- "juno/internal/cli"
- "juno/pkg/client"
- "juno/pkg/cluster"
- "juno/pkg/etcd"
- "juno/pkg/io"
- "juno/pkg/util"
- "juno/test/testutil/mock"
- "juno/test/testutil/server"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
+
+ "github.com/paypal/junodb/cmd/proxy/config"
+ "github.com/paypal/junodb/internal/cli"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/cluster"
+ "github.com/paypal/junodb/pkg/etcd"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/util"
+ "github.com/paypal/junodb/test/testutil/mock"
+ "github.com/paypal/junodb/test/testutil/server"
)
type KVMap map[string]string
@@ -227,7 +227,7 @@ func ApproxEqual(v1 uint32, v2 uint32, epsilon uint32) bool {
return (v2 - v1) <= epsilon
}
-//This function has to be called right after getting RecordInfo
+// This function has to be called right after getting RecordInfo
func VerifyRecordInfo(recInfo client.IContext, ver uint32, ttl uint32, creationTime uint32) error {
if recInfo == nil {
return fmt.Errorf("nil recInfo")
@@ -958,7 +958,7 @@ func LoadInitConfig(hostip string) {
time.Sleep(3 * time.Second)
}
-//temporally create redist info
+// temporally create redist info
func UpdateRedistConfig(t *testing.T, hostip string, connNo string, configFile string) {
var cmd string
var cmd1 string
@@ -989,7 +989,7 @@ func UpdateRedistConfig(t *testing.T, hostip string, connNo string, configFile s
time.Sleep(3 * time.Second)
}
-//start redist
+// start redist
func StartRedistConfig(t *testing.T, hostip string, markdown string) {
var localIp bool = false
var cmd string
@@ -1009,7 +1009,7 @@ func StartRedistConfig(t *testing.T, hostip string, markdown string) {
}
}
-//start auto redistribution
+// start auto redistribution
func StartAutoRedistConfig(t *testing.T, hostip string, markdown string) {
var localIp bool = false
var cmd string
@@ -1027,7 +1027,7 @@ func StartAutoRedistConfig(t *testing.T, hostip string, markdown string) {
exec.Command("bash", "-c", cmd).Output()
}
-//temporally check forward finish, all zones are snapshot_finish
+// temporally check forward finish, all zones are snapshot_finish
func FinishForwardCheck(t *testing.T, hostip string) {
var cmd string
if ResolveHostIp() != hostip {
@@ -1044,7 +1044,7 @@ func FinishForwardCheck(t *testing.T, hostip string) {
}
}
-//resume the aborted redistribution
+// resume the aborted redistribution
func ResumeAbortedReq(t *testing.T, hostip string) {
var cmd string
if ResolveHostIp() != hostip {
@@ -1058,7 +1058,7 @@ func ResumeAbortedReq(t *testing.T, hostip string) {
exec.Command("bash", "-c", cmd).Output()
}
-//commit the new change
+// commit the new change
func FinalizeConfig(t *testing.T, hostip string) {
var cmd string
if ResolveHostIp() != hostip {
@@ -1164,7 +1164,7 @@ func ReInitializeCluster(config server.ClusterConfig) (c *server.Cluster) {
return server.NewClusterWithConfig(&config)
}
-//This definitely will be deleted as it's a temporally workaround for shutdown issue
+// This definitely will be deleted as it's a temporally workaround for shutdown issue
func SSShutdown(hostip string, secondhost bool) {
var cmd string
if ResolveHostIp() != hostip {
diff --git a/test/testutil/tmkeeper.go b/test/testutil/tmkeeper.go
index ee269605..622a0171 100644
--- a/test/testutil/tmkeeper.go
+++ b/test/testutil/tmkeeper.go
@@ -22,7 +22,7 @@ package testutil
import (
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
type timeKeeper struct {
diff --git a/test/unittest/create_test.go b/test/unittest/create_test.go
index 7a78105f..d49974f4 100644
--- a/test/unittest/create_test.go
+++ b/test/unittest/create_test.go
@@ -21,14 +21,15 @@ package unittest
import (
"fmt"
- "juno/pkg/client"
- "juno/pkg/proto"
- "juno/test/testutil"
- "juno/test/testutil/mock"
"strconv"
"testing"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/test/testutil"
+ "github.com/paypal/junodb/test/testutil/mock"
+
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
)
var createStatusArray [7]uint8
diff --git a/test/unittest/destroy_test.go b/test/unittest/destroy_test.go
index baf68e68..f43b7854 100644
--- a/test/unittest/destroy_test.go
+++ b/test/unittest/destroy_test.go
@@ -1,29 +1,28 @@
+// Copyright 2023 PayPal Inc.
//
-// Copyright 2023 PayPal Inc.
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+// http://www.apache.org/licenses/LICENSE-2.0
//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
package unittest
import (
- "juno/pkg/client"
- "juno/pkg/proto"
- "juno/test/testutil"
- "juno/test/testutil/mock"
"testing"
+
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/test/testutil"
+ "github.com/paypal/junodb/test/testutil/mock"
)
var prepareDeleteArr [4]uint8
diff --git a/test/unittest/get_test.go b/test/unittest/get_test.go
index de355260..3235a8b9 100644
--- a/test/unittest/get_test.go
+++ b/test/unittest/get_test.go
@@ -20,11 +20,12 @@
package unittest
import (
- "juno/pkg/client"
- "juno/pkg/proto"
- "juno/test/testutil"
- "juno/test/testutil/mock"
"testing"
+
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/test/testutil"
+ "github.com/paypal/junodb/test/testutil/mock"
)
var getStatusArray [5]uint8
diff --git a/test/unittest/set_test.go b/test/unittest/set_test.go
index 2981117b..b961176e 100644
--- a/test/unittest/set_test.go
+++ b/test/unittest/set_test.go
@@ -20,11 +20,12 @@
package unittest
import (
- "juno/pkg/client"
- "juno/pkg/proto"
- "juno/test/testutil"
- "juno/test/testutil/mock"
"testing"
+
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/test/testutil"
+ "github.com/paypal/junodb/test/testutil/mock"
)
var setPrepareArray [7]uint8
diff --git a/test/unittest/setup_test.go b/test/unittest/setup_test.go
index f7541e9a..a7881275 100644
--- a/test/unittest/setup_test.go
+++ b/test/unittest/setup_test.go
@@ -28,17 +28,17 @@ import (
"testing"
"time"
- "juno/third_party/forked/golang/glog"
+ "github.com/paypal/junodb/third_party/forked/golang/glog"
- "juno/cmd/proxy/config"
- "juno/pkg/client"
- "juno/pkg/cluster"
- "juno/pkg/etcd"
- "juno/pkg/io"
- "juno/pkg/util"
+ "github.com/paypal/junodb/cmd/proxy/config"
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/cluster"
+ "github.com/paypal/junodb/pkg/etcd"
+ "github.com/paypal/junodb/pkg/io"
+ "github.com/paypal/junodb/pkg/util"
- "juno/test/testutil/mock"
- "juno/test/testutil/server"
+ "github.com/paypal/junodb/test/testutil/mock"
+ "github.com/paypal/junodb/test/testutil/server"
)
var testConfig = server.ClusterConfig{
diff --git a/test/unittest/update_test.go b/test/unittest/update_test.go
index 4f74b5e6..d8b0ef4f 100644
--- a/test/unittest/update_test.go
+++ b/test/unittest/update_test.go
@@ -20,12 +20,13 @@
package unittest
import (
- //"juno/third_party/forked/golang/glog"
- "juno/pkg/client"
- "juno/pkg/proto"
- "juno/test/testutil"
- "juno/test/testutil/mock"
+ //"github.com/paypal/junodb/third_party/forked/golang/glog"
"testing"
+
+ "github.com/paypal/junodb/pkg/client"
+ "github.com/paypal/junodb/pkg/proto"
+ "github.com/paypal/junodb/test/testutil"
+ "github.com/paypal/junodb/test/testutil/mock"
)
var updatePrepareArray [6]uint8