diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c87ad248f9c6..29cc2460037d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -584,7 +584,6 @@ /pkg/util/mon @cockroachdb/sql-queries-prs /pkg/workload/ @cockroachdb/test-eng #! @cockroachdb/sql-foundations-noreview /pkg/obs/ @cockroachdb/obs-prs -/pkg/obsservice/ @cockroachdb/obs-prs /pkg/ccl/auditloggingccl @cockroachdb/obs-prs /pkg/cmd/drt* @cockroachdb/test-eng diff --git a/.gitignore b/.gitignore index af6d232c838b..a8df34458597 100644 --- a/.gitignore +++ b/.gitignore @@ -28,8 +28,6 @@ work-Fuzz* /vendor # vendoring by `go mod vendor` may produce this file temporarily /.vendor.tmp.* -# The Observability Service binary. -/obsservice # The Workload Binary /workload # Instrumentation artifacts. diff --git a/DEPS.bzl b/DEPS.bzl index a4f1b7494d9b..9ef1f1a51d51 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -1207,16 +1207,6 @@ def go_deps(): "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/bits-and-blooms/bitset/com_github_bits_and_blooms_bitset-v1.4.0.zip", ], ) - go_repository( - name = "com_github_bkaradzic_go_lz4", - build_file_proto_mode = "disable_global", - importpath = "github.com/bkaradzic/go-lz4", - sha256 = "525f5633a4d9c8a32b5b5763c4e423ad061e773cf8cfeb21737f491feb531666", - strip_prefix = "github.com/bkaradzic/go-lz4@v1.0.0", - urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/bkaradzic/go-lz4/com_github_bkaradzic_go_lz4-v1.0.0.zip", - ], - ) go_repository( name = "com_github_bketelsen_crypt", build_file_proto_mode = "disable_global", @@ -1651,16 +1641,6 @@ def go_deps(): "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/clbanning/x2j/com_github_clbanning_x2j-v0.0.0-20191024224557-825249438eec.zip", ], ) - go_repository( - name = "com_github_clickhouse_clickhouse_go", - build_file_proto_mode = "disable_global", - importpath = "github.com/ClickHouse/clickhouse-go", - sha256 = "168ff16149cdc5b79698525a6e7b7bc7b7d5791dd0b1dbe043c7a8b1a4562f68", - strip_prefix = "github.com/ClickHouse/clickhouse-go@v1.5.4", - urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/ClickHouse/clickhouse-go/com_github_clickhouse_clickhouse_go-v1.5.4.zip", - ], - ) go_repository( name = "com_github_client9_misspell", build_file_proto_mode = "disable_global", @@ -1671,16 +1651,6 @@ def go_deps(): "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/client9/misspell/com_github_client9_misspell-v0.3.4.zip", ], ) - go_repository( - name = "com_github_cloudflare_golz4", - build_file_proto_mode = "disable_global", - importpath = "github.com/cloudflare/golz4", - sha256 = "75832d1c2989b2a0d7eb8d2cec300f6d457254d42927a23f522b164833e791d4", - strip_prefix = "github.com/cloudflare/golz4@v0.0.0-20150217214814-ef862a3cdc58", - urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cloudflare/golz4/com_github_cloudflare_golz4-v0.0.0-20150217214814-ef862a3cdc58.zip", - ], - ) go_repository( name = "com_github_cloudykit_fastprinter", build_file_proto_mode = "disable_global", @@ -2538,10 +2508,10 @@ def go_deps(): name = "com_github_denisenkom_go_mssqldb", build_file_proto_mode = "disable_global", importpath = "github.com/denisenkom/go-mssqldb", - sha256 = "568024c79d9e6c39adfa14ed4650c95ae1f976eb9c1ebee77da3c53d200080cf", - strip_prefix = "github.com/denisenkom/go-mssqldb@v0.12.0", + sha256 = "47f3f67715836b61575d2c09bc1b5ab0fea2f270ca0fd37e9da66537e4c0aab0", + strip_prefix = "github.com/denisenkom/go-mssqldb@v0.10.0", urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/denisenkom/go-mssqldb/com_github_denisenkom_go_mssqldb-v0.12.0.zip", + "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/denisenkom/go-mssqldb/com_github_denisenkom_go_mssqldb-v0.10.0.zip", ], ) go_repository( @@ -4019,16 +3989,6 @@ def go_deps(): "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang-sql/civil/com_github_golang_sql_civil-v0.0.0-20190719163853-cb61b32ac6fe.zip", ], ) - go_repository( - name = "com_github_golang_sql_sqlexp", - build_file_proto_mode = "disable_global", - importpath = "github.com/golang-sql/sqlexp", - sha256 = "edcfe6a0d8da7796b82de5d44c70d6d0e1b7a433d5b267c2895c30c4ce445342", - strip_prefix = "github.com/golang-sql/sqlexp@v0.0.0-20170517235910-f1bb20e5a188", - urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang-sql/sqlexp/com_github_golang_sql_sqlexp-v0.0.0-20170517235910-f1bb20e5a188.zip", - ], - ) go_repository( name = "com_github_golangci_lint_1", build_file_proto_mode = "disable_global", @@ -6278,16 +6238,6 @@ def go_deps(): "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/Masterminds/vcs/com_github_masterminds_vcs-v1.13.0.zip", ], ) - go_repository( - name = "com_github_matryer_is", - build_file_proto_mode = "disable_global", - importpath = "github.com/matryer/is", - sha256 = "8c49393743a0b5c61b130632e402efa55d4b03456f31aea14a269d47503df112", - strip_prefix = "github.com/matryer/is@v1.4.0", - urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/matryer/is/com_github_matryer_is-v1.4.0.zip", - ], - ) go_repository( name = "com_github_matryer_moq", build_file_proto_mode = "disable_global", @@ -7718,16 +7668,6 @@ def go_deps(): "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prashantv/protectmem/com_github_prashantv_protectmem-v0.0.0-20171002184600-e20412882b3a.zip", ], ) - go_repository( - name = "com_github_pressly_goose_v3", - build_file_proto_mode = "disable_global", - importpath = "github.com/pressly/goose/v3", - sha256 = "0f0c74470d454d3530f6b7da4007a3b27beb38b9b059badd98715dc88f535f6f", - strip_prefix = "github.com/pressly/goose/v3@v3.5.3", - urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/pressly/goose/v3/com_github_pressly_goose_v3-v3.5.3.zip", - ], - ) go_repository( name = "com_github_prometheus_alertmanager", build_file_proto_mode = "disable_global", @@ -8679,10 +8619,10 @@ def go_deps(): name = "com_github_tv42_httpunix", build_file_proto_mode = "disable_global", importpath = "github.com/tv42/httpunix", - sha256 = "3835d37bfd63336db8f0b0971368e0e9a03d70a446b32e93cbd30e99ba6e9d27", - strip_prefix = "github.com/tv42/httpunix@v0.0.0-20191220191345-2ba4b9c3382c", + sha256 = "8246ebc82e0d9d3142f5aeb50d4fcd67f3f435fb5464120c356a4e5d57ef4aa0", + strip_prefix = "github.com/tv42/httpunix@v0.0.0-20150427012821-b75d8614f926", urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/tv42/httpunix/com_github_tv42_httpunix-v0.0.0-20191220191345-2ba4b9c3382c.zip", + "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/tv42/httpunix/com_github_tv42_httpunix-v0.0.0-20150427012821-b75d8614f926.zip", ], ) go_repository( @@ -9295,16 +9235,6 @@ def go_deps(): "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/zenazn/goji/com_github_zenazn_goji-v0.9.0.zip", ], ) - go_repository( - name = "com_github_ziutek_mymysql", - build_file_proto_mode = "disable_global", - importpath = "github.com/ziutek/mymysql", - sha256 = "1ea104186e0990a3d97a1e67fcd31177849c975de4abd9399270ab0a04c025de", - strip_prefix = "github.com/ziutek/mymysql@v1.5.4", - urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/ziutek/mymysql/com_github_ziutek_mymysql-v1.5.4.zip", - ], - ) go_repository( name = "com_gitlab_golang_commonmark_html", build_file_proto_mode = "disable_global", @@ -11422,10 +11352,10 @@ def go_deps(): name = "org_bazil_fuse", build_file_proto_mode = "disable_global", importpath = "bazil.org/fuse", - sha256 = "f3ac35044c9bcf17c4e75fb8cebd826e84dbe5f9c36b24513e2a828a243ede6d", - strip_prefix = "bazil.org/fuse@v0.0.0-20200407214033-5883e5a4b512", + sha256 = "c4f8d08b812e14a7689471372b43e43a0d6c984cdf3d9e541750d69398442e5a", + strip_prefix = "bazil.org/fuse@v0.0.0-20160811212531-371fbbdaa898", urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/bazil.org/fuse/org_bazil_fuse-v0.0.0-20200407214033-5883e5a4b512.zip", + "https://storage.googleapis.com/cockroach-godeps/gomod/bazil.org/fuse/org_bazil_fuse-v0.0.0-20160811212531-371fbbdaa898.zip", ], ) go_repository( diff --git a/build/bazelutil/distdir_files.bzl b/build/bazelutil/distdir_files.bzl index d81cc3b4a106..1d05eb9818a8 100644 --- a/build/bazelutil/distdir_files.bzl +++ b/build/bazelutil/distdir_files.bzl @@ -1,7 +1,7 @@ # Code generated by generate-distdir. DO NOT EDIT. DISTDIR_FILES = { - "https://storage.googleapis.com/cockroach-godeps/gomod/bazil.org/fuse/org_bazil_fuse-v0.0.0-20200407214033-5883e5a4b512.zip": "f3ac35044c9bcf17c4e75fb8cebd826e84dbe5f9c36b24513e2a828a243ede6d", + "https://storage.googleapis.com/cockroach-godeps/gomod/bazil.org/fuse/org_bazil_fuse-v0.0.0-20160811212531-371fbbdaa898.zip": "c4f8d08b812e14a7689471372b43e43a0d6c984cdf3d9e541750d69398442e5a", "https://storage.googleapis.com/cockroach-godeps/gomod/cloud.google.com/go/accessapproval/com_google_cloud_go_accessapproval-v1.6.0.zip": "4fd31c02273e95e4032c7652822e740dbf074d77d66002df0fb96c1222fd0d1e", "https://storage.googleapis.com/cockroach-godeps/gomod/cloud.google.com/go/accesscontextmanager/com_google_cloud_go_accesscontextmanager-v1.7.0.zip": "90230ccc20b02821de0ef578914c7c32ac3189ebcce539da521228df768fa4f1", "https://storage.googleapis.com/cockroach-godeps/gomod/cloud.google.com/go/aiplatform/com_google_cloud_go_aiplatform-v1.37.0.zip": "e61385ceceb7eb9ef93c80daf51787f083470f104d113c8460794744a853c927", @@ -166,7 +166,6 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/BurntSushi/toml/com_github_burntsushi_toml-v1.4.1-0.20240526193622-a339e1f7089c.zip": "f15f0ca7a3c5a4275d3d560236f178e9d735a084534bf3b685ec5f676806230a", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/BurntSushi/xgb/com_github_burntsushi_xgb-v0.0.0-20160522181843-27f122750802.zip": "f52962c7fbeca81ea8a777d1f8b1f1d25803dc437fbb490f253344232884328e", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/BurntSushi/xgbutil/com_github_burntsushi_xgbutil-v0.0.0-20160919175755-f7c97cef3b4e.zip": "680bb03650f0f43760cab53ec7b3b159ea489f04f379bbba25b5a8d77a2de2e0", - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/ClickHouse/clickhouse-go/com_github_clickhouse_clickhouse_go-v1.5.4.zip": "168ff16149cdc5b79698525a6e7b7bc7b7d5791dd0b1dbe043c7a8b1a4562f68", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/CloudyKit/fastprinter/com_github_cloudykit_fastprinter-v0.0.0-20200109182630-33d98a066a53.zip": "7e6015de3e986e5de8bf7310887bb0d8c1c33d66c5aacbd706aeec524dfda765", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/CloudyKit/jet/v3/com_github_cloudykit_jet_v3-v3.0.0.zip": "eba40af7c0be5a2c4b0cdff2475ae6e16cb7f1acb7531a02b77de06b9b4a527a", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/CloudyKit/jet/v6/com_github_cloudykit_jet_v6-v6.2.0.zip": "24c18e2a19eb56a01fce96e2504196f85d1c2291ff448f20dd32f6247a979264", @@ -294,7 +293,6 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/bitly/go-hostpool/com_github_bitly_go_hostpool-v0.0.0-20171023180738-a3a6125de932.zip": "9a55584d7fa2c1639d0ea11cd5b437786c2eadc2401d825e699ad6445fc8e476", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/bitly/go-simplejson/com_github_bitly_go_simplejson-v0.5.0.zip": "53930281dc7fba8947c1b1f07c82952a38dcaefae23bd3c8e71d70a6daa6cb40", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/bits-and-blooms/bitset/com_github_bits_and_blooms_bitset-v1.4.0.zip": "d28e5fba87c1b32093ef868fc4ca53e4bbe94d251e53c183d3423e0a73d38741", - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/bkaradzic/go-lz4/com_github_bkaradzic_go_lz4-v1.0.0.zip": "525f5633a4d9c8a32b5b5763c4e423ad061e773cf8cfeb21737f491feb531666", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/bketelsen/crypt/com_github_bketelsen_crypt-v0.0.4.zip": "ab24f8c0386cc7fce86f4e6680c32214e1e597980bd80127ac84e71ace6763da", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/blang/semver/com_github_blang_semver-v3.5.1+incompatible.zip": "8d032399cf835b93f7cf641b5477a31a002059eed7888a775f97bd3e9677ad3c", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/blevesearch/snowballstem/com_github_blevesearch_snowballstem-v0.9.0.zip": "6640a408ddcec84810873cc678570717c02d5b7b932f37672c44caea33469506", @@ -335,7 +333,6 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/circonus-labs/circonusllhist/com_github_circonus_labs_circonusllhist-v0.1.3.zip": "4dc805d9735dd9ca9b8875c0ad23126abb5bc969c5a40c61b5bc891808dbdcb6", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/clbanning/x2j/com_github_clbanning_x2j-v0.0.0-20191024224557-825249438eec.zip": "747daafe80e4ac504626c01a1d28b1a64b785586975a47b50d62853a444b72a0", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/client9/misspell/com_github_client9_misspell-v0.3.4.zip": "a3af206372e131dd10a68ac470c66a1b18eaf51c6afacb55b2e2a06e39b90728", - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cloudflare/golz4/com_github_cloudflare_golz4-v0.0.0-20150217214814-ef862a3cdc58.zip": "75832d1c2989b2a0d7eb8d2cec300f6d457254d42927a23f522b164833e791d4", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cncf/udpa/go/com_github_cncf_udpa_go-v0.0.0-20220112060539-c52dc94e7fbe.zip": "8fe1585f25d40a5e3cd4243a92143d71ae4ee92e915e7192e72387047539438e", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cncf/xds/go/com_github_cncf_xds_go-v0.0.0-20230607035331-e9ce68804cb4.zip": "a0c6e66eade357aeda4edaa9d09612085860dc4c0b44edf8226574939bdf6091", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/apd/com_github_cockroachdb_apd-v1.1.0.zip": "fef7ec2fae220f84bfacb17fbfc1b04a666ab7f6fc04f3ff6d2b1e05c380777d", @@ -417,7 +414,7 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/decred/dcrd/crypto/blake256/com_github_decred_dcrd_crypto_blake256-v1.0.1.zip": "e4343d55494a93eb7bb7b59be9359fb8007fd36652b27a725db024f61605d515", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/decred/dcrd/dcrec/secp256k1/v4/com_github_decred_dcrd_dcrec_secp256k1_v4-v4.3.0.zip": "107cfef3902348214eb364253d75f569ea4c7a203d35eea50fa7ce10cd9cf710", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/deepmap/oapi-codegen/com_github_deepmap_oapi_codegen-v1.6.0.zip": "a89ac7cc533495fb5aa9caf2f763394af143928bf38a351495d93e220744dc4e", - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/denisenkom/go-mssqldb/com_github_denisenkom_go_mssqldb-v0.12.0.zip": "568024c79d9e6c39adfa14ed4650c95ae1f976eb9c1ebee77da3c53d200080cf", + "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/denisenkom/go-mssqldb/com_github_denisenkom_go_mssqldb-v0.10.0.zip": "47f3f67715836b61575d2c09bc1b5ab0fea2f270ca0fd37e9da66537e4c0aab0", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/dennwc/varint/com_github_dennwc_varint-v1.0.0.zip": "2918e66c0fb5a82dbfc8cca1ed34cb8ccff8188e876c0ca25f85b8247e53626f", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/denverdino/aliyungo/com_github_denverdino_aliyungo-v0.0.0-20190125010748-a747050bb1ba.zip": "a95aea20a342798881b676d44c0d42c486f646cf066b96093fa15ca1f3a1123f", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/dgraph-io/badger/com_github_dgraph_io_badger-v1.6.0.zip": "8329ae390aebec6ae360356e77a2743357ad4e0d0bd4c3ae03b7d17e01ad70aa", @@ -555,7 +552,6 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang-jwt/jwt/com_github_golang_jwt_jwt-v3.2.2+incompatible.zip": "28d6dd7cc77d0a960699196e9c2170731f65d624d675888d2ababe7e8a422955", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang-jwt/jwt/v4/com_github_golang_jwt_jwt_v4-v4.2.0.zip": "bea2e7c045b07f50b60211bee94b62c442322ded7fa893e3fda49dcdce0e2908", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang-sql/civil/com_github_golang_sql_civil-v0.0.0-20190719163853-cb61b32ac6fe.zip": "22fcd1e01cabf6ec75c6b6c8e443de029611c9dd5cc4673818d52dac465ac688", - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang-sql/sqlexp/com_github_golang_sql_sqlexp-v0.0.0-20170517235910-f1bb20e5a188.zip": "edcfe6a0d8da7796b82de5d44c70d6d0e1b7a433d5b267c2895c30c4ce445342", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang/freetype/com_github_golang_freetype-v0.0.0-20170609003504-e2365dfdc4a0.zip": "cdcb9e6a14933dcbf167b44dcd5083fc6a2e52c4fae8fb79747c691efeb7d84e", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang/geo/com_github_golang_geo-v0.0.0-20200319012246-673a6f80352d.zip": "f19bf757263775cf21790a1821cc8ac1b853fe41dd2499d9e6a434f01bd12332", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang/glog/com_github_golang_glog-v1.1.0.zip": "668beb5dd923378b00fda4ba0d965000f3f259be5ba05ebd341a2949e8f20db6", @@ -773,7 +769,6 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/martini-contrib/render/com_github_martini_contrib_render-v0.0.0-20150707142108-ec18f8345a11.zip": "2edd7f64b2f1f053f86a51856cd0f02b1f762af61a458a2e282dab76ad093d70", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/maruel/panicparse/v2/com_github_maruel_panicparse_v2-v2.2.2.zip": "347c6313a97142b29f3f5093f7f3dcfe5a08bc11e205d5a216de2eae9532fbc3", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/marusama/semaphore/com_github_marusama_semaphore-v0.0.0-20190110074507-6952cef993b2.zip": "2bc0cfc69824299ce542fd221820905ded92a3e236428f0f157887c081eb367d", - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/matryer/is/com_github_matryer_is-v1.4.0.zip": "8c49393743a0b5c61b130632e402efa55d4b03456f31aea14a269d47503df112", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/matryer/moq/com_github_matryer_moq-v0.0.0-20190312154309-6cfb0558e1bd.zip": "b9fb2bc3d0894dfaa3cc4298f49c97346ccb66f2f0e6911f4f224ffc9acc3972", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/mattn/go-colorable/com_github_mattn_go_colorable-v0.1.13.zip": "08be322dcc584a9fcfde5caf0cf878b4e11cd98f252e32bc704e92c5a4ba9d15", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/mattn/go-ieproxy/com_github_mattn_go_ieproxy-v0.0.0-20190610004146-91bb50d98149.zip": "2982ad9362d63b30a081fe7609b595fefcc7baaaeda2f5f17a7dbeb087a84020", @@ -910,7 +905,6 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/power-devops/perfstat/com_github_power_devops_perfstat-v0.0.0-20210106213030-5aafc221ea8c.zip": "3ef206586f26201742728d9ae351348179ae94bb8b0c7913aa1cdf0f13e24fd8", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/pquerna/cachecontrol/com_github_pquerna_cachecontrol-v0.0.0-20200921180117-858c6e7e6b7e.zip": "aee5feeaf00551b3448ba6ab0d56314924cbe2aff3eb56257839b528502c4b1a", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prashantv/protectmem/com_github_prashantv_protectmem-v0.0.0-20171002184600-e20412882b3a.zip": "53d930afbb812eb68b665dcbd96ac371ff600c8821cf5e43628ab283457881e9", - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/pressly/goose/v3/com_github_pressly_goose_v3-v3.5.3.zip": "0f0c74470d454d3530f6b7da4007a3b27beb38b9b059badd98715dc88f535f6f", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/alertmanager/com_github_prometheus_alertmanager-v0.23.0.zip": "1c51abe35f12ebc11de46e0d888c93fe8e85b146ced1c2ab2a49dd97cf2b1c6a", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/client_golang/com_github_prometheus_client_golang-v1.16.0.zip": "0167cee686b836da39815e4a7ea64ecc245f6a3fb9b3c3f729941ed55da7dd4f", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/client_model/com_github_prometheus_client_model-v0.3.0.zip": "2a1d147754959287fc34a7bb7c333b3d6fe0ca0d7db1606c49e8f48fd0311547", @@ -995,7 +989,7 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/tklauser/numcpus/com_github_tklauser_numcpus-v0.3.0.zip": "a5569abed62bb2d5f5f322f23fe8cae888fe98704442d59ed9e7aabfed423899", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/tmc/grpc-websocket-proxy/com_github_tmc_grpc_websocket_proxy-v0.0.0-20190109142713-0ad062ec5ee5.zip": "dadf62266d259ffb6aa1d707892b97fa36c3f39df5cae99f54d3ef7682995376", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/trivago/tgo/com_github_trivago_tgo-v1.0.7.zip": "795b3a41901f6b694195d6be9c6e7730a971fbc0ec4cd236e73cc845aca6cb7e", - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/tv42/httpunix/com_github_tv42_httpunix-v0.0.0-20191220191345-2ba4b9c3382c.zip": "3835d37bfd63336db8f0b0971368e0e9a03d70a446b32e93cbd30e99ba6e9d27", + "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/tv42/httpunix/com_github_tv42_httpunix-v0.0.0-20150427012821-b75d8614f926.zip": "8246ebc82e0d9d3142f5aeb50d4fcd67f3f435fb5464120c356a4e5d57ef4aa0", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/twitchtv/twirp/com_github_twitchtv_twirp-v8.1.0+incompatible.zip": "6a5499c6572cf367ac9c2bd7913abef5bc8ef9de5e7194d12452863ddcec6104", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/twmb/franz-go/com_github_twmb_franz_go-v1.17.1.zip": "7b571a6c5b188750c22ff7a28e94cac97f15539a1a5209ac335c7bc7c2401e82", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/twmb/franz-go/pkg/kadm/com_github_twmb_franz_go_pkg_kadm-v1.11.0.zip": "df8b445c52226a7398b9c82055548961c977cce92b1aa392581e636a5f5fcfc8", @@ -1055,7 +1049,6 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/zeebo/assert/com_github_zeebo_assert-v1.3.0.zip": "1f01421d74ff37cb8247988155be9e6877d336029bcd887a1d035fd32d7ab6ae", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/zeebo/xxh3/com_github_zeebo_xxh3-v1.0.2.zip": "190e5ef1f672e9321a1580bdd31c6440fde6044ca8168d2b489cf50cdc4f58a6", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/zenazn/goji/com_github_zenazn_goji-v0.9.0.zip": "0807a255d9d715d18427a6eedd8e4f5a22670b09e5f45fddd229c1ae38da25a9", - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/ziutek/mymysql/com_github_ziutek_mymysql-v1.5.4.zip": "1ea104186e0990a3d97a1e67fcd31177849c975de4abd9399270ab0a04c025de", "https://storage.googleapis.com/cockroach-godeps/gomod/gitlab.com/golang-commonmark/html/com_gitlab_golang_commonmark_html-v0.0.0-20191124015941-a22733972181.zip": "f2ba8985dc9d6be347a17d9200a0be0cee5ab3bce4dc601c0651a77ef2bbffc3", "https://storage.googleapis.com/cockroach-godeps/gomod/gitlab.com/golang-commonmark/linkify/com_gitlab_golang_commonmark_linkify-v0.0.0-20191026162114-a0c2df6c8f82.zip": "50d4fbb914621091b04bbcba9af9300d485b5725dcefd05caaf4dd1c9300ad3b", "https://storage.googleapis.com/cockroach-godeps/gomod/gitlab.com/golang-commonmark/markdown/com_gitlab_golang_commonmark_markdown-v0.0.0-20211110145824-bf3e522c626a.zip": "c97b7da7402ab96a7324290cda71693207b144224e217b3a3d9beb575a4a6fa7", diff --git a/go.mod b/go.mod index a65b194cf222..1a7a98b20978 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e github.com/google/btree v1.0.1 github.com/google/pprof v0.0.0-20210827144239-02619b876842 - github.com/google/uuid v1.5.0 + github.com/google/uuid v1.5.0 // indirect google.golang.org/api v0.114.0 google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 google.golang.org/grpc v1.56.3 @@ -216,7 +216,6 @@ require ( github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.0 - github.com/pressly/goose/v3 v3.5.3 github.com/prometheus/client_golang v1.16.0 github.com/prometheus/client_model v0.3.0 github.com/prometheus/common v0.42.0 @@ -314,6 +313,7 @@ require ( github.com/deepmap/oapi-codegen v1.6.0 // indirect github.com/dimchansky/utfbom v1.1.1 // indirect github.com/djherbis/atime v1.1.0 // indirect + github.com/dnaeon/go-vcr v1.2.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/eapache/go-resiliency v1.4.0 // indirect diff --git a/go.sum b/go.sum index ad983a86e8b3..9e29558e6ff1 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,4 @@ bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= cloud.google.com/go v0.0.0-20170206221025-ce650573d812/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= @@ -89,15 +88,12 @@ github.com/Azure/azure-sdk-for-go v41.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9mo github.com/Azure/azure-sdk-for-go v57.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.3.0/go.mod h1:tZoQYdDZNOiIjdSn0dVWVfl0NEPGOJqVLzSrcFk4Is0= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.1/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 h1:+5VZ72z0Qan5Bog5C+ZkgSqUbeVUd9wgtHOrIKuc5b8= @@ -183,7 +179,6 @@ github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/k github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e/go.mod h1:uw9h2sd4WWHOPdJ13MQpwK5qYWKYDumDqxWWIknEQ+k= -github.com/ClickHouse/clickhouse-go v1.5.4/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= github.com/Codefor/geohash v0.0.0-20140723084247-1b41c28e3a9d h1:iG9B49Q218F/XxXNRM7k/vWf7MKmLIS8AcJV9cGN4nA= @@ -238,7 +233,6 @@ github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugX github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= @@ -467,10 +461,8 @@ github.com/biogo/store v0.0.0-20160505134755-913427a1d5e8 h1:tYoz1OeRpx3dJZlh9T4 github.com/biogo/store v0.0.0-20160505134755-913427a1d5e8/go.mod h1:Iev9Q3MErcn+w3UOJD/DkEzllvugfdx7bGcMOFhvr/4= github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= -github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bits-and-blooms/bitset v1.4.0 h1:+YZ8ePm+He2pU3dZlIZiOeAKfrBkXi1lSrXJ/Xzgbu8= github.com/bits-and-blooms/bitset v1.4.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= -github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= @@ -521,7 +513,6 @@ github.com/charmbracelet/lipgloss v0.5.0/go.mod h1:EZLha/HbzEt7cYqdFPovlqy5FZPj0 github.com/charmbracelet/lipgloss v0.6.0 h1:1StyZB9vBSOyuZxQUcUwGr17JmojPNm87inij9N3wJY= github.com/charmbracelet/lipgloss v0.6.0/go.mod h1:tHh2wr34xcHjC2HCXIlGSG1jaDF0S0atAUvBMP6Ppuk= github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= -github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= @@ -530,14 +521,12 @@ github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmE github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= -github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -649,13 +638,11 @@ github.com/containerd/containerd v1.6.18 h1:qZbsLvmyu+Vlty0/Ex5xc0z2YtKpIsb5n45m github.com/containerd/containerd v1.6.18/go.mod h1:1RdCUu95+gc2v9t3IL+zIlpClSmew7/0YS8O5eQZrOw= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo= github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y= github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= -github.com/containerd/continuity v0.2.2/go.mod h1:pWygW9u7LtS1o4N/Tn0FoCFDIXZ7rxcMX7HX1Dmibvk= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= @@ -757,7 +744,6 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3 github.com/deepmap/oapi-codegen v1.6.0 h1:w/d1ntwh91XI0b/8ja7+u5SvA4IFfM0UNNLmiDR1gg0= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= -github.com/denisenkom/go-mssqldb v0.12.0/go.mod h1:iiK0YP1ZeepvmBQk/QpLEhhTNJgfzrpArPY/aFvc9yU= github.com/dennwc/varint v1.0.0 h1:kGNFFSSw8ToIy3obO/kKr8U9GZYUAxQEVuix4zfDWzE= github.com/dennwc/varint v1.0.0/go.mod h1:hnItb35rvZvJrbTALZtY/iQfDs48JKRG1RPpgziApxA= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= @@ -787,7 +773,6 @@ github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyG github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/cli v20.10.11+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v20.10.14+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= @@ -1164,7 +1149,6 @@ github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzw github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= -github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= @@ -1565,7 +1549,6 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible h1:jdpOPRN1zP63Td1hDQbZW73xKmzDvZHzVdNYxhnTMDA= @@ -1604,7 +1587,6 @@ github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYb github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kevinburke/go-bindata v3.13.0+incompatible h1:hThDhUBH4KjTyhfXfOgacEPfFBNjltnzl/xzfLfrPoQ= github.com/kevinburke/go-bindata v3.13.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM= @@ -1700,7 +1682,6 @@ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= @@ -1740,8 +1721,6 @@ github.com/maruel/panicparse/v2 v2.2.2 h1:4Gu/Z5oLpJCE/0/NwxrUkyn7alpqOQdJAUuchB github.com/maruel/panicparse/v2 v2.2.2/go.mod h1:WizmeHJfpyKYYKGInKv8ax8jh7DJnQE5yFDuzFfHzIU= github.com/marusama/semaphore v0.0.0-20190110074507-6952cef993b2 h1:sq+a5mb8zHbmHhrIH06oqIMGsanjpbxNgxEgZVfgpvQ= github.com/marusama/semaphore v0.0.0-20190110074507-6952cef993b2/go.mod h1:TmeOqAKoDinfPfSohs14CO3VcEf7o+Bem6JiNe05yrQ= -github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= -github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= @@ -1779,11 +1758,9 @@ github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= -github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= -github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/mattn/go-zglob v0.0.2-0.20191112051448-a8912a37f9e7/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo= @@ -1979,7 +1956,6 @@ github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59P github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= -github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -1991,7 +1967,6 @@ github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.m github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= -github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02/go.mod h1:JNdpVEzCpXBgIiv4ds+TzhN1hrtxq6ClLrTlT9OQRSc= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= @@ -2009,7 +1984,6 @@ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.5 h1:UwtQQx2pyPIgWYHRg+epgdx1/HnBQTgN3/oIYEJTQzU= github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= -github.com/ory/dockertest/v3 v3.8.1/go.mod h1:wSRQ3wmkz+uSARYMk7kVJFDBGm8x5gSxIhI7NDc+BAQ= github.com/ory/dockertest/v3 v3.9.1/go.mod h1:42Ir9hmvaAPm0Mgibk6mBPi7SFvTXxEcnztDYOJ//uM= github.com/otan/gopgkrb5 v1.0.3 h1:iDZlYPC8mxvKvpIvDu66j48Q4WqW15HuWUX+MIwjF0U= github.com/otan/gopgkrb5 v1.0.3/go.mod h1:aamIwpVk0oxQLpA6drHPvqvcPuJ7lzCSZ4NUkC+69MQ= @@ -2083,8 +2057,6 @@ github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prY github.com/pquerna/cachecontrol v0.0.0-20200921180117-858c6e7e6b7e h1:BLqxdwZ6j771IpSCRx7s/GJjXHUE00Hmu7/YegCGdzA= github.com/pquerna/cachecontrol v0.0.0-20200921180117-858c6e7e6b7e/go.mod h1:hoLfEwdY11HjRfKFH6KqnPsfxlo3BP6bJehpDv8t6sQ= github.com/prashantv/protectmem v0.0.0-20171002184600-e20412882b3a/go.mod h1:lzZQ3Noex5pfAy7mkAeCjcBDteYU85uWWnJ/y6gKU8k= -github.com/pressly/goose/v3 v3.5.3 h1:lIQIIXVbdO2RuQtJBS1e7MZjKEk0demVWt6i0YPiOrg= -github.com/pressly/goose/v3 v3.5.3/go.mod h1:IL4NNMdXx9O6hHpGbNB5l1hkVe/Avoz4gBDE5g7rQNg= github.com/prometheus/alertmanager v0.20.0/go.mod h1:9g2i48FAyZW6BtbsnvHtMHQXl2aVtrORKwKVCQ+nbrg= github.com/prometheus/alertmanager v0.23.0/go.mod h1:0MLTrjQI8EuVmvykEhcfr/7X0xmaDAZrqMgxIq3OXHk= github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -2163,7 +2135,6 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5X github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -2344,7 +2315,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/trivago/tgo v1.0.7 h1:uaWH/XIy9aWYWpjm2CU3RpcqZXmX2ysQ9/Go+d9gyrM= github.com/trivago/tgo v1.0.7/go.mod h1:w4dpD+3tzNIIiIfkWWa85w5/B77tlvdZckQ+6PkFnhc= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= github.com/twitchtv/twirp v8.1.0+incompatible h1:KGXanpa9LXdVE/V5P/tA27rkKFmXRGCtSNT7zdeeVOY= github.com/twitchtv/twirp v8.1.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A= github.com/twmb/franz-go v1.17.1 h1:0LwPsbbJeJ9R91DPUHSEd4su82WJWcTY1Zzbgbg4CeQ= @@ -2448,7 +2418,6 @@ github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= gitlab.com/golang-commonmark/html v0.0.0-20191124015941-a22733972181 h1:K+bMSIx9A7mLES1rtG+qKduLIXq40DAzYHtb0XuCukA= gitlab.com/golang-commonmark/html v0.0.0-20191124015941-a22733972181/go.mod h1:dzYhVIwWCtzPAa4QP98wfB9+mzt33MSmM8wsKiMi2ow= gitlab.com/golang-commonmark/linkify v0.0.0-20191026162114-a0c2df6c8f82 h1:oYrL81N608MLZhma3ruL8qTM4xcpYECGut8KSxRY59g= @@ -2588,7 +2557,6 @@ golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= @@ -2600,7 +2568,6 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= @@ -2742,7 +2709,6 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -2750,7 +2716,6 @@ golang.org/x/net v0.0.0-20210907225631-ff17edfbf26d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= @@ -2893,7 +2858,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -2913,7 +2877,6 @@ 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-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/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-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2926,7 +2889,6 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908143011-c212e7322662/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -3411,132 +3373,25 @@ k8s.io/utils v0.0.0-20200414100711-2df71ebbae66/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI= lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/cc v1.0.0 h1:nPibNuDEx6tvYrUAtvDTTw98rx5juGsa5zuDnKwEEQQ= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= -modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.33.9/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.33.11/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.34.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.4/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.5/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.7/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.8/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.10/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.15/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.16/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.17/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.18/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.20/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.35.22/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= modernc.org/cc/v3 v3.36.2/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= modernc.org/cc/v3 v3.37.0/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= -modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw= modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0= modernc.org/ccgo/v3 v3.0.0-20220428102840-41399a37e894/go.mod h1:eI31LL8EwEBKPpNpA4bU1/i+sKOwOrQy8D87zWUcRZc= modernc.org/ccgo/v3 v3.0.0-20220430103911-bc99d88307be/go.mod h1:bwdAnOoaIt8Ax9YdWGjxWsdkPcZyRPHqrOvJxaKAKGw= modernc.org/ccgo/v3 v3.0.0-20220904174949-82d86e1b6d56/go.mod h1:YSXjPL62P2AMSxBphRHPn7IkzhVHqkvOnRKAKh+W6ZI= -modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60= -modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw= -modernc.org/ccgo/v3 v3.11.0/go.mod h1:dGNposbDp9TOZ/1KBxghxtUp/bzErD0/0QW4hhSaBMI= -modernc.org/ccgo/v3 v3.11.1/go.mod h1:lWHxfsn13L3f7hgGsGlU28D9eUOf6y3ZYHKoPaKU0ag= -modernc.org/ccgo/v3 v3.11.3/go.mod h1:0oHunRBMBiXOKdaglfMlRPBALQqsfrCKXgw9okQ3GEw= -modernc.org/ccgo/v3 v3.12.4/go.mod h1:Bk+m6m2tsooJchP/Yk5ji56cClmN6R1cqc9o/YtbgBQ= -modernc.org/ccgo/v3 v3.12.6/go.mod h1:0Ji3ruvpFPpz+yu+1m0wk68pdr/LENABhTrDkMDWH6c= -modernc.org/ccgo/v3 v3.12.8/go.mod h1:Hq9keM4ZfjCDuDXxaHptpv9N24JhgBZmUG5q60iLgUo= -modernc.org/ccgo/v3 v3.12.11/go.mod h1:0jVcmyDwDKDGWbcrzQ+xwJjbhZruHtouiBEvDfoIsdg= -modernc.org/ccgo/v3 v3.12.14/go.mod h1:GhTu1k0YCpJSuWwtRAEHAol5W7g1/RRfS4/9hc9vF5I= -modernc.org/ccgo/v3 v3.12.18/go.mod h1:jvg/xVdWWmZACSgOiAhpWpwHWylbJaSzayCqNOJKIhs= -modernc.org/ccgo/v3 v3.12.20/go.mod h1:aKEdssiu7gVgSy/jjMastnv/q6wWGRbszbheXgWRHc8= -modernc.org/ccgo/v3 v3.12.21/go.mod h1:ydgg2tEprnyMn159ZO/N4pLBqpL7NOkJ88GT5zNU2dE= -modernc.org/ccgo/v3 v3.12.22/go.mod h1:nyDVFMmMWhMsgQw+5JH6B6o4MnZ+UQNw1pp52XYFPRk= -modernc.org/ccgo/v3 v3.12.25/go.mod h1:UaLyWI26TwyIT4+ZFNjkyTbsPsY3plAEB6E7L/vZV3w= -modernc.org/ccgo/v3 v3.12.29/go.mod h1:FXVjG7YLf9FetsS2OOYcwNhcdOLGt8S9bQ48+OP75cE= -modernc.org/ccgo/v3 v3.12.36/go.mod h1:uP3/Fiezp/Ga8onfvMLpREq+KUjUmYMxXPO8tETHtA8= -modernc.org/ccgo/v3 v3.12.38/go.mod h1:93O0G7baRST1vNj4wnZ49b1kLxt0xCW5Hsa2qRaZPqc= -modernc.org/ccgo/v3 v3.12.43/go.mod h1:k+DqGXd3o7W+inNujK15S5ZYuPoWYLpF5PYougCmthU= -modernc.org/ccgo/v3 v3.12.46/go.mod h1:UZe6EvMSqOxaJ4sznY7b23/k13R8XNlyWsO5bAmSgOE= -modernc.org/ccgo/v3 v3.12.47/go.mod h1:m8d6p0zNps187fhBwzY/ii6gxfjob1VxWb919Nk1HUk= -modernc.org/ccgo/v3 v3.12.50/go.mod h1:bu9YIwtg+HXQxBhsRDE+cJjQRuINuT9PUK4orOco/JI= -modernc.org/ccgo/v3 v3.12.51/go.mod h1:gaIIlx4YpmGO2bLye04/yeblmvWEmE4BBBls4aJXFiE= -modernc.org/ccgo/v3 v3.12.53/go.mod h1:8xWGGTFkdFEWBEsUmi+DBjwu/WLy3SSOrqEmKUjMeEg= -modernc.org/ccgo/v3 v3.12.54/go.mod h1:yANKFTm9llTFVX1FqNKHE0aMcQb1fuPJx6p8AcUx+74= -modernc.org/ccgo/v3 v3.12.55/go.mod h1:rsXiIyJi9psOwiBkplOaHye5L4MOOaCjHg1Fxkj7IeU= -modernc.org/ccgo/v3 v3.12.56/go.mod h1:ljeFks3faDseCkr60JMpeDb2GSO3TKAmrzm7q9YOcMU= -modernc.org/ccgo/v3 v3.12.57/go.mod h1:hNSF4DNVgBl8wYHpMvPqQWDQx8luqxDnNGCMM4NFNMc= -modernc.org/ccgo/v3 v3.12.60/go.mod h1:k/Nn0zdO1xHVWjPYVshDeWKqbRWIfif5dtsIOCUVMqM= -modernc.org/ccgo/v3 v3.12.66/go.mod h1:jUuxlCFZTUZLMV08s7B1ekHX5+LIAurKTTaugUr/EhQ= -modernc.org/ccgo/v3 v3.12.67/go.mod h1:Bll3KwKvGROizP2Xj17GEGOTrlvB1XcVaBrC90ORO84= -modernc.org/ccgo/v3 v3.12.73/go.mod h1:hngkB+nUUqzOf3iqsM48Gf1FZhY599qzVg1iX+BT3cQ= -modernc.org/ccgo/v3 v3.12.81/go.mod h1:p2A1duHoBBg1mFtYvnhAnQyI6vL0uw5PGYLSIgF6rYY= -modernc.org/ccgo/v3 v3.12.84/go.mod h1:ApbflUfa5BKadjHynCficldU1ghjen84tuM5jRynB7w= -modernc.org/ccgo/v3 v3.12.86/go.mod h1:dN7S26DLTgVSni1PVA3KxxHTcykyDurf3OgUzNqTSrU= -modernc.org/ccgo/v3 v3.12.90/go.mod h1:obhSc3CdivCRpYZmrvO88TXlW0NvoSVvdh/ccRjJYko= -modernc.org/ccgo/v3 v3.12.92/go.mod h1:5yDdN7ti9KWPi5bRVWPl8UNhpEAtCjuEE7ayQnzzqHA= -modernc.org/ccgo/v3 v3.13.1/go.mod h1:aBYVOUfIlcSnrsRVU8VRS35y2DIfpgkmVkYZ0tpIXi4= -modernc.org/ccgo/v3 v3.15.1/go.mod h1:md59wBwDT2LznX/OTCPoVS6KIsdRgY8xqQwBV+hkTH0= -modernc.org/ccgo/v3 v3.15.9/go.mod h1:md59wBwDT2LznX/OTCPoVS6KIsdRgY8xqQwBV+hkTH0= -modernc.org/ccgo/v3 v3.15.10/go.mod h1:wQKxoFn0ynxMuCLfFD09c8XPUCc8obfchoVR9Cn0fI8= -modernc.org/ccgo/v3 v3.15.12/go.mod h1:VFePOWoCd8uDGRJpq/zfJ29D0EVzMSyID8LCMWYbX6I= -modernc.org/ccgo/v3 v3.15.13/go.mod h1:QHtvdpeODlXjdK3tsbpyK+7U9JV4PQsrPGIbtmc0KfY= modernc.org/ccgo/v3 v3.16.4/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ= modernc.org/ccgo/v3 v3.16.6/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ= modernc.org/ccgo/v3 v3.16.8/go.mod h1:zNjwkizS+fIFDrDjIAgBSCLkWbJuHF+ar3QRn+Z9aws= modernc.org/ccgo/v3 v3.16.9/go.mod h1:zNMzC9A9xeNUepy6KuZBbugn3c0Mc9TeiJO4lgvkJDo= modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8/go.mod h1:fUB3Vn0nVPReA+7IG7yZDfjv1TMWjhQP8gCxrFAtL5g= -modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw= modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY= -modernc.org/ccorpus v1.11.1/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= -modernc.org/ccorpus v1.11.4/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= modernc.org/libc v0.0.0-20220428101251-2d5f3daf273b/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA= -modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= -modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q= -modernc.org/libc v1.11.0/go.mod h1:2lOfPmj7cz+g1MrPNmX65QCzVxgNq2C5o0jdLY2gAYg= -modernc.org/libc v1.11.2/go.mod h1:ioIyrl3ETkugDO3SGZ+6EOKvlP3zSOycUETe4XM4n8M= -modernc.org/libc v1.11.5/go.mod h1:k3HDCP95A6U111Q5TmG3nAyUcp3kR5YFZTeDS9v8vSU= -modernc.org/libc v1.11.6/go.mod h1:ddqmzR6p5i4jIGK1d/EiSw97LBcE3dK24QEwCFvgNgE= -modernc.org/libc v1.11.11/go.mod h1:lXEp9QOOk4qAYOtL3BmMve99S5Owz7Qyowzvg6LiZso= -modernc.org/libc v1.11.13/go.mod h1:ZYawJWlXIzXy2Pzghaf7YfM8OKacP3eZQI81PDLFdY8= -modernc.org/libc v1.11.16/go.mod h1:+DJquzYi+DMRUtWI1YNxrlQO6TcA5+dRRiq8HWBWRC8= -modernc.org/libc v1.11.19/go.mod h1:e0dgEame6mkydy19KKaVPBeEnyJB4LGNb0bBH1EtQ3I= -modernc.org/libc v1.11.24/go.mod h1:FOSzE0UwookyT1TtCJrRkvsOrX2k38HoInhw+cSCUGk= -modernc.org/libc v1.11.26/go.mod h1:SFjnYi9OSd2W7f4ct622o/PAYqk7KHv6GS8NZULIjKY= -modernc.org/libc v1.11.27/go.mod h1:zmWm6kcFXt/jpzeCgfvUNswM0qke8qVwxqZrnddlDiE= -modernc.org/libc v1.11.28/go.mod h1:Ii4V0fTFcbq3qrv3CNn+OGHAvzqMBvC7dBNyC4vHZlg= -modernc.org/libc v1.11.31/go.mod h1:FpBncUkEAtopRNJj8aRo29qUiyx5AvAlAxzlx9GNaVM= -modernc.org/libc v1.11.34/go.mod h1:+Tzc4hnb1iaX/SKAutJmfzES6awxfU1BPvrrJO0pYLg= -modernc.org/libc v1.11.37/go.mod h1:dCQebOwoO1046yTrfUE5nX1f3YpGZQKNcITUYWlrAWo= -modernc.org/libc v1.11.39/go.mod h1:mV8lJMo2S5A31uD0k1cMu7vrJbSA3J3waQJxpV4iqx8= -modernc.org/libc v1.11.42/go.mod h1:yzrLDU+sSjLE+D4bIhS7q1L5UwXDOw99PLSX0BlZvSQ= -modernc.org/libc v1.11.44/go.mod h1:KFq33jsma7F5WXiYelU8quMJasCCTnHK0mkri4yPHgA= -modernc.org/libc v1.11.45/go.mod h1:Y192orvfVQQYFzCNsn+Xt0Hxt4DiO4USpLNXBlXg/tM= -modernc.org/libc v1.11.47/go.mod h1:tPkE4PzCTW27E6AIKIR5IwHAQKCAtudEIeAV1/SiyBg= -modernc.org/libc v1.11.49/go.mod h1:9JrJuK5WTtoTWIFQ7QjX2Mb/bagYdZdscI3xrvHbXjE= -modernc.org/libc v1.11.51/go.mod h1:R9I8u9TS+meaWLdbfQhq2kFknTW0O3aw3kEMqDDxMaM= -modernc.org/libc v1.11.53/go.mod h1:5ip5vWYPAoMulkQ5XlSJTy12Sz5U6blOQiYasilVPsU= -modernc.org/libc v1.11.54/go.mod h1:S/FVnskbzVUrjfBqlGFIPA5m7UwB3n9fojHhCNfSsnw= -modernc.org/libc v1.11.55/go.mod h1:j2A5YBRm6HjNkoSs/fzZrSxCuwWqcMYTDPLNx0URn3M= -modernc.org/libc v1.11.56/go.mod h1:pakHkg5JdMLt2OgRadpPOTnyRXm/uzu+Yyg/LSLdi18= -modernc.org/libc v1.11.58/go.mod h1:ns94Rxv0OWyoQrDqMFfWwka2BcaF6/61CqJRK9LP7S8= -modernc.org/libc v1.11.71/go.mod h1:DUOmMYe+IvKi9n6Mycyx3DbjfzSKrdr/0Vgt3j7P5gw= -modernc.org/libc v1.11.75/go.mod h1:dGRVugT6edz361wmD9gk6ax1AbDSe0x5vji0dGJiPT0= -modernc.org/libc v1.11.82/go.mod h1:NF+Ek1BOl2jeC7lw3a7Jj5PWyHPwWD4aq3wVKxqV1fI= -modernc.org/libc v1.11.86/go.mod h1:ePuYgoQLmvxdNT06RpGnaDKJmDNEkV7ZPKI2jnsvZoE= -modernc.org/libc v1.11.87/go.mod h1:Qvd5iXTeLhI5PS0XSyqMY99282y+3euapQFxM7jYnpY= -modernc.org/libc v1.11.88/go.mod h1:h3oIVe8dxmTcchcFuCcJ4nAWaoiwzKCdv82MM0oiIdQ= -modernc.org/libc v1.11.98/go.mod h1:ynK5sbjsU77AP+nn61+k+wxUGRx9rOFcIqWYYMaDZ4c= -modernc.org/libc v1.11.101/go.mod h1:wLLYgEiY2D17NbBOEp+mIJJJBGSiy7fLL4ZrGGZ+8jI= -modernc.org/libc v1.12.0/go.mod h1:2MH3DaF/gCU8i/UBiVE1VFRos4o523M7zipmwH8SIgQ= -modernc.org/libc v1.14.1/go.mod h1:npFeGWjmZTjFeWALQLrvklVmAxv4m80jnG3+xI8FdJk= -modernc.org/libc v1.14.2/go.mod h1:MX1GBLnRLNdvmK9azU9LCxZ5lMyhrbEMK8rG3X/Fe34= -modernc.org/libc v1.14.3/go.mod h1:GPIvQVOVPizzlqyRX3l756/3ppsAgg1QgPxjr5Q4agQ= -modernc.org/libc v1.14.5/go.mod h1:2PJHINagVxO4QW/5OQdRrvMYo+bm5ClpUFfyXCYl9ak= modernc.org/libc v1.16.0/go.mod h1:N4LD6DBE9cf+Dzf9buBlzVJndKr/iJHG97vGLHYnb5A= modernc.org/libc v1.16.1/go.mod h1:JjJE0eu4yeK7tab2n4S1w8tlWd9MxXLRzheaRnAKymU= modernc.org/libc v1.16.17/go.mod h1:hYIV5VZczAmGZAnG15Vdngn5HSF5cSkbvfz2B7GRuVU= @@ -3546,41 +3401,27 @@ modernc.org/libc v1.17.4/go.mod h1:WNg2ZH56rDEwdropAJeZPQkXmDwh+JCA1s/htl6r2fA= modernc.org/libc v1.18.0/go.mod h1:vj6zehR5bfc98ipowQOM2nIDUZnVew/wNC/2tOGS+q0= modernc.org/libc v1.20.3/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0= modernc.org/libc v1.21.4/go.mod h1:przBsL5RDOZajTVslkugzLBj1evTue36jEomFQOoYuI= -modernc.org/libc v1.22.2 h1:4U7v51GyhlWqQmwCHj28Rdq2Yzwk55ovjFrdPjs8Hb0= modernc.org/libc v1.22.2/go.mod h1:uvQavJ1pZ0hIoC/jfqNoMLURIMhKzINIWypNM17puug= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= -modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc= -modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM= modernc.org/memory v1.1.1/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= modernc.org/memory v1.2.0/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= modernc.org/memory v1.3.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds= modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.14.6/go.mod h1:yiCvMv3HblGmzENNIaNtFhfaNIwcla4u2JQEwJPzfEc= -modernc.org/sqlite v1.18.2 h1:S2uFiaNPd/vTAP/4EmyY8Qe2Quzu26A2L1e25xRNTio= modernc.org/sqlite v1.18.2/go.mod h1:kvrTLEWgxUcHa2GfHBQtanR1H9ht3hTJNtKpzH9k1u0= modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= -modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= -modernc.org/tcl v1.11.0/go.mod h1:zsTUpbQ+NxQEjOjCUlImDLPv1sG8Ww0qp66ZvyOxCgw= modernc.org/tcl v1.13.2/go.mod h1:7CLiGIPo1M8Rv1Mitpv5akc2+8fxUd2y2UzC/MfMzy0= modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= -modernc.org/z v1.3.0/go.mod h1:+mvgLH814oDjtATDdT3rs84JnUIpkvAF5B8AVkNlE2g= modernc.org/z v1.5.1/go.mod h1:eWFB510QWW5Th9YGZT81s+LwvaAs3Q2yr4sP0rmLkv8= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index 43ee5cb7bebc..a117b56d65eb 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -293,12 +293,6 @@ ALL_TESTS = [ "//pkg/multitenant/tenantcostmodel:tenantcostmodel_test", "//pkg/obs/eventagg:eventagg_test", "//pkg/obs/logstream:logstream_test", - "//pkg/obsservice/obslib/ingest:ingest_test", - "//pkg/obsservice/obslib/migrations:migrations_test", - "//pkg/obsservice/obslib/process:process_test", - "//pkg/obsservice/obslib/produce:produce_test", - "//pkg/obsservice/obslib/queue:queue_test", - "//pkg/obsservice/obslib/router:router_test", "//pkg/raft/confchange:confchange_test", "//pkg/raft/quorum:quorum_test", "//pkg/raft/raftpb:raftpb_test", @@ -1579,31 +1573,6 @@ GO_TARGETS = [ "//pkg/obs/logstream:logstream", "//pkg/obs/logstream:logstream_test", "//pkg/obs:obs", - "//pkg/obsservice/cmd/obsservice:obsservice", - "//pkg/obsservice/cmd/obsservice:obsservice_lib", - "//pkg/obsservice/obslib/ingest:ingest", - "//pkg/obsservice/obslib/ingest:ingest_test", - "//pkg/obsservice/obslib/migrations:migrations", - "//pkg/obsservice/obslib/migrations:migrations_test", - "//pkg/obsservice/obslib/obsutil:obstestutil", - "//pkg/obsservice/obslib/obsutil:obsutil", - "//pkg/obsservice/obslib/obsutil:testutil", - "//pkg/obsservice/obslib/process:process", - "//pkg/obsservice/obslib/process:process_test", - "//pkg/obsservice/obslib/produce:produce", - "//pkg/obsservice/obslib/produce:produce_test", - "//pkg/obsservice/obslib/queue:queue", - "//pkg/obsservice/obslib/queue:queue_test", - "//pkg/obsservice/obslib/router:router", - "//pkg/obsservice/obslib/router:router_test", - "//pkg/obsservice/obslib/transform:transform", - "//pkg/obsservice/obslib/validate:validate", - "//pkg/obsservice/obslib:obslib", - "//pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1:logs_service", - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:common", - "//pkg/obsservice/obspb/opentelemetry-proto/logs/v1:logs", - "//pkg/obsservice/obspb/opentelemetry-proto/resource/v1:resource", - "//pkg/obsservice/obspb:obspb", "//pkg/raft/confchange:confchange", "//pkg/raft/confchange:confchange_test", "//pkg/raft/quorum:quorum", diff --git a/pkg/base/constants.go b/pkg/base/constants.go index 18cbf381eab2..f0e59b9773c8 100644 --- a/pkg/base/constants.go +++ b/pkg/base/constants.go @@ -44,8 +44,4 @@ const ( // InflightTraceDir is the directory name where the job trace dumper stores traces // when a job opts in to dumping its execution traces. InflightTraceDir = "inflight_trace_dump" - - // ObsServiceEmbedFlagValue is the special value of the --obsservice-addr flag - // configuring the CRDB node to run the Obs Service internally. - ObsServiceEmbedFlagValue = "embed" ) diff --git a/pkg/base/test_server_args.go b/pkg/base/test_server_args.go index d6b27a47db82..bf73795acf99 100644 --- a/pkg/base/test_server_args.go +++ b/pkg/base/test_server_args.go @@ -161,10 +161,6 @@ type TestServerArgs struct { // CockroachDB upgrades and periodically reports diagnostics to // Cockroach Labs. Should remain disabled during unit testing. StartDiagnosticsReporting bool - - // ObsServiceAddr is the address to which events will be exported over OTLP. - // If empty, exporting events is inhibited. - ObsServiceAddr string } // TestClusterArgs contains the parameters one can set when creating a test diff --git a/pkg/cli/cliflags/flags.go b/pkg/cli/cliflags/flags.go index bb172998fa6a..738790ca5dcf 100644 --- a/pkg/cli/cliflags/flags.go +++ b/pkg/cli/cliflags/flags.go @@ -1912,15 +1912,6 @@ commands, WARNING for client commands.`, Description: `--sql-audit-dir=XXX is an alias for --log='sinks: {file-groups: {sql-audit: {channels: SENSITIVE_ACCESS, dir: ...}}}'.`, } - ObsServiceAddr = FlagInfo{ - Name: "obsservice-addr", - EnvVar: "", - Description: `Address of an OpenTelemetry OTLP sink such as the -Observability Service or the OpenTelemetry Collector. If set, telemetry -events are exported to this address. The special value "embed" causes -the Cockroach node to run the Observability Service internally.`, - } - BuildTag = FlagInfo{ Name: "build-tag", Description: ` diff --git a/pkg/cli/flags.go b/pkg/cli/flags.go index 481713585b63..647419c48e30 100644 --- a/pkg/cli/flags.go +++ b/pkg/cli/flags.go @@ -591,10 +591,6 @@ func init() { telemetryEnabledCmds := append(serverCmds, demoCmd, statementBundleRecreateCmd) telemetryEnabledCmds = append(telemetryEnabledCmds, demoCmd.Commands()...) for _, cmd := range telemetryEnabledCmds { - f := cmd.Flags() - cliflagcfg.StringFlag(f, &serverCfg.ObsServiceAddr, cliflags.ObsServiceAddr) - _ = f.MarkHidden(cliflags.ObsServiceAddr.Name) - // Report flag usage for server commands in telemetry. We do this // only for server commands, as there is no point in accumulating // telemetry if there's no telemetry reporting loop being started. diff --git a/pkg/cmd/dev/build.go b/pkg/cmd/dev/build.go index ee7fe5766ffd..ced2cd8eb281 100644 --- a/pkg/cmd/dev/build.go +++ b/pkg/cmd/dev/build.go @@ -91,7 +91,6 @@ var buildTargetMapping = map[string]string{ "geos": geosTarget, "langgen": "//pkg/sql/opt/optgen/cmd/langgen:langgen", "libgeos": geosTarget, - "obsservice": "//pkg/obsservice/cmd/obsservice:obsservice", "optgen": "//pkg/sql/opt/optgen/cmd/optgen:optgen", "optfmt": "//pkg/sql/opt/optgen/cmd/optfmt:optfmt", "oss": cockroachTargetOss, diff --git a/pkg/cmd/dev/lint.go b/pkg/cmd/dev/lint.go index 752f3bdf6e42..5f54d44bd5ab 100644 --- a/pkg/cmd/dev/lint.go +++ b/pkg/cmd/dev/lint.go @@ -130,7 +130,6 @@ func (d *dev) lint(cmd *cobra.Command, commandLine []string) error { "build", "//pkg/cmd/cockroach-short", "//pkg/cmd/dev", - "//pkg/obsservice/cmd/obsservice", "//pkg/cmd/roachprod", "//pkg/cmd/roachtest", "--run_validations", diff --git a/pkg/cmd/dev/testdata/recorderdriven/lint b/pkg/cmd/dev/testdata/recorderdriven/lint index 74da8858e7fd..dc43180b30b7 100644 --- a/pkg/cmd/dev/testdata/recorderdriven/lint +++ b/pkg/cmd/dev/testdata/recorderdriven/lint @@ -8,4 +8,4 @@ bazel info workspace --color=no bazel run //pkg/cmd/generate-cgo:generate-cgo '--run_under=cd crdb-checkout && ' which cc bazel test //pkg/testutils/lint:lint_test --nocache_test_results --test_arg -test.v --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_env=HOME=/home/user --sandbox_writable_path=/home/user --test_output streamed --test_env=GO_SDK=/path/to/go/sdk --test_env=CC=/usr/bin/cc --test_env=CXX=/usr/bin/cc -bazel build //pkg/cmd/cockroach-short //pkg/cmd/dev //pkg/obsservice/cmd/obsservice //pkg/cmd/roachprod //pkg/cmd/roachtest --run_validations +bazel build //pkg/cmd/cockroach-short //pkg/cmd/dev //pkg/cmd/roachprod //pkg/cmd/roachtest --run_validations diff --git a/pkg/cmd/dev/testdata/recorderdriven/lint.rec b/pkg/cmd/dev/testdata/recorderdriven/lint.rec index 6178a4b8ba8f..96641f0258c2 100644 --- a/pkg/cmd/dev/testdata/recorderdriven/lint.rec +++ b/pkg/cmd/dev/testdata/recorderdriven/lint.rec @@ -19,5 +19,5 @@ which cc bazel test //pkg/testutils/lint:lint_test --nocache_test_results --test_arg -test.v --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_env=HOME=/home/user --sandbox_writable_path=/home/user --test_output streamed --test_env=GO_SDK=/path/to/go/sdk --test_env=CC=/usr/bin/cc --test_env=CXX=/usr/bin/cc ---- -bazel build //pkg/cmd/cockroach-short //pkg/cmd/dev //pkg/obsservice/cmd/obsservice //pkg/cmd/roachprod //pkg/cmd/roachtest --run_validations +bazel build //pkg/cmd/cockroach-short //pkg/cmd/dev //pkg/cmd/roachprod //pkg/cmd/roachtest --run_validations ---- diff --git a/pkg/gen/protobuf.bzl b/pkg/gen/protobuf.bzl index e5183172d8da..798f02f9efa1 100644 --- a/pkg/gen/protobuf.bzl +++ b/pkg/gen/protobuf.bzl @@ -45,11 +45,6 @@ PROTOBUF_SRCS = [ "//pkg/kv/kvserver:kvserver_go_proto", "//pkg/multitenant/mtinfopb:mtinfopb_go_proto", "//pkg/multitenant/tenantcapabilities/tenantcapabilitiespb:tenantcapabilitiespb_go_proto", - "//pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1:v1_go_proto", - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:v1_go_proto", - "//pkg/obsservice/obspb/opentelemetry-proto/logs/v1:v1_go_proto", - "//pkg/obsservice/obspb/opentelemetry-proto/resource/v1:v1_go_proto", - "//pkg/obsservice/obspb:obspb_go_proto", "//pkg/raft/raftpb:raftpb_go_proto", "//pkg/repstream/streampb:streampb_go_proto", "//pkg/roachpb:roachpb_go_proto", diff --git a/pkg/obs/BUILD.bazel b/pkg/obs/BUILD.bazel index 49daa4371ebf..8ec53b47f31b 100644 --- a/pkg/obs/BUILD.bazel +++ b/pkg/obs/BUILD.bazel @@ -2,31 +2,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "obs", - srcs = [ - "doc.go", - "event_exporter.go", - ], + srcs = ["doc.go"], importpath = "github.com/cockroachdb/cockroach/pkg/obs", visibility = ["//visibility:public"], - deps = [ - "//pkg/base", - "//pkg/obsservice/obslib", - "//pkg/obsservice/obspb", - "//pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1:logs_service", - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:common", - "//pkg/obsservice/obspb/opentelemetry-proto/logs/v1:logs", - "//pkg/obsservice/obspb/opentelemetry-proto/resource/v1:resource", - "//pkg/util/log", - "//pkg/util/mon", - "//pkg/util/netutil/addr", - "//pkg/util/stop", - "//pkg/util/syncutil", - "//pkg/util/timeutil", - "//pkg/util/tracing", - "//pkg/util/uuid", - "@com_github_cockroachdb_errors//:errors", - "@com_github_cockroachdb_logtags//:logtags", - "@org_golang_google_grpc//:grpc", - "@org_golang_google_grpc//credentials/insecure", - ], ) diff --git a/pkg/obs/doc.go b/pkg/obs/doc.go index 1cb5f3dd2af4..a0b704c5e697 100644 --- a/pkg/obs/doc.go +++ b/pkg/obs/doc.go @@ -5,6 +5,4 @@ package obs -// Package obs represents the client library for the Observability Service. -// -// The Obs Service lives in pkg/obsservice. +// Package obs contains internal utilities used by observability systems. diff --git a/pkg/obs/event_exporter.go b/pkg/obs/event_exporter.go deleted file mode 100644 index 3e763abee91c..000000000000 --- a/pkg/obs/event_exporter.go +++ /dev/null @@ -1,534 +0,0 @@ -// Copyright 2016 The Cockroach Authors. -// -// Use of this software is governed by the CockroachDB Software License -// included in the /LICENSE file. - -package obs - -import ( - "context" - "net" - "time" - - "github.com/cockroachdb/cockroach/pkg/base" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - otel_collector_pb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1" - otel_pb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/common/v1" - otel_logs_pb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/logs/v1" - otel_res_pb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/resource/v1" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/cockroach/pkg/util/mon" - "github.com/cockroachdb/cockroach/pkg/util/netutil/addr" - "github.com/cockroachdb/cockroach/pkg/util/stop" - "github.com/cockroachdb/cockroach/pkg/util/syncutil" - "github.com/cockroachdb/cockroach/pkg/util/timeutil" - "github.com/cockroachdb/cockroach/pkg/util/tracing" - "github.com/cockroachdb/cockroach/pkg/util/uuid" - "github.com/cockroachdb/errors" - "github.com/cockroachdb/logtags" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" -) - -// EventsExporterInterface abstracts exporting events to the Observability -// Service. It is implemented by EventsExporter. -type EventsExporterInterface interface { - // SetNodeInfo initializes the node information that will be included in every - // batch of events that gets exported. This information is not passed to - // NewEventsExporter() to allow the EventsExporter to be constructed before - // the node ID is known. - SetNodeInfo(NodeInfo) - - // SetDialer configures the dialer to be used when opening network connections. - SetDialer(dialer func(ctx context.Context, _ string) (net.Conn, error)) - - // Start starts the goroutine that will periodically flush the events to the - // configured sink. - // - // Flushes are triggered by the configured flush interval and by the buffer size - // threshold. - Start(context.Context, *stop.Stopper) error - - // SendEvent buffers an event to be sent. - // - // SendEvent does not block. If the buffer is full, old events are dropped. - // - // SendEvent can be called before Start(). Such events will be buffered - // (within the buffering limits) and sent after Start() is eventually called. - SendEvent(ctx context.Context, typ obspb.EventType, event *otel_logs_pb.LogRecord) -} - -// NoopEventsExporter is an EventsExporter that ignores events. -type NoopEventsExporter struct{} - -var _ EventsExporterInterface = &NoopEventsExporter{} - -// SetNodeInfo is part of the EventsExporterInterface. -func (nop NoopEventsExporter) SetNodeInfo(NodeInfo) {} - -// Start is part of the EventsExporterInterface. -func (d NoopEventsExporter) Start(ctx context.Context, stop *stop.Stopper) error { - return nil -} - -// SetDialer is part of the EventsExporterInterface. -func (nop NoopEventsExporter) SetDialer( - dialer func(ctx context.Context, _ string) (net.Conn, error), -) { -} - -// SendEvent is part of the EventsExporterInterface. -func (nop NoopEventsExporter) SendEvent(context.Context, obspb.EventType, *otel_logs_pb.LogRecord) {} - -// EventExporterTestingKnobs can be passed to Server to adjust flushing for the -// EventExporter. -type EventExporterTestingKnobs struct { - // FlushInterval, if set, overrides the default trigger interval for the - // EventExporter. - FlushInterval time.Duration - // FlushTriggerByteSize, if set, overrides the default trigger value for the - // EventExporter. - FlushTriggerByteSize uint64 - // TestConsumer, if set, sets the consumer to be used by the embedded ingest - // component used. This allows us to capture consumed events when running - // in embedded mode, so we can make assertions against them in tests. - TestConsumer obslib.EventConsumer -} - -var _ base.ModuleTestingKnobs = &EventExporterTestingKnobs{} - -// ModuleTestingKnobs implements the ModuleTestingKnobs interface. -func (e *EventExporterTestingKnobs) ModuleTestingKnobs() {} - -// EventsExporter is a buffered client for the OTLP logs gRPC service. It is -// used to export events to the Observability Service (possibly through an -// OpenTelemetry Collector). -// -// The EventsExporter buffers events and flushes them out periodically -// (according to flushInterval) and when a buffer size threshold is met -// (triggerSizeBytes). -// -// NOTE: In the future, the EventsExporter might be replaced by direct use of -// the otel Go SDK. As of this writing, though, the SDK does not support logs. -type EventsExporter struct { - clock timeutil.TimeSource - tr *tracing.Tracer - targetAddr string - - dialer func(ctx context.Context, _ string) (net.Conn, error) - - // flushInterval is the duration after which a flush is triggered. - // 0 disables this trigger. - flushInterval time.Duration - // triggerSizeBytes is the size in bytes of accumulated messages which trigger a flush. - // 0 disables this trigger. - triggerSizeBytes uint64 - maxBufferSizeBytes uint64 - - resource otel_res_pb.Resource - - // buf accumulates events to be sent. - buf eventsBuffers - - // flushC is used to signal the flusher goroutine to flush. - flushC chan struct{} - - // otelClient is the client for the OpenTelemetry Logs Service. It is used - // to push events to the Obs Service (directly or through the Otel - // Collector). - // - // Nil if the EventsExporter is not configured to send out the events. - otelClient otel_collector_pb.LogsServiceClient - conn *grpc.ClientConn -} - -var _ EventsExporterInterface = (*EventsExporter)(nil) - -// ValidateOTLPTargetAddr validates the target address filling the possible -// missing port with the default. -func ValidateOTLPTargetAddr(targetAddr string) (string, error) { - otlpHost, otlpPort, err := addr.SplitHostPort(targetAddr, "4317" /* defaultPort */) - if err != nil { - return "", errors.Newf("invalid OTLP host in --obsservice-addr=%s", targetAddr) - } - if otlpHost == "" { - return "", errors.Newf("missing OTLP host in --obsservice-addr=%s", targetAddr) - } - return net.JoinHostPort(otlpHost, otlpPort), nil -} - -// NewEventsExporter creates an EventsExporter. -// -// Start() needs to be called before the EventsExporter actually exports any -// events. -// -// An error is returned if targetAddr is invalid. -// -// flushInterval and triggerSize control the circumstances under which the -// exporter flushes its contents to the network sink. Zero values disable these -// flush triggers. -// -// maxBufferSize, if not zero, limits the size of the buffer. When a new message -// is causing the buffer to overflow, old messages are dropped. The caller must -// ensure that maxBufferSize makes sense in relation to triggerSize: triggerSize -// should be lower (otherwise the buffer will never flush based on the size -// threshold), and there should be enough of a gap between the two to generally -// fit at least one message (otherwise the buffer might again never flush, since -// incoming messages would cause old messages to be dropped and the buffer's -// size might never fall in between triggerSize and maxSize). See the diagram -// below. -// -// |msg|msg|msg|msg|msg|msg|msg|msg|msg| -// └----------------------^--------------┘ -// -// triggerSize maxBufferSize -// └--------------┘ -// sized-based flush is triggered when size falls in this range -// -// maxBufferSize should also be set such that it makes sense in relationship -// with the flush latency: only one flush is ever in flight at a time, so the -// buffer should be sized to generally hold at least the amount of data that is -// expected to be produced during the time it takes one flush to complete. -func NewEventsExporter( - targetAddr string, - clock timeutil.TimeSource, - tr *tracing.Tracer, - maxStaleness time.Duration, - triggerSizeBytes uint64, - maxBufferSizeBytes uint64, - memMonitor *mon.BytesMonitor, -) *EventsExporter { - s := &EventsExporter{ - clock: clock, - tr: tr, - targetAddr: targetAddr, - flushInterval: maxStaleness, - triggerSizeBytes: triggerSizeBytes, - maxBufferSizeBytes: maxBufferSizeBytes, - flushC: make(chan struct{}, 1), - } - s.buf.mu.events = map[obspb.EventType]*eventsBuffer{ - obspb.EventlogEvent: { - instrumentationScope: otel_pb.InstrumentationScope{ - Name: string(obspb.EventlogEvent), - Version: "1.0", - }, - }, - } - s.buf.mu.memAccount = memMonitor.MakeBoundAccount() - return s -} - -// NodeInfo groups the information identifying a node that will be included in -// all exported events. -type NodeInfo struct { - ClusterID uuid.UUID - // NodeID can be either a roachpb.NodeID (for KV nodes) or a - // base.SQLInstanceID (for SQL tenants). - NodeID int32 - // BinaryVersion is the executable's version. - BinaryVersion string - TenantID int64 -} - -// SetDialer configures the dialer to be used when opening network connections. -func (s *EventsExporter) SetDialer(dialer func(ctx context.Context, _ string) (net.Conn, error)) { - s.dialer = dialer -} - -// SetNodeInfo initializes the node information that will be included in every -// batch of events that gets exported. This information is not passed to -// NewEventsExporter() to allow the EventsExporter to be constructed before -// the node ID is known. -func (s *EventsExporter) SetNodeInfo(nodeInfo NodeInfo) { - s.resource = otel_res_pb.Resource{ - Attributes: []*otel_pb.KeyValue{ - { - Key: obspb.ClusterID, - Value: &otel_pb.AnyValue{Value: &otel_pb.AnyValue_StringValue{StringValue: nodeInfo.ClusterID.String()}}, - }, - { - Key: obspb.NodeID, - Value: &otel_pb.AnyValue{Value: &otel_pb.AnyValue_IntValue{IntValue: int64(nodeInfo.NodeID)}}, - }, - { - Key: obspb.NodeBinaryVersion, - Value: &otel_pb.AnyValue{Value: &otel_pb.AnyValue_StringValue{StringValue: nodeInfo.BinaryVersion}}, - }, - { - Key: obspb.TenantID, - Value: &otel_pb.AnyValue{Value: &otel_pb.AnyValue_IntValue{IntValue: nodeInfo.TenantID}}, - }, - }, - } -} - -// Start starts the goroutine that will periodically flush the events to the -// configured sink. -// -// Flushes are triggered by the configured flush interval and by the buffer size -// threshold. -func (s *EventsExporter) Start(ctx context.Context, stopper *stop.Stopper) error { - // TODO(andrei): Add support for TLS / mutual TLS. - opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} - if s.dialer != nil { - opts = append(opts, grpc.WithContextDialer(s.dialer)) - } - // Note that Dial is non-blocking. - conn, err := grpc.Dial(s.targetAddr, opts...) - if err != nil { - return err - } - s.otelClient = otel_collector_pb.NewLogsServiceClient(conn) - s.conn = conn - - ctx = logtags.WithTags(context.Background(), logtags.FromContext(ctx)) - ctx, cancel := context.WithCancel(ctx) - stopper.AddCloser(stop.CloserFn(func() { - cancel() - })) - ctx, sp := s.tr.StartSpanCtx(ctx, "obsservice flusher", tracing.WithSterile()) - go func() { - defer sp.Finish() - defer func() { - _ = s.conn.Close() // nolint:grpcconnclose - }() - var timer timeutil.Timer - defer timer.Stop() - if s.flushInterval != 0 { - timer.Reset(s.flushInterval) - } - for { - done := false - select { - case <-ctx.Done(): - // We'll return after flushing everything. - done = true - case <-timer.C: - timer.Read = true - timer.Reset(s.flushInterval) - case <-s.flushC: - } - - // Flush the buffers for all event types. - msgSize := uint64(0) - totalEvents := 0 - req := &otel_collector_pb.ExportLogsServiceRequest{ - ResourceLogs: []*otel_logs_pb.ResourceLogs{ - {Resource: &s.resource}, - }, - } - func() { - s.buf.mu.Lock() - defer s.buf.mu.Unlock() - // Iterate through the different types of events. - req.ResourceLogs[0].ScopeLogs = make([]*otel_logs_pb.ScopeLogs, 0, len(s.buf.mu.events)) - for _, buf := range s.buf.mu.events { - events, sizeBytes := buf.moveContents() - if len(events) == 0 { - continue - } - totalEvents += len(events) - s.buf.mu.sizeBytes -= sizeBytes - msgSize += sizeBytes - req.ResourceLogs[0].ScopeLogs = append(req.ResourceLogs[0].ScopeLogs, - &otel_logs_pb.ScopeLogs{Scope: &buf.instrumentationScope, LogRecords: events}) - } - }() - - if len(req.ResourceLogs[0].ScopeLogs) > 0 { - _, err := s.otelClient.Export(ctx, req, grpc.WaitForReady(true)) - func() { - s.buf.mu.Lock() - defer s.buf.mu.Unlock() - s.buf.mu.memAccount.Shrink(ctx, int64(msgSize)) - }() - if err != nil { - log.Warningf(ctx, "failed to export events: %s", err) - } else { - log.VInfof(ctx, 2, "exported %d events totalling %d bytes", totalEvents, msgSize) - } - } - - if done { - return - } - } - }() - return nil -} - -// eventsBuffers groups together a buffer for each EventType. -// -// Ordered exporting of events (with possible dropped events) is ensured for -// individual EventTypes, not across them. -type eventsBuffers struct { - mu struct { - syncutil.Mutex - // events stores all the buffered data, grouped by the type of event. - events map[obspb.EventType]*eventsBuffer - // sizeBytes is the sum of sizes for the eventsBuffers. - sizeBytes uint64 - // memAccount tracks the memory usage of events. - memAccount mon.BoundAccount - } -} - -var errEventTooLarge = errors.New("event is too large") - -// maybeDropEventsForSizeLocked makes sure there's room in the buffer for -// a new event with size newEventBytes. -// -// If the new event would cause the buffer to overflow (according to maxSize), -// then events are dropped from the buffer until its size drops below maxSize/2. -func (bufs *eventsBuffers) maybeDropEventsForSizeLocked( - ctx context.Context, newEventSize uint64, maxSize uint64, -) error { - if newEventSize > maxSize/2 { - return errEventTooLarge - } - size := bufs.mu.sizeBytes - if (size + newEventSize) < maxSize { - // The new message fits. There's nothing to do. - return nil - } - - // Drop the oldest events from the event types that take up the most space. - targetSize := maxSize / 2 - needToClearBytes := size - targetSize - for { - if bufs.mu.sizeBytes <= targetSize { - break - } - - // Find the largest event type. - var maxEventType obspb.EventType - maxSize := uint64(0) - for typ, buf := range bufs.mu.events { - if buf.sizeBytes > maxSize { - maxSize = buf.sizeBytes - maxEventType = typ - } - } - if maxEventType == "" { - panic("failed to find non-empty EventType") - } - - // Drop events from the largest event type. - buf := bufs.mu.events[maxEventType] - droppedBytes := buf.dropEvents(needToClearBytes) - buf.sizeBytes -= droppedBytes - bufs.mu.sizeBytes -= droppedBytes - bufs.mu.memAccount.Shrink(ctx, int64(droppedBytes)) - } - return nil -} - -// eventsBuffer represents a queue of events of a particular type (identified by -// instrumentationScope). -type eventsBuffer struct { - instrumentationScope otel_pb.InstrumentationScope - events []*otel_logs_pb.LogRecord - sizeBytes uint64 - // droppedEvents maintains the count of events that have been dropped from the - // buffer because of memory limits. - droppedEvents uint64 -} - -// moveContents empties the buffer, returning all the events in it, and their -// total byte size. -func (b *eventsBuffer) moveContents() ([]*otel_logs_pb.LogRecord, uint64) { - events := b.events - sizeBytes := b.sizeBytes - b.events = nil - b.sizeBytes = 0 - return events, sizeBytes -} - -// dropEvents drops events from b until either b is empty, or needToClearBytes -// worth of events have been dropped. Returns the bytes dropped. -func (b *eventsBuffer) dropEvents(needToClearBytes uint64) uint64 { - cleared := uint64(0) - for len(b.events) != 0 && cleared < needToClearBytes { - evSize, err := sizeOfEvent(b.events[0]) - if err != nil { - // If an event made it in the buffer, its size is supposed to be - // computable. - panic(err) - } - cleared += evSize - b.sizeBytes -= evSize - b.droppedEvents++ - b.events = b.events[1:] - } - return cleared -} - -var unrecognizedEventEveryN = log.Every(time.Minute) -var unrecognizedEventPayloadEveryN = log.Every(time.Minute) - -// SendEvent buffers an event to be sent. -// -// SendEvent does not block. If the buffer is full, old events are dropped. -// -// SendEvent can be called before Start(). Such events will be buffered -// (within the buffering limits) and sent after Start() is eventually called. -func (s *EventsExporter) SendEvent( - ctx context.Context, typ obspb.EventType, event *otel_logs_pb.LogRecord, -) { - // Make sure there's room for the new event. If there isn't, we'll drop - // events from the front of the buffer (the oldest), until there is room. - newEventSize, err := sizeOfEvent(event) - if err != nil { - if unrecognizedEventPayloadEveryN.ShouldLog() { - log.Infof(ctx, "unrecognized event payload for event type: %s (%v)", typ, event) - } - } - s.buf.mu.Lock() - defer s.buf.mu.Unlock() - if err := s.buf.maybeDropEventsForSizeLocked(ctx, newEventSize, s.maxBufferSizeBytes); err != nil { - log.Warningf(ctx, "%v", err) - return - } - - buf, ok := s.buf.mu.events[typ] - if !ok { - if unrecognizedEventEveryN.ShouldLog() { - log.Infof(ctx, "unrecognized event of type: %s (%s)", typ, event) - } - } - if err := s.buf.mu.memAccount.Grow(ctx, int64(newEventSize)); err != nil { - // No memory available. - buf.droppedEvents++ - return - } - - buf.events = append(buf.events, event) - buf.sizeBytes += newEventSize - s.buf.mu.sizeBytes += newEventSize - - // If we've hit the flush threshold, trigger a flush. - if s.triggerSizeBytes > 0 && s.buf.mu.sizeBytes > s.triggerSizeBytes { - select { - case s.flushC <- struct{}{}: - default: - } - } -} - -// sizeOfEvent computes the size, in bytes, of event. This size will be used for -// memory accounting. -// -// Returns an error if the event has a payload for which we haven't implemented -// a measurement. -func sizeOfEvent(event *otel_logs_pb.LogRecord) (uint64, error) { - switch { - case event.Body.GetBytesValue() != nil: - return uint64(len(event.Body.GetBytesValue())), nil - case event.Body.GetStringValue() != "": - return uint64(len(event.Body.GetStringValue())), nil - default: - return 0, errors.Newf("unsupported event: %s", event.Body) - } -} diff --git a/pkg/obsservice/README.md b/pkg/obsservice/README.md deleted file mode 100644 index 46597e5e7bd2..000000000000 --- a/pkg/obsservice/README.md +++ /dev/null @@ -1,121 +0,0 @@ -# CockroachDB Observability Service - -This directory contains the source code of the CRDB Observability Service - a -service that collects monitoring and observability functionality from CRDB and -serves a web console that exposes the data. - -The Obs Service is developed as a library (in the `obslib` package) and a binary -(the `cmd\obsservice` package). The idea is for other binaries to be able to -embed and extend the library (for example we imagine CockroachCloud doing so in -the future). - -## Building the Obs Service - -Build with - -```shell -./dev build obsservice -``` - -which will produce a binary in `./bin/obsservice`. - -## Running - -Assuming you're already running a local CRDB instance: - -```shell -obsservice --otlp-addr=localhost:4317 --http-addr=localhost:8081 --sink-pgurl=postgresql://root@localhost:26257?sslmode=disable -``` - -- `--otlp-addr` is the address on which the OTLP Logs gRPC service is exposed. - This address can be passed to CRDB nodes as `--obsservice-addr`. CRDB can also - be configured to export to the OpenTelemetry Collector, and the collector can - be configured to route events to the Obs Service with configuration like: -```yaml -exporters: - otlp: - endpoint: localhost:4317 - tls: - insecure: true -``` -- `--http-addr` is the address on which any HTTP-related endpoints, such as healthchecks or - metrics, will be served on. -- `--sink-pgurl` is the address which the obsservice will use to write data to after processing. - It will also be used to run migrations found in `pkg/obsservice/obslib/migrations/sqlmigrations` - on startup. TIP: Use the `sslrootcert` query parameter in the pgurl string to point to a root certificate. -- `--no-db` will prevent the obsservice from attempting to connect to the `--sink-pgurl` at startup. - This is meant for testing purposes only. - -## Building & Pushing a Docker Image - -With a local docker instance running, you can build a docker image using the Dockerfile in `pkg/obsservice/cmd/obsservice`, -which can then be pushed & hosted in GCR. Once in GCR, the image is available to be pulled by environments such -as Kubernetes. - -To build an `obsservice` docker image locally, make use of the `build-docker.sh` script in -`pkg/obsservice/cmd/obsservice`. - -```shell -$ ./pkg/obsservice/cmd/obsservice/build-docker.sh -``` - -This should create a Docker image locally. You can check this locally. -```shell - $ docker image ls | grep obsservice -obsservice latest 13c5d49056cc 12 seconds ago 156MB -``` - -You can run the image locally via Docker. -```shell -$ docker run --platform=linux/amd64 obsservice:latest -I231113 22:25:02.716505 1 main/main.go:112 [-] 1 Listening for OTLP connections on localhost:4317. -``` - -You can use environment variables to control things like the OTLP listen address. -```shell -$ docker run -e OTLP_ADDR=0.0.0.0:7171 -e HTTP_ADDR=0.0.0.0:8082 -e SINK_PGURL="postgresql://myuser@myhost:26257?foo=bar" --platform=linux/amd64 obsservice:latest -I231113 22:25:02.716505 1 main/main.go:112 [-] 1 Listening for OTLP connections on 0.0.0.0:7171. -Listening for HTTP requests on http://0.0.0.0:8082. -``` - -You can find the supported environment variables in `pkg/obsservice/cmd/obsservice/Dockerfile`. - -With the image created, you can [push it to GCR](https://cockroachlabs.atlassian.net/wiki/spaces/OI/pages/3249472038/Pushing+an+Antenna+Docker+Image+to+GCR). - -NOTE: This script is not meant to last the test of time, but rather get a prototype up and running -quickly. It is not meant for production use. The main problem with it is that it relies on -`./dev build --cross=linux` for cross compilation of the `obsservice`. -`obsservice` makes use of CGO libraries, meaning it can't be cross-compiled without Docker. Therefore, the -script uses `./dev build --cross=linux` to generate the cross-compiled artifact, copies the artifact into -`pkg/obsservice/cmd/obsservice`, and then the Dockerfile targets that artifact file to generate the Docker -image. It's probably not best practice to use `./dev build --cross` and then copy the artifact elsewhere. - -## Functionality - -1. The Obs Service exposes the OTLP Logs gRPC service and is able to ingest - events received through calls to this RPC service. Only insecure gRPC - connections are supported at the moment. Events are ingested into the - Obs Service for aggregation and eventual storage. -2. The Obs Service provides a pluggable framework to define asynchronous event processing - pipelines. Events can be routed, transformed, validated, enqueued, consumed, - processed, and stored. - -## Event ingestion - -The Obs Service ingests events using the -[OTLP](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md) -Logs [gRPC -service](https://github.com/open-telemetry/opentelemetry-proto/blob/2119dc9affc4c246f9227fa5411765b81bc91f87/opentelemetry/proto/collector/logs/v1/logs_service.proto). -CRDB exports events using a gRPC client. The events are records are grouped into -[`ResourceLogs`](https://github.com/open-telemetry/opentelemetry-proto/blob/200ccff768a29f8bd431e0a4a463da7ed58be557/opentelemetry/proto/logs/v1/logs.proto) -and,within that, into -[`ScopeLogs`](https://github.com/open-telemetry/opentelemetry-proto/blob/200ccff768a29f8bd431e0a4a463da7ed58be557/opentelemetry/proto/logs/v1/logs.proto#L64). -A resource identifies the cluster/node/tenant that is emitting the respective -events. A scope identifies the type of event; events of different types get -routed to different processing pipelines, based on this event type. Events of -unrecognized types are dropped. Currently, a single event type is supported: `"eventlog"`. -The log records carry attributes and a JSON payload representing the event. - -## Licensing - -The Observability Service is licensed as Apache 2.0. diff --git a/pkg/obsservice/cmd/obsservice/.gitignore b/pkg/obsservice/cmd/obsservice/.gitignore deleted file mode 100644 index 0f40dfd7c4d4..000000000000 --- a/pkg/obsservice/cmd/obsservice/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Copied obsservice artifacts. build-docker.sh should remove it, but this is just a safeguard. -artifact_obsservice diff --git a/pkg/obsservice/cmd/obsservice/BUILD.bazel b/pkg/obsservice/cmd/obsservice/BUILD.bazel deleted file mode 100644 index eafbe7c7663a..000000000000 --- a/pkg/obsservice/cmd/obsservice/BUILD.bazel +++ /dev/null @@ -1,32 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") - -go_library( - name = "obsservice_lib", - srcs = ["main.go"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/cmd/obsservice", - visibility = ["//visibility:private"], - deps = [ - "//pkg/cli/exit", - "//pkg/obsservice/obslib", - "//pkg/obsservice/obslib/ingest", - "//pkg/obsservice/obslib/migrations", - "//pkg/obsservice/obslib/obsutil", - "//pkg/obsservice/obslib/router", - "//pkg/obsservice/obspb", - "//pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1:logs_service", - "//pkg/util/log", - "//pkg/util/stop", - "//pkg/util/sysutil", - "@com_github_cockroachdb_errors//:errors", - "@com_github_jackc_pgx_v5//pgxpool", - "@com_github_spf13_cobra//:cobra", - "@org_golang_google_grpc//:grpc", - "@org_golang_x_sys//unix", - ], -) - -go_binary( - name = "obsservice", - embed = [":obsservice_lib"], - visibility = ["//visibility:public"], -) diff --git a/pkg/obsservice/cmd/obsservice/Dockerfile b/pkg/obsservice/cmd/obsservice/Dockerfile deleted file mode 100644 index 7103c04f5637..000000000000 --- a/pkg/obsservice/cmd/obsservice/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -# Generates a Docker image of the obsservice binary. -# Use OTLP_ADDR and HTTP_ADDR env vars when running the image to control -# the ports/addresses that are listened on for each. Defaults are used -# otherwise (:4317 and :8081). -# -# You'll need to expose relevant ports when running the image. - -FROM --platform=linux/amd64 debian:stable-slim -WORKDIR /bin -ENV OTLP_ADDR=0.0.0.0:4317 -ENV HTTP_ADDR=0.0.0.0:8081 -ENV SINK_PGURL="postgresql://root@0.0.0.0:26257?sslmode=disable" -ENV NO_DB=false -COPY ./artifact_obsservice /bin/ -CMD /bin/artifact_obsservice --otlp-addr=$OTLP_ADDR --http-addr=$HTTP_ADDR --sink-pgurl=$SINK_PGURL --no-db=$NO_DB diff --git a/pkg/obsservice/cmd/obsservice/build-docker.sh b/pkg/obsservice/cmd/obsservice/build-docker.sh deleted file mode 100755 index 885d3e3669d8..000000000000 --- a/pkg/obsservice/cmd/obsservice/build-docker.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Copyright 2023 The Cockroach Authors. -# -# Use of this software is governed by the CockroachDB Software License -# included in the /LICENSE file. - - -## This script is in support of a Dockerfile that we hacked together -## in the interest of prototyping speed. The obsservice binary has -## cgo dependencies, meaning we need to build within Docker when -## cross compiling for linux. We decided to just use the `dev` build -## system to cross compile into the $CRDB_ROOT/artifacts directory, and -## then use that file as the basis for our Docker image. This might not -## be the best approach, but it works for now. - -echo "Begin cross compiling obsservice binary..." - -echo "Running dev in $PWD to cross compile obsservice binary..." -if [[ $(./dev build obsservice --cross=linux) ]]; then - echo "obsservice binary successfully cross compiled" -else - echo "obsservice binary failed to cross compile. Exiting." - exit 1 -fi - -echo "Copying obsservice binary to pkg/obsservice/cmd/obsservice to make available to Dockerfile" -echo "NOTE: This is a quick hack solution made for prototyping. It should not be used beyond that." - -cp artifacts/obsservice pkg/obsservice/cmd/obsservice/artifact_obsservice - -echo "Building obsservice docker image." - -cd pkg/obsservice/cmd/obsservice - -echo "(Now running in $PWD)" - -docker build -t obsservice . - -echo "Finalizing... Removing copied obsservice artifact. Check $ docker image ls to see image." -rm artifact_obsservice - - diff --git a/pkg/obsservice/cmd/obsservice/main.go b/pkg/obsservice/cmd/obsservice/main.go deleted file mode 100644 index cfb6f11d5b3e..000000000000 --- a/pkg/obsservice/cmd/obsservice/main.go +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright 2022 The Cockroach Authors. -// -// Licensed 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 - -package main - -import ( - "context" - "flag" - "net" - "os" - "os/signal" - "time" - - "github.com/cockroachdb/cockroach/pkg/cli/exit" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/ingest" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/migrations" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/obsutil" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/router" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - logspb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/cockroach/pkg/util/stop" - "github.com/cockroachdb/cockroach/pkg/util/sysutil" - "github.com/cockroachdb/errors" - "github.com/jackc/pgx/v5/pgxpool" - "github.com/spf13/cobra" - "golang.org/x/sys/unix" - "google.golang.org/grpc" -) - -// drainSignals are the signals that will cause the server to drain and exit. -// -// The signals will initiate a graceful shutdown. If received a second time, -// SIGINT will be reraised without a signal handler and the default action -// terminate the process abruptly. -// -// Receiving SIGTERM a second time does not do a brutal shutdown, as SIGTERM is -// named termSignal below. -var drainSignals = []os.Signal{unix.SIGINT, unix.SIGTERM} - -// termSignal is the signal that causes an idempotent graceful -// shutdown (i.e. second occurrence does not incur hard shutdown). -var termSignal os.Signal = unix.SIGTERM - -// defaultSinkDBName is the sink database name used for DB migrations, writes, etc. -var defaultSinkDBName = "obsservice" - -// RootCmd represents the base command when called without any subcommands -var RootCmd = &cobra.Command{ - Use: "obsservice", - Short: "An observability service for CockroachDB", - Long: `The Observability Service ingests monitoring and observability data -from one or more CockroachDB clusters.`, - SilenceUsage: true, - RunE: func(cmd *cobra.Command, args []string) error { - ctx := context.Background() - - if !noDB { - connCfg, err := pgxpool.ParseConfig(sinkPGURL) - if err != nil { - return errors.Wrapf(err, "invalid --sink-pgurl (%s)", sinkPGURL) - } - if connCfg.ConnConfig.Database != defaultSinkDBName { - if connCfg.ConnConfig.Database != "" { - log.Warningf(ctx, - "--sink-pgurl string contains a database name (%s) other than 'obsservice' - overriding", - connCfg.ConnConfig.Database) - } - // We don't want to accidentally write things to the wrong DB in the event that - // one is accidentally provided in the --sink-pgurl (as is common with defaultdb). - // Always override to defaultSinkDBName. - connCfg.ConnConfig.Database = defaultSinkDBName - } - if err := migrations.RunDBMigrations(ctx, connCfg.ConnConfig); err != nil { - return errors.Wrap(err, "failed to run DB migrations") - } - } else { - log.Info(ctx, "--no-db flag indicated, skipping DB migrations") - } - - signalCh := make(chan os.Signal, 1) - signal.Notify(signalCh, drainSignals...) - - stopper := stop.NewStopper() - - // Run the event ingestion in the background. - eventRouter := router.NewEventRouter(map[obspb.EventType]obslib.EventConsumer{ - obspb.EventlogEvent: &obsutil.StdOutConsumer{}, - }) - ingester := ingest.MakeEventIngester(ctx, eventRouter, nil) - - // Instantiate the net listener & gRPC server. - listener, err := net.Listen("tcp", otlpAddr) - if err != nil { - return errors.Wrapf(err, "failed to listen for incoming HTTP connections on address %s", otlpAddr) - } - grpcServer := grpc.NewServer() - logspb.RegisterLogsServiceServer(grpcServer, ingester) - if err := stopper.RunAsyncTask(ctx, "server-quiesce", func(ctx context.Context) { - <-stopper.ShouldQuiesce() - grpcServer.GracefulStop() - }); err != nil { - return err - } - if err := stopper.RunAsyncTask(ctx, "event-ingester-server", func(ctx context.Context) { - if err := grpcServer.Serve(listener); err != nil { - log.Fatalf(ctx, "gRPC server returned an unexpected error: %+v", err) - } - }); err != nil { - return err - } - log.Infof(ctx, "Listening for OTLP connections on %s.\n", otlpAddr) - - // Block until the process is signaled to terminate. - sig := <-signalCh - log.Infof(ctx, "received signal %s. Shutting down.", sig) - go func() { - stopper.Stop(ctx) - }() - - // Print the shutdown progress every 5 seconds. - go func() { - ticker := time.NewTicker(5 * time.Second) - defer ticker.Stop() - for { - select { - case <-ticker.C: - log.Infof(ctx, "%d running tasks", stopper.NumTasks()) - case <-stopper.IsStopped(): - return - } - } - }() - - // Wait until the shutdown is complete or we receive another signal. - select { - case <-stopper.IsStopped(): - log.Infof(ctx, "shutdown complete") - case sig = <-signalCh: - switch sig { - case termSignal: - log.Infof(ctx, "received SIGTERM while shutting down. Continuing shutdown.") - default: - // Crash. - handleSignalDuringShutdown(sig) - } - } - return nil - }, -} - -// Flags. -var ( - otlpAddr string - httpAddr string - noDB bool - sinkPGURL string -) - -func main() { - - // Add all the flags registered with the standard "flag" package. Useful for - // --vmodule, for example. - RootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine) - - RootCmd.PersistentFlags().StringVar( - &otlpAddr, - "otlp-addr", - "localhost:4317", - "The address on which to listen for exported events using OTLP gRPC. If the port is missing, 4317 is used.") - RootCmd.PersistentFlags().StringVar( - &httpAddr, - "http-addr", - "localhost:8081", - "The address on which to listen for HTTP requests.") - - // Flags about connecting to the sink cluster. - RootCmd.PersistentFlags().StringVar( - &sinkPGURL, - "sink-pgurl", - "postgresql://root@localhost:26257?sslmode=disable", - "PGURL for the sink cluster. If the url does not include a database name, "+ - "then \"obsservice\" will be used.") - - RootCmd.PersistentFlags().BoolVar( - &noDB, - "no-db", - false, - "Disables usage of the external sink DB indicated by the --sink-pgurl flag at startup. "+ - "Intended for testing purposes only.") - - if err := RootCmd.Execute(); err != nil { - exit.WithCode(exit.UnspecifiedError()) - } -} - -func handleSignalDuringShutdown(sig os.Signal) { - // On Unix, a signal that was not handled gracefully by the application - // should be reraised so it is visible in the exit code. - - // Reset signal to its original disposition. - signal.Reset(sig) - - // Reraise the signal. os.Signal is always sysutil.Signal. - if err := unix.Kill(unix.Getpid(), sig.(sysutil.Signal)); err != nil { - // Sending a valid signal to ourselves should never fail. - // - // Unfortunately it appears (#34354) that some users - // run CockroachDB in containers that only support - // a subset of all syscalls. If this ever happens, we - // still need to quit immediately. - log.Fatalf(context.Background(), "unable to forward signal %v: %v", sig, err) - } - - // Block while we wait for the signal to be delivered. - select {} -} diff --git a/pkg/obsservice/obslib/BUILD.bazel b/pkg/obsservice/obslib/BUILD.bazel deleted file mode 100644 index 09f30558a101..000000000000 --- a/pkg/obsservice/obslib/BUILD.bazel +++ /dev/null @@ -1,12 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "obslib", - srcs = [ - "consumer.go", - "owner.go", - ], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib", - visibility = ["//visibility:public"], - deps = ["//pkg/obsservice/obspb"], -) diff --git a/pkg/obsservice/obslib/consumer.go b/pkg/obsservice/obslib/consumer.go deleted file mode 100644 index e36bd9b91d70..000000000000 --- a/pkg/obsservice/obslib/consumer.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package obslib - -import ( - "context" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" -) - -// An EventConsumer represents a component in the obsservice -// that's capable of processing an event. -// -// A chain of EventConsumer's is generally used to process events, -// where one Consumer is given a reference to the next Consumer -// to use once it's finished processing the event. -type EventConsumer interface { - // Consume consumes the provided obspb.Event into the component implementing - // the EventConsumer interface. - Consume(ctx context.Context, event *obspb.Event) error -} diff --git a/pkg/obsservice/obslib/ingest/BUILD.bazel b/pkg/obsservice/obslib/ingest/BUILD.bazel deleted file mode 100644 index 51682499c19a..000000000000 --- a/pkg/obsservice/obslib/ingest/BUILD.bazel +++ /dev/null @@ -1,54 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "ingest", - srcs = ["grpc_ingest.go"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/ingest", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obslib", - "//pkg/obsservice/obslib/transform", - "//pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1:logs_service", - "//pkg/util/log", - "//pkg/util/timeutil", - ], -) - -go_test( - name = "ingest_test", - srcs = [ - "grpc_ingest_test.go", - "ingest_integration_test.go", - "main_test.go", - ], - data = glob(["testdata/**"]), - embed = [":ingest"], - deps = [ - "//pkg/base", - "//pkg/obs", - "//pkg/obsservice/obslib/obsutil", - "//pkg/obsservice/obspb", - "//pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1:logs_service", - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:common", - "//pkg/obsservice/obspb/opentelemetry-proto/logs/v1:logs", - "//pkg/obsservice/obspb/opentelemetry-proto/resource/v1:resource", - "//pkg/rpc", - "//pkg/security/securityassets", - "//pkg/security/securitytest", - "//pkg/server", - "//pkg/settings/cluster", - "//pkg/testutils", - "//pkg/testutils/serverutils", - "//pkg/testutils/testcluster", - "//pkg/util/leaktest", - "//pkg/util/log", - "//pkg/util/randutil", - "//pkg/util/stop", - "//pkg/util/timeutil", - "@com_github_cockroachdb_datadriven//:datadriven", - "@com_github_cockroachdb_errors//:errors", - "@com_github_google_uuid//:uuid", - "@com_github_kr_pretty//:pretty", - "@com_github_stretchr_testify//require", - ], -) diff --git a/pkg/obsservice/obslib/ingest/grpc_ingest.go b/pkg/obsservice/obslib/ingest/grpc_ingest.go deleted file mode 100644 index 47c505abf112..000000000000 --- a/pkg/obsservice/obslib/ingest/grpc_ingest.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 The Cockroach Authors. -// -// Licensed 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 - -package ingest - -import ( - "context" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/transform" - logspb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/cockroach/pkg/util/timeutil" -) - -// EventIngester implements the OTLP Logs gRPC service, accepting connections -// and ingesting events. -type EventIngester struct { - consumer obslib.EventConsumer - timeSource timeutil.TimeSource -} - -var _ logspb.LogsServiceServer = &EventIngester{} - -// MakeEventIngester creates a new EventIngester. Callers can optionally -// provide a timeutil.TimeSource which will be used when determining ingestion -// timestamps. If nil is provided, timeutil.DefaultTimeSource will be used. -func MakeEventIngester( - _ context.Context, consumer obslib.EventConsumer, timeSource timeutil.TimeSource, -) *EventIngester { - if timeSource == nil { - timeSource = timeutil.DefaultTimeSource{} - } - return &EventIngester{ - consumer: consumer, - timeSource: timeSource, - } -} - -// Export implements the LogsServiceServer gRPC service. -// -// NB: "Export" is a bit of a misnomer here. On the client side, -// it makes sense, but on this end of the wire, we are *Ingesting* -// events, not exporting them. This is simply the receiving end -// of that process. This is done to maintain compatibility between -// the OpenTelemetry Collector and our EventsExporter. -func (e *EventIngester) Export( - ctx context.Context, request *logspb.ExportLogsServiceRequest, -) (*logspb.ExportLogsServiceResponse, error) { - if err := e.unpackAndConsumeEvents(ctx, request); err != nil { - log.Errorf(ctx, "consuming events: %v", err) - return nil, err - } - return &logspb.ExportLogsServiceResponse{}, nil -} - -// TODO(abarganier): Add context cancellation here to cap transformation/unpack time. -// TODO(abarganier): Add metric to track context cancellations (counter tracking failed transformations) -func (e *EventIngester) unpackAndConsumeEvents( - ctx context.Context, request *logspb.ExportLogsServiceRequest, -) error { - ingestTime := e.timeSource.Now() - for _, resource := range request.ResourceLogs { - for _, scopeLogs := range resource.ScopeLogs { - for _, logRecord := range scopeLogs.LogRecords { - transformed := transform.LogRecordToEvent(ingestTime, resource.Resource, scopeLogs.Scope, logRecord) - // Consume the event, but we don't want to return errors back to the client - // if we fail to consume just some events that are part of the batch. Log - // instead. - if err := e.consumer.Consume(ctx, transformed); err != nil { - log.Errorf(ctx, "ingesting event. err = %v, event = %v", err, transformed) - } - } - } - } - return nil -} diff --git a/pkg/obsservice/obslib/ingest/grpc_ingest_test.go b/pkg/obsservice/obslib/ingest/grpc_ingest_test.go deleted file mode 100644 index 5f95c4555340..000000000000 --- a/pkg/obsservice/obslib/ingest/grpc_ingest_test.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package ingest - -import ( - "bytes" - "context" - "fmt" - "strings" - "testing" - "time" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/obsutil" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - logspb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1" - v12 "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/common/v1" - v1 "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/logs/v1" - otel_res_pb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/resource/v1" - "github.com/cockroachdb/cockroach/pkg/util/leaktest" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/cockroach/pkg/util/timeutil" - "github.com/cockroachdb/datadriven" - "github.com/google/uuid" - "github.com/kr/pretty" - "github.com/stretchr/testify/require" -) - -func TestGRPCIngest(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - - clusterID := uuid.MustParse("44875af2-aea5-4965-8f9c-63fec244fd41") - testResource := &otel_res_pb.Resource{ - Attributes: []*v12.KeyValue{ - { - Key: obspb.ClusterID, - Value: &v12.AnyValue{Value: &v12.AnyValue_StringValue{StringValue: clusterID.String()}}, - }, - }, - } - testTimeSource := timeutil.NewManualTime(time.Date(2023, 6, 26, 12, 1, 0, 0, time.UTC)) - - datadriven.RunTest(t, "testdata/grpc_ingest", func(t *testing.T, d *datadriven.TestData) string { - ctx := context.Background() - testConsumer := obsutil.NewTestCaptureConsumer() - e := MakeEventIngester(ctx, testConsumer, testTimeSource) - - req := newReqBuilder(testResource) - for _, line := range strings.Split(d.Input, "\n") { - fields := strings.Split(line, ",") - require.Len(t, fields, 2) - req.withLogEvent(fields[0], fields[1]) - } - - _, err := e.Export(ctx, req.build()) - require.NoError(t, err) - - var buf bytes.Buffer - for _, event := range testConsumer.Events() { - fmt.Fprintf(&buf, "%# v\n", pretty.Formatter(event)) - } - return buf.String() - }) -} - -// reqBuilder uses a builder pattern to incrementally build a -// logspb.ExportLogsServiceRequest with various LogRecord events -// of a given type. -// -// When you're finished building the request, use build() to -// finalize the request object. -type reqBuilder struct { - // The request we're building. - req *logspb.ExportLogsServiceRequest - // Accumulated LogRecords, segmented by event type. We use - // a struct slice here instead of a map to provide deterministic - // ordering when iterating. - scopeLogs []*scopeLogs - // The last event timestamp, starting at a static value. - // Each LogEvent added to the builder will have a timestamp - // that increments from this timestamp. The original value is - // static, meaning that timestamps will be deterministic for - // each run so long as the order in which they're added is the - // same. - lastTimestamp int64 -} - -type scopeLogs struct { - eventType string - logs []*v1.LogRecord -} - -func newReqBuilder(resource *otel_res_pb.Resource) *reqBuilder { - return &reqBuilder{ - req: &logspb.ExportLogsServiceRequest{ - ResourceLogs: []*v1.ResourceLogs{ - {Resource: resource}, - }, - }, - scopeLogs: make([]*scopeLogs, 0), - lastTimestamp: time.Date(2023, 6, 26, 12, 0, 0, 0, time.UTC).UnixNano(), - } -} - -func (r *reqBuilder) withLogEvent(eventType string, data string) *reqBuilder { - var sl *scopeLogs - for _, s := range r.scopeLogs { - if s.eventType == eventType { - sl = s - break - } - } - if sl == nil { - sl = &scopeLogs{ - eventType: eventType, - logs: make([]*v1.LogRecord, 0), - } - r.scopeLogs = append(r.scopeLogs, sl) - } - timestamp := r.lastTimestamp + 10000000 - r.lastTimestamp = timestamp - sl.logs = append(sl.logs, &v1.LogRecord{ - TimeUnixNano: uint64(timestamp), - Body: &v12.AnyValue{Value: &v12.AnyValue_StringValue{StringValue: data}}, - Attributes: []*v12.KeyValue{{ - Key: obspb.EventlogEventTypeAttribute, - Value: &v12.AnyValue{Value: &v12.AnyValue_StringValue{StringValue: eventType}}, - }}, - }) - return r -} - -func (r *reqBuilder) build() *logspb.ExportLogsServiceRequest { - for _, sl := range r.scopeLogs { - r.req.ResourceLogs[0].ScopeLogs = append(r.req.ResourceLogs[0].ScopeLogs, &v1.ScopeLogs{ - Scope: &v12.InstrumentationScope{ - Name: sl.eventType, - Version: "1.0", - }, - LogRecords: sl.logs, - }) - } - return r.req -} diff --git a/pkg/obsservice/obslib/ingest/ingest_integration_test.go b/pkg/obsservice/obslib/ingest/ingest_integration_test.go deleted file mode 100644 index 18eb5708d2d7..000000000000 --- a/pkg/obsservice/obslib/ingest/ingest_integration_test.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package ingest - -import ( - "context" - gosql "database/sql" - "encoding/json" - "net" - "strings" - "testing" - - "github.com/cockroachdb/cockroach/pkg/base" - "github.com/cockroachdb/cockroach/pkg/obs" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/obsutil" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - logspb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1" - "github.com/cockroachdb/cockroach/pkg/rpc" - "github.com/cockroachdb/cockroach/pkg/settings/cluster" - "github.com/cockroachdb/cockroach/pkg/testutils" - "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" - "github.com/cockroachdb/cockroach/pkg/util/leaktest" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/cockroach/pkg/util/stop" - "github.com/cockroachdb/errors" - "github.com/stretchr/testify/require" -) - -// Test an end-to-end integration between the ObsService and a CRDB cluster: -// verify that events get exported from CRDB and imported in the Obs Service. -func TestEventIngestionIntegration(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - ctx := context.Background() - - testutils.RunTrueAndFalse(t, "embed", func(t *testing.T, embed bool) { - var obsAddr string - - var s serverutils.TestServerInterface - var sqlDB *gosql.DB - testConsumer := obsutil.NewTestCaptureConsumer() - if !embed { - // Allocate a port for the ingestion service to work around a circular - // dependency: CRDB needs to be told what the port is, but we can only create - // the event ingester after having started CRDB (because the ingester wants a - // reference to CRDB). - otlpListener, err := net.Listen("tcp", "127.0.0.1:0") - require.NoError(t, err) - defer func() { - _ = otlpListener.Close() - }() - obsAddr = otlpListener.Addr().String() - s, sqlDB, _ = serverutils.StartServer(t, - base.TestServerArgs{ - ObsServiceAddr: obsAddr, - Knobs: base.TestingKnobs{ - EventExporter: &obs.EventExporterTestingKnobs{ - // Flush every message. - FlushTriggerByteSize: 1, - }, - }, - }, - ) - defer s.Stopper().Stop(ctx) - - // Start the ingestion in the background. - obsStop := stop.NewStopper() - defer obsStop.Stop(ctx) - e := MakeEventIngester(ctx, testConsumer, nil) - opts := rpc.DefaultContextOptions() - opts.NodeID = &base.NodeIDContainer{} - opts.Insecure = true - opts.Stopper = obsStop - opts.Settings = cluster.MakeTestingClusterSettings() - rpcContext := rpc.NewContext(ctx, opts) - grpcServer, err := rpc.NewServer(ctx, rpcContext) - require.NoError(t, err) - defer grpcServer.Stop() - logspb.RegisterLogsServiceServer(grpcServer, e) - go func() { - _ = grpcServer.Serve(otlpListener) - }() - } else { - s, sqlDB, _ = serverutils.StartServer(t, - base.TestServerArgs{ - ObsServiceAddr: base.ObsServiceEmbedFlagValue, - Knobs: base.TestingKnobs{ - EventExporter: &obs.EventExporterTestingKnobs{ - // Flush every message. - FlushTriggerByteSize: 1, - TestConsumer: testConsumer, - }, - }, - }, - ) - defer s.Stopper().Stop(ctx) - } - - // Perform a schema change and check that we get an event. - _, err := sqlDB.Exec("create table t()") - require.NoError(t, err) - testutils.SucceedsSoon(t, func() error { - foundEvent := testConsumer.Contains(func(event *obspb.Event) bool { - type eventLogType struct { - EventType string `json:"EventType"` - Statement string `json:"Statement"` - } - - var ev eventLogType - if err := json.Unmarshal([]byte(event.LogRecord.Body.GetStringValue()), &ev); err != nil { - t.Fatalf("failed to deserialize event: %v", event) - } - // Look for our specific create table statement. - if ev.EventType == "create_table" && - strings.Contains(ev.Statement, "CREATE TABLE defaultdb.public.t") { - return true - } - return false - }) - if !foundEvent { - return errors.Newf("no event found yet") - } - return nil - }) - }) -} diff --git a/pkg/obsservice/obslib/ingest/main_test.go b/pkg/obsservice/obslib/ingest/main_test.go deleted file mode 100644 index 7a025d03e441..000000000000 --- a/pkg/obsservice/obslib/ingest/main_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2022 The Cockroach Authors. -// -// Licensed 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 - -package ingest_test - -import ( - "os" - "testing" - - "github.com/cockroachdb/cockroach/pkg/base" - "github.com/cockroachdb/cockroach/pkg/security/securityassets" - "github.com/cockroachdb/cockroach/pkg/security/securitytest" - "github.com/cockroachdb/cockroach/pkg/server" - "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" - "github.com/cockroachdb/cockroach/pkg/testutils/testcluster" - "github.com/cockroachdb/cockroach/pkg/util/randutil" -) - -func TestMain(m *testing.M) { - securityassets.SetLoader(securitytest.EmbeddedAssets) - randutil.SeedForTests() - serverutils.InitTestServerFactory(server.TestServerFactory) - serverutils.InitTestClusterFactory(testcluster.TestClusterFactory) - - defer serverutils.TestingSetDefaultTenantSelectionOverride( - base.TestIsForStuffThatShouldWorkWithSecondaryTenantsButDoesntYet(76378), - )() - - os.Exit(m.Run()) -} - -//go:generate ../../../util/leaktest/add-leaktest.sh *_test.go diff --git a/pkg/obsservice/obslib/ingest/testdata/grpc_ingest b/pkg/obsservice/obslib/ingest/testdata/grpc_ingest deleted file mode 100644 index f8ba99f778c4..000000000000 --- a/pkg/obsservice/obslib/ingest/testdata/grpc_ingest +++ /dev/null @@ -1,166 +0,0 @@ -test-ingest -type1,hello -type2,hola -type1,world -type2,mundo ----- -&obspb.Event{ - Resource: &v1.Resource{ - Attributes: { - &v1.KeyValue{ - Key: "ClusterID", - Value: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"44875af2-aea5-4965-8f9c-63fec244fd41"}, - }, - }, - }, - DroppedAttributesCount: 0x0, - }, - Scope: &v1.InstrumentationScope{ - Name: "type1", - Version: "1.0", - Attributes: nil, - DroppedAttributesCount: 0x0, - }, - LogRecord: &v1.LogRecord{ - TimeUnixNano: 0x176c33b203521680, - ObservedTimeUnixNano: 0x176c33bffb00d800, - SeverityNumber: 0, - SeverityText: "", - Body: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"hello"}, - }, - Attributes: { - &v1.KeyValue{ - Key: "event_type", - Value: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"type1"}, - }, - }, - }, - DroppedAttributesCount: 0x0, - Flags: 0x0, - TraceId: nil, - SpanId: nil, - }, -} -&obspb.Event{ - Resource: &v1.Resource{ - Attributes: { - &v1.KeyValue{ - Key: "ClusterID", - Value: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"44875af2-aea5-4965-8f9c-63fec244fd41"}, - }, - }, - }, - DroppedAttributesCount: 0x0, - }, - Scope: &v1.InstrumentationScope{ - Name: "type1", - Version: "1.0", - Attributes: nil, - DroppedAttributesCount: 0x0, - }, - LogRecord: &v1.LogRecord{ - TimeUnixNano: 0x176c33b204834380, - ObservedTimeUnixNano: 0x176c33bffb00d800, - SeverityNumber: 0, - SeverityText: "", - Body: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"world"}, - }, - Attributes: { - &v1.KeyValue{ - Key: "event_type", - Value: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"type1"}, - }, - }, - }, - DroppedAttributesCount: 0x0, - Flags: 0x0, - TraceId: nil, - SpanId: nil, - }, -} -&obspb.Event{ - Resource: &v1.Resource{ - Attributes: { - &v1.KeyValue{ - Key: "ClusterID", - Value: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"44875af2-aea5-4965-8f9c-63fec244fd41"}, - }, - }, - }, - DroppedAttributesCount: 0x0, - }, - Scope: &v1.InstrumentationScope{ - Name: "type2", - Version: "1.0", - Attributes: nil, - DroppedAttributesCount: 0x0, - }, - LogRecord: &v1.LogRecord{ - TimeUnixNano: 0x176c33b203eaad00, - ObservedTimeUnixNano: 0x176c33bffb00d800, - SeverityNumber: 0, - SeverityText: "", - Body: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"hola"}, - }, - Attributes: { - &v1.KeyValue{ - Key: "event_type", - Value: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"type2"}, - }, - }, - }, - DroppedAttributesCount: 0x0, - Flags: 0x0, - TraceId: nil, - SpanId: nil, - }, -} -&obspb.Event{ - Resource: &v1.Resource{ - Attributes: { - &v1.KeyValue{ - Key: "ClusterID", - Value: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"44875af2-aea5-4965-8f9c-63fec244fd41"}, - }, - }, - }, - DroppedAttributesCount: 0x0, - }, - Scope: &v1.InstrumentationScope{ - Name: "type2", - Version: "1.0", - Attributes: nil, - DroppedAttributesCount: 0x0, - }, - LogRecord: &v1.LogRecord{ - TimeUnixNano: 0x176c33b2051bda00, - ObservedTimeUnixNano: 0x176c33bffb00d800, - SeverityNumber: 0, - SeverityText: "", - Body: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"mundo"}, - }, - Attributes: { - &v1.KeyValue{ - Key: "event_type", - Value: &v1.AnyValue{ - Value: &v1.AnyValue_StringValue{StringValue:"type2"}, - }, - }, - }, - DroppedAttributesCount: 0x0, - Flags: 0x0, - TraceId: nil, - SpanId: nil, - }, -} diff --git a/pkg/obsservice/obslib/migrations/BUILD.bazel b/pkg/obsservice/obslib/migrations/BUILD.bazel deleted file mode 100644 index 3383019be223..000000000000 --- a/pkg/obsservice/obslib/migrations/BUILD.bazel +++ /dev/null @@ -1,27 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "migrations", - srcs = ["migrations.go"], - embedsrcs = ["sqlmigrations/0001_init.sql"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/migrations", - visibility = ["//visibility:public"], - deps = [ - "//pkg/util/log", - "@com_github_cockroachdb_errors//:errors", - "@com_github_jackc_pgx_v5//:pgx", - "@com_github_jackc_pgx_v5//stdlib", - "@com_github_pressly_goose_v3//:goose", - ], -) - -go_test( - name = "migrations_test", - srcs = ["migrations_test.go"], - embed = [":migrations"], - deps = [ - "//pkg/util/leaktest", - "//pkg/util/log", - "@com_github_stretchr_testify//require", - ], -) diff --git a/pkg/obsservice/obslib/migrations/migrations.go b/pkg/obsservice/obslib/migrations/migrations.go deleted file mode 100644 index 3b5f1d28521d..000000000000 --- a/pkg/obsservice/obslib/migrations/migrations.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 The Cockroach Authors. -// -// Licensed 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 - -package migrations - -import ( - "context" - "embed" - - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/errors" - "github.com/jackc/pgx/v5" - "github.com/jackc/pgx/v5/stdlib" - "github.com/pressly/goose/v3" -) - -// sqlMigrations embeds all the .sql file containing migrations to be run by -// Goose. -// -//go:embed sqlmigrations/*.sql -var sqlMigrations embed.FS - -// RunDBMigrations brings the SQL schema in the sink cluster up to date. -// -// connCfg represent the connection info for sink cluster. -func RunDBMigrations(ctx context.Context, connCfg *pgx.ConnConfig) error { - if log.V(2) { - goose.SetVerbose(true) - } - goose.SetBaseFS(sqlMigrations) - - if connCfg.Database == "" { - return errors.AssertionFailedf("expected database name to be set") - } - db := stdlib.OpenDB(*connCfg) - defer db.Close() - // We need to create the database by hand; Goose expects the database to exist. - if _, err := db.ExecContext(ctx, "CREATE DATABASE IF NOT EXISTS "+connCfg.Database); err != nil { - return err - } - // goose will .obs_admin.migrations to store the migration bookkeeping. - if _, err := db.ExecContext(ctx, "CREATE schema IF NOT EXISTS obs_admin"); err != nil { - return err - } - goose.SetTableName("obs_admin.migrations") - if err := goose.SetDialect("postgres"); err != nil { - return err - } - - // Run the missing migrations, if any. - if err := goose.Up(db, "sqlmigrations"); err != nil { - return err - } - return nil -} - -// GetDBMigrations returns the list of migrations and is used for testing purposes. -func GetDBMigrations() embed.FS { - return sqlMigrations -} diff --git a/pkg/obsservice/obslib/migrations/migrations_test.go b/pkg/obsservice/obslib/migrations/migrations_test.go deleted file mode 100644 index 7facf508f2f9..000000000000 --- a/pkg/obsservice/obslib/migrations/migrations_test.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package migrations - -import ( - "fmt" - "regexp" - "slices" - "testing" - - "github.com/cockroachdb/cockroach/pkg/util/leaktest" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/stretchr/testify/require" -) - -// TestMigrationHaveColumns test that all migrations created for -// events have the required columns. -func TestMigrationHaveRequiredColumns(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - - // Required columns with any amount of space required for alignment (\s+). - requiredColumns := []string{ - `timestamp\s+TIMESTAMPTZ`, - `event_id\s+STRING`, - `org_id\s+STRING`, - `cluster_id\s+STRING`, - `tenant_id\s+STRING`, - } - - // Add migrations that don't need to contain the required columns and - // can be skipped from this check. - var ignoreMigrations []string - migrationsDir := "sqlmigrations" - - migrations, err := GetDBMigrations().ReadDir(migrationsDir) - require.NoError(t, err, "error while reading migrations directory") - - for _, migration := range migrations { - if slices.Contains(ignoreMigrations, migration.Name()) { - return - } - b, err := GetDBMigrations().ReadFile(fmt.Sprintf("%s/%s", migrationsDir, migration.Name())) - require.NoError(t, err, fmt.Sprintf("error while reading migration %v", migration.Name())) - - migrationContent := string(b) - for _, column := range requiredColumns { - r := regexp.MustCompile(column) - require.Equal( - t, - 1, - len(r.FindAllString(migrationContent, 1)), - fmt.Sprintf("migration %v missing column: %v", migration.Name(), column), - ) - } - } -} diff --git a/pkg/obsservice/obslib/migrations/sqlmigrations/0001_init.sql b/pkg/obsservice/obslib/migrations/sqlmigrations/0001_init.sql deleted file mode 100644 index d63497293c1f..000000000000 --- a/pkg/obsservice/obslib/migrations/sqlmigrations/0001_init.sql +++ /dev/null @@ -1,14 +0,0 @@ --- +goose Up -CREATE TABLE cluster_events( - timestamp TIMESTAMPTZ NOT NULL, - org_id STRING NOT NULL, - cluster_id STRING NOT NULL, - tenant_id STRING NOT NULL, - event_id STRING NOT NULL, - event_type STRING NOT NULL, - event JSONB, - CONSTRAINT "primary" PRIMARY KEY (timestamp, event_id) USING HASH WITH (bucket_count = 16) -) WITH (ttl_expire_after = '3 months'); - --- +goose Down -DROP TABLE cluster_events; diff --git a/pkg/obsservice/obslib/obsutil/BUILD.bazel b/pkg/obsservice/obslib/obsutil/BUILD.bazel deleted file mode 100644 index f2feb0d6baa0..000000000000 --- a/pkg/obsservice/obslib/obsutil/BUILD.bazel +++ /dev/null @@ -1,38 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "testutil", - srcs = ["test_consumer.go"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/testutil", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obslib", - "//pkg/obsservice/obspb", - ], -) - -go_library( - name = "obstestutil", - srcs = ["test_consumer.go"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/obstestutil", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obslib", - "//pkg/obsservice/obspb", - ], -) - -go_library( - name = "obsutil", - srcs = [ - "std_out_consumer.go", - "test_consumer.go", - ], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/obsutil", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obslib", - "//pkg/obsservice/obspb", - "//pkg/util/syncutil", - ], -) diff --git a/pkg/obsservice/obslib/obsutil/std_out_consumer.go b/pkg/obsservice/obslib/obsutil/std_out_consumer.go deleted file mode 100644 index 8f01a6135a90..000000000000 --- a/pkg/obsservice/obslib/obsutil/std_out_consumer.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package obsutil - -import ( - "context" - "fmt" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" -) - -// StdOutConsumer implements the EventConsumer interface and logs -// each event it receives to STDOUT, for testing purposes. -// -// StdOutConsumer is not intended for real-world use. -type StdOutConsumer struct{} - -func (s StdOutConsumer) Consume(ctx context.Context, event *obspb.Event) error { - fmt.Printf("StdOutConsumer - consumed event: %v\n", event) - return nil -} - -var _ obslib.EventConsumer = (*StdOutConsumer)(nil) diff --git a/pkg/obsservice/obslib/obsutil/test_consumer.go b/pkg/obsservice/obslib/obsutil/test_consumer.go deleted file mode 100644 index 34459dc890da..000000000000 --- a/pkg/obsservice/obslib/obsutil/test_consumer.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package obsutil - -import ( - "context" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - "github.com/cockroachdb/cockroach/pkg/util/syncutil" -) - -// TestCaptureConsumer is a test utility used for testing -// components in the observability service. It captures events -// into a buffer and provides functions that allow tests to -// analyze consumed contents to make assertions against. -type TestCaptureConsumer struct { - mu struct { - syncutil.Mutex - events []*obspb.Event - } -} - -var _ obslib.EventConsumer = (*TestCaptureConsumer)(nil) - -// NewTestCaptureConsumer returns a new instance of a TestCaptureConsumer. -func NewTestCaptureConsumer() *TestCaptureConsumer { - c := &TestCaptureConsumer{} - c.mu.events = make([]*obspb.Event, 0) - return c -} - -// Len returns the number of events captured by this -// TestCaptureConsumer. -func (c *TestCaptureConsumer) Len() int { - c.mu.Lock() - defer c.mu.Unlock() - return len(c.mu.events) -} - -func (c *TestCaptureConsumer) Events() []*obspb.Event { - c.mu.Lock() - defer c.mu.Unlock() - return c.mu.events -} - -// Consume implements the consumer.EventConsumer interface. -// Events consumed by the TestCaptureConsumer are stored in an -// internal buffer for later analysis. -// -// Calls to Consume() are synchronized. -func (c *TestCaptureConsumer) Consume(_ context.Context, event *obspb.Event) error { - c.mu.Lock() - defer c.mu.Unlock() - c.mu.events = append(c.mu.events, event) - return nil -} - -// Contains runs the given predicate against all the events in the -// TestCaptureConsumer's buffer. As soon as one of the events matches -// the predicate, Contains returns true. If no events pass the given -// predicate, Contains returns false. -func (c *TestCaptureConsumer) Contains(apply func(*obspb.Event) bool) bool { - c.mu.Lock() - defer c.mu.Unlock() - for _, event := range c.mu.events { - if apply(event) { - return true - } - } - return false -} - -// TestErrorConsumer always returns the error provided at -// construction on Consume. -type TestErrorConsumer struct { - err error -} - -func NewTestErrorConsumer(err error) *TestErrorConsumer { - return &TestErrorConsumer{err: err} -} - -func (c *TestErrorConsumer) Consume(_ context.Context, _ *obspb.Event) error { - return c.err -} diff --git a/pkg/obsservice/obslib/owner.go b/pkg/obsservice/obslib/owner.go deleted file mode 100644 index 3aa447784a50..000000000000 --- a/pkg/obsservice/obslib/owner.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package obslib - -// OwnerTeam denotes the specific team that owns a pipeline, or pipeline -// component, in the platform. OwnerTeam can be used to explicitly attribute -// problematic pipelines to a specific team, which is helpful during incidents -// and support escalations. -type OwnerTeam string - -const ( - // ObsInfra is the Observability Infrastructure team. - Observability OwnerTeam = "observability" -) diff --git a/pkg/obsservice/obslib/process/BUILD.bazel b/pkg/obsservice/obslib/process/BUILD.bazel deleted file mode 100644 index af3ff2ee483b..000000000000 --- a/pkg/obsservice/obslib/process/BUILD.bazel +++ /dev/null @@ -1,42 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "process", - srcs = [ - "mem_queue_processor.go", - "processor.go", - "processor_utils.go", - ], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/process", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obslib", - "//pkg/obsservice/obslib/queue", - "//pkg/obsservice/obslib/validate", - "//pkg/util/log", - "//pkg/util/stop", - "@com_github_cockroachdb_errors//:errors", - "@com_github_jackc_pgx_v5//pgxpool", - "@com_github_jackc_pgx_v5//stdlib", - ], -) - -go_test( - name = "process_test", - srcs = [ - "mem_queue_processor_test.go", - "processor_test.go", - ], - embed = [":process"], - deps = [ - "//pkg/obsservice/obslib/queue", - "//pkg/obsservice/obslib/validate", - "//pkg/testutils", - "//pkg/util/leaktest", - "//pkg/util/log", - "//pkg/util/stop", - "//pkg/util/syncutil", - "@com_github_cockroachdb_errors//:errors", - "@com_github_stretchr_testify//require", - ], -) diff --git a/pkg/obsservice/obslib/process/mem_queue_processor.go b/pkg/obsservice/obslib/process/mem_queue_processor.go deleted file mode 100644 index 2bc6631e3d1d..000000000000 --- a/pkg/obsservice/obslib/process/mem_queue_processor.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package process - -import ( - "context" - "fmt" - "time" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/queue" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/cockroach/pkg/util/stop" - "github.com/cockroachdb/errors" -) - -// MemQueueProcessor is a consumer of events with type T, that indefinitely reads off of the provided -// queue.MemoryQueue[T] and passes them to the provided EventProcessor[T]. -type MemQueueProcessor[T any] struct { - queue *queue.MemoryQueue[T] - processor EventProcessor[T] -} - -func NewMemQueueProcessor[T any]( - queue *queue.MemoryQueue[T], processor EventProcessor[T], -) (*MemQueueProcessor[T], error) { - if queue == nil { - return nil, errors.New("nil MemoryQueue provided") - } - if processor == nil { - return nil, errors.New("nil EventProcessor provided") - } - return &MemQueueProcessor[T]{ - queue: queue, - processor: processor, - }, nil -} - -func (p *MemQueueProcessor[T]) Start(ctx context.Context, stop *stop.Stopper) error { - return stop.RunAsyncTask(ctx, - fmt.Sprintf("MemQueueProcessor{%s}", p.queue.Alias()), - func(ctx context.Context) { - for { - select { - case <-stop.ShouldQuiesce(): - // The producer for the MemQueue that we're consuming from is expected to be a gRPC server, which - // should be using the same stop.Stopper. Therefore, once we're signaled to quiesce, the queue should - // soon stop growing in size. Drain what's left before exiting. - log.Infof(ctx, "MemQueueProcessor{%s} shutdown requested, draining with timeout", p.queue.Alias()) - p.drain(ctx) - return - default: - // NB: If the queue is empty, this method is considered "busy-waiting", which is CPU-intensive. - // Consider a more efficient consumption model if used long term. - if e, ok := p.queue.Dequeue(); ok { - if err := p.processor.Process(ctx, e); err != nil { - log.Errorf(ctx, "MemQueueProcessor{%s} processing error: %v", p.queue.Alias(), err) - } - } - } - } - }) -} - -func (p *MemQueueProcessor[T]) drain(ctx context.Context) { - t := time.After(2 * time.Minute) - for { - select { - case <-t: - log.Infof(ctx, "MemQueueProcessor{%s} drain timed out", p.queue.Alias()) - return - default: - if e, ok := p.queue.Dequeue(); ok { - if err := p.processor.Process(ctx, e); err != nil { - log.Errorf(ctx, "MemQueueProcessor{%s} processing error: %v", p.queue.Alias(), err) - } - } else { - log.Infof(ctx, "MemQueueProcessor{%s} draining complete", p.queue.Alias()) - return - } - } - } -} diff --git a/pkg/obsservice/obslib/process/mem_queue_processor_test.go b/pkg/obsservice/obslib/process/mem_queue_processor_test.go deleted file mode 100644 index 3658a1e20809..000000000000 --- a/pkg/obsservice/obslib/process/mem_queue_processor_test.go +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package process - -import ( - "context" - "sync" - "testing" - "time" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/queue" - "github.com/cockroachdb/cockroach/pkg/testutils" - "github.com/cockroachdb/cockroach/pkg/util/leaktest" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/cockroach/pkg/util/stop" - "github.com/cockroachdb/cockroach/pkg/util/syncutil" - "github.com/cockroachdb/errors" - "github.com/stretchr/testify/require" -) - -var testStrSizeFn = queue.SizeFn[string](func(s string) int { - return len(s) -}) - -func TestMemQueueProcessor(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - - ctx := context.Background() - - t.Run("consumes elements from queue", func(t *testing.T) { - q := queue.NewMemoryQueue[string](1<<11 /* 2K */, testStrSizeFn, "test") - processor := &TestCountProcessor{} - qProcessor, err := NewMemQueueProcessor[string](q, processor) - require.NoError(t, err) - stopper := stop.NewStopper() - defer stopper.Stop(ctx) - require.NoError(t, qProcessor.Start(ctx, stopper)) - - waitForConsume := func(timesCalled int, errMsg string) { - testutils.SucceedsSoon(t, func() error { - processor.mu.Lock() - defer processor.mu.Unlock() - if processor.mu.timesCalled == timesCalled && q.Len() == 0 { - return nil - } - return errors.Newf("%s", errMsg) - }) - } - - require.NoError(t, q.Enqueue("hello")) - waitForConsume(1, "first message in queue not consumed") - require.NoError(t, q.Enqueue("it's")) - waitForConsume(2, "second message in queue not consumed") - require.NoError(t, q.Enqueue("me")) - waitForConsume(3, "third message in queue not consumed") - }) - - t.Run("drains elements from queue after quiesce", func(t *testing.T) { - q := queue.NewMemoryQueue[string](1<<11 /* 2K */, testStrSizeFn, "test") - processor := &TestWaitGroupCountProcessor{} - // We want the processor to stall until after quiesce. This allows us to prevent the consumption - // of elements from the MemoryQueue until after the stopped has been Quiesced, ensuring that - // the MemoryQueue still has elements remaining to be processed after Quiesce. - processor.wg.Add(1) - qProcessor, err := NewMemQueueProcessor[string](q, processor) - require.NoError(t, err) - stopper := stop.NewStopper() - defer stopper.Stop(ctx) - require.NoError(t, qProcessor.Start(ctx, stopper)) - require.NoError(t, q.Enqueue("hello")) - require.NoError(t, q.Enqueue("it's")) - require.NoError(t, q.Enqueue("me")) - require.NoError(t, q.Enqueue("did")) - require.NoError(t, q.Enqueue("you")) - require.NoError(t, q.Enqueue("drain?")) - time.AfterFunc(25*time.Millisecond, func() { - processor.wg.Done() - }) - stopper.Quiesce(ctx) - testutils.SucceedsSoon(t, func() error { - processor.mu.Lock() - defer processor.mu.Unlock() - if processor.mu.timesCalled == 6 && q.Len() == 0 { - return nil - } - return errors.New("queue not drained after quiesce") - }) - }) - - t.Run("processing errors don't kill the processor", func(t *testing.T) { - q := queue.NewMemoryQueue[string](1<<11 /* 2K */, testStrSizeFn, "test") - processor := &TestCountProcessor{} - qProcessor, err := NewMemQueueProcessor[string](q, processor) - require.NoError(t, err) - stopper := stop.NewStopper() - defer stopper.Stop(ctx) - require.NoError(t, qProcessor.Start(ctx, stopper)) - - waitForConsume := func(timesCalled int, errMsg string) { - testutils.SucceedsSoon(t, func() error { - processor.mu.Lock() - defer processor.mu.Unlock() - if processor.mu.timesCalled == timesCalled && q.Len() == 0 { - return nil - } - return errors.Newf("%s", errMsg) - }) - } - - require.NoError(t, q.Enqueue("hello")) - waitForConsume(1, "first message in queue not consumed") - - processor.retErr = errors.New("test error") - require.NoError(t, q.Enqueue("this element should be met with an error in the processor")) - waitForConsume(2, "second message in queue, which should cause a processor error, not consumed") - - processor.retErr = nil - require.NoError(t, q.Enqueue("world")) - waitForConsume(3, "third message not consumed - did the previous error kill the processor?") - }) -} - -type TestWaitGroupCountProcessor struct { - wg sync.WaitGroup - mu struct { - syncutil.Mutex - timesCalled int - } -} - -func (t *TestWaitGroupCountProcessor) Process(_ context.Context, _ string) error { - t.wg.Wait() - t.mu.Lock() - defer t.mu.Unlock() - t.mu.timesCalled++ - return nil -} - -var _ EventProcessor[string] = (*TestWaitGroupCountProcessor)(nil) - -type TestCountProcessor struct { - retErr error - mu struct { - syncutil.Mutex - timesCalled int - } -} - -func (t *TestCountProcessor) Process(_ context.Context, _ string) error { - t.mu.Lock() - defer t.mu.Unlock() - t.mu.timesCalled++ - if t.retErr != nil { - return t.retErr - } - return nil -} - -var _ EventProcessor[string] = (*TestCountProcessor)(nil) diff --git a/pkg/obsservice/obslib/process/processor.go b/pkg/obsservice/obslib/process/processor.go deleted file mode 100644 index 7c2999756c61..000000000000 --- a/pkg/obsservice/obslib/process/processor.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package process - -import ( - "context" - "fmt" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/validate" - "github.com/cockroachdb/errors" -) - -// EventProcessor is the interface that defines a component capable of -// processing individual events of type T. In an event processing -// pipeline, once events have been ingested, transformed, and enqueued, -// they are ready for processing by a EventProcessor. A processor might be -// responsible for aggregating events, writing events to storage, etc. -// -// Processors are expected to be thread-safe. -type EventProcessor[T any] interface { - Process(ctx context.Context, event T) error -} - -// ProcessorGroup is a modular, event-type-specific group of steps -// designed to process type-specific events. Processing could involve -// aggregation, writing events to storage, etc. The ProcessorGroup is -// not concerned with the individual functions of each Processor, but -// instead groups together common functionality involved with processing -// enqueued events. -// -// It can be provided with multiple Validators (called sequentially) and -// multiple EventProcessor's (called sequentially) at initialization. -// -// ProcessorGroup is thread-safe. -// -// TODO(abarganier): T is okay as `any` for now, but eventually we might require that it can provide some basic -// metadata about the event. When such a need arises, change to an interface type that ensures the ability to -// fetch such metadata. Such a change would need to apply to transformers/validators/producers as well. -type ProcessorGroup[T any] struct { - alias string - ownerTeam obslib.OwnerTeam - logPrefix string - validators []validate.Validator[T] - processors []EventProcessor[T] -} - -func NewProcessorGroup[T any]( - alias string, - ownerTeam obslib.OwnerTeam, - validators []validate.Validator[T], - processors []EventProcessor[T], -) (*ProcessorGroup[T], error) { - if len(validators) == 0 { - return nil, errors.New("must provide at least one Validator") - } - if len(processors) == 0 { - return nil, errors.New("must provide at least one EventProcessor") - } - processorAlias := fmt.Sprintf("%s-processor", alias) - return &ProcessorGroup[T]{ - alias: processorAlias, - ownerTeam: ownerTeam, - logPrefix: fmt.Sprintf("[%s,%s]", ownerTeam, processorAlias), - validators: validators, - processors: processors, - }, nil -} - -// TODO(abarganier): histogram for ProcessorGroup latency. -// TODO(abarganier): smarter logging strategy for errors, to avoid log spam. -func (p ProcessorGroup[T]) Process(ctx context.Context, event T) error { - var validationErrors error - for _, validator := range p.validators { - if err := validator.Validate(event); err != nil { - // TODO(abarganier): Counter metrics for validation errors. - validationErrors = errors.CombineErrors(err, validationErrors) - } - } - if validationErrors != nil { - return errors.Wrapf(validationErrors, "%s event validation failed", p.logPrefix) - } - var processorErrors error - for _, processor := range p.processors { - if err := processor.Process(ctx, event); err != nil { - // TODO(abarganier): Counter metrics for processor errors. - processorErrors = errors.CombineErrors(err, processorErrors) - } - } - if processorErrors != nil { - return errors.Wrapf(processorErrors, "%s failed to process event", p.logPrefix) - } - return nil -} - -var _ EventProcessor[any] = (*ProcessorGroup[any])(nil) diff --git a/pkg/obsservice/obslib/process/processor_test.go b/pkg/obsservice/obslib/process/processor_test.go deleted file mode 100644 index 35485eb00d9f..000000000000 --- a/pkg/obsservice/obslib/process/processor_test.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package process - -import ( - "context" - "testing" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/validate" - "github.com/cockroachdb/cockroach/pkg/util/leaktest" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/errors" - "github.com/stretchr/testify/require" -) - -func TestProcessorGroup_Process(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - - ctx := context.Background() - - tests := []struct { - name string - validators []validate.Validator[string] - processors []EventProcessor[string] - wantErr bool - errMsg string - }{ - { - name: "processes event", - validators: []validate.Validator[string]{&TestValidator{}, &TestValidator{}}, // Empty TestValidators will succeed - processors: []EventProcessor[string]{&TestProcessor{}, &TestProcessor{}}, // Empty TestProcessor will succeed - }, - { - name: "returns validation error", - validators: []validate.Validator[string]{ - &TestValidator{}, - &TestValidator{retErr: errors.New("validation error")}, - }, - processors: []EventProcessor[string]{&TestProcessor{}, &TestProcessor{}}, - wantErr: true, - errMsg: "validation error", - }, - { - name: "returns processor error", - validators: []validate.Validator[string]{&TestValidator{}, &TestValidator{}}, - processors: []EventProcessor[string]{&TestProcessor{}, &TestProcessor{retErr: errors.New("processor error")}}, - wantErr: true, - errMsg: "processor error", - }, - } - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - pg, err := NewProcessorGroup[string]( - "test-alias", - "test-team", - tc.validators, - tc.processors) - require.NoError(t, err) - testEvent := "some string" - err = pg.Process(ctx, testEvent) - if tc.wantErr { - require.Error(t, err) - require.ErrorContains(t, err, tc.errMsg) - return - } - require.NoError(t, err) - for _, v := range tc.validators { - require.Truef(t, v.(*TestValidator).called, "validator not called") - } - for _, p := range tc.processors { - require.Truef(t, p.(*TestProcessor).called, "processor not called") - } - }) - } -} - -type TestValidator struct { - retErr error - called bool -} - -var _ validate.Validator[string] = (*TestValidator)(nil) - -func (t *TestValidator) Validate(_ string) error { - t.called = true - return t.retErr -} - -type TestProcessor struct { - retErr error - called bool -} - -func (t *TestProcessor) Process(_ context.Context, _ string) error { - t.called = true - return t.retErr -} - -var _ EventProcessor[string] = (*TestProcessor)(nil) diff --git a/pkg/obsservice/obslib/process/processor_utils.go b/pkg/obsservice/obslib/process/processor_utils.go deleted file mode 100644 index 80d101cc3f1d..000000000000 --- a/pkg/obsservice/obslib/process/processor_utils.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package process - -import ( - "context" - gosql "database/sql" - - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/errors" - "github.com/jackc/pgx/v5/pgxpool" - "github.com/jackc/pgx/v5/stdlib" -) - -func OpenDBSync(ctx context.Context, sinkPGURL string) (*gosql.DB, error) { - defaultSinkDBName := "obsservice" - connCfg, err := pgxpool.ParseConfig(sinkPGURL) - if err != nil { - return nil, errors.Wrapf(err, "invalid --sink-pgurl (%s)", sinkPGURL) - } - if connCfg.ConnConfig.Database != defaultSinkDBName { - if connCfg.ConnConfig.Database != "" { - log.Warningf(ctx, - "--sink-pgurl string contains a database name (%s) other than 'obsservice' - overriding", - connCfg.ConnConfig.Database) - } - // We don't want to accidentally write things to the wrong DB in the event that - // one is accidentally provided in the --sink-pgurl (as is common with defaultdb). - // Always override to defaultSinkDBName. - connCfg.ConnConfig.Database = defaultSinkDBName - } - - return stdlib.OpenDB(*connCfg.ConnConfig), nil -} diff --git a/pkg/obsservice/obslib/produce/BUILD.bazel b/pkg/obsservice/obslib/produce/BUILD.bazel deleted file mode 100644 index 17b98d0c168d..000000000000 --- a/pkg/obsservice/obslib/produce/BUILD.bazel +++ /dev/null @@ -1,35 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "produce", - srcs = [ - "mem_queue_producer.go", - "producer.go", - ], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/produce", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obslib", - "//pkg/obsservice/obslib/queue", - "//pkg/obsservice/obslib/transform", - "//pkg/obsservice/obslib/validate", - "//pkg/obsservice/obspb", - "//pkg/util/log", - "@com_github_cockroachdb_errors//:errors", - ], -) - -go_test( - name = "produce_test", - srcs = ["producer_test.go"], - embed = [":produce"], - deps = [ - "//pkg/obsservice/obslib/transform", - "//pkg/obsservice/obslib/validate", - "//pkg/obsservice/obspb", - "//pkg/util/leaktest", - "//pkg/util/log", - "@com_github_cockroachdb_errors//:errors", - "@com_github_stretchr_testify//require", - ], -) diff --git a/pkg/obsservice/obslib/produce/mem_queue_producer.go b/pkg/obsservice/obslib/produce/mem_queue_producer.go deleted file mode 100644 index 5ef185527c56..000000000000 --- a/pkg/obsservice/obslib/produce/mem_queue_producer.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package produce - -import "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/queue" - -// MemQueueProducer is the EventProducer implementation for -// the queue.MemoryQueue. Like the queue.MemoryQueue, it uses -// generics to enforce the type of the events produced into -// the underlying queue. -// -// Expected for use with the ProducerGroup type. Users should -// inject it to an event type's ProducerGroup as one of its -// EventProducer's. -type MemQueueProducer[T any] struct { - EventProducer[T] - queue *queue.MemoryQueue[T] -} - -var _ EventProducer[any] = (*MemQueueProducer[any])(nil) - -// NewMemQueueProducer instantiates and returns a new *MemQueueProducer. -// The underlying queue.MemoryQueue is injected as a dependency, so that it -// can also be injected into its corresponding consumer. -func NewMemQueueProducer[T any](q *queue.MemoryQueue[T]) *MemQueueProducer[T] { - return &MemQueueProducer[T]{ - queue: q, - } -} - -func (m *MemQueueProducer[T]) Produce(e T) error { - return m.queue.Enqueue(e) -} diff --git a/pkg/obsservice/obslib/produce/producer.go b/pkg/obsservice/obslib/produce/producer.go deleted file mode 100644 index f8b8a93e8fa6..000000000000 --- a/pkg/obsservice/obslib/produce/producer.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package produce - -import ( - "context" - "fmt" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/transform" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/validate" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/errors" -) - -// EventProducer defines how to produce an event into an event-specific -// queue to await processing by the Obs. Platform. -// -// EventProducer implementations are expected to be thread-safe. -type EventProducer[T any] interface { - Produce(T) error -} - -// ProducerGroup is a modular, event-type-specific group of steps -// designed to take a routed obspb.Event through the necessary procedure -// to transform it into its event-specific type, validate that event, -// and enqueue it to await processing by the Obs. Platform. It can be -// provided with a Transformer, multiple Validators (called sequentially), -// and multiple Producers (called sequentially) at initialization. -// -// ProducerGroup is thread-safe. -// -// TODO(abarganier): T is okay as `any` for now, but eventually we might require that it can provide some basic -// metadata about the event. When such a need arises, change to an interface type that ensures the ability to -// fetch such metadata. Such a change would need to apply to transformers/validators/producers as well. -type ProducerGroup[T any] struct { - alias string - ownerTeam obslib.OwnerTeam - logPrefix string - transformer transform.EventTransformer[T] - validators []validate.Validator[T] - producers []EventProducer[T] -} - -var _ obslib.EventConsumer = (*ProducerGroup[any])(nil) - -func NewProducerGroup[T any]( - alias string, - ownerTeam obslib.OwnerTeam, - transformer transform.EventTransformer[T], - validators []validate.Validator[T], - producers []EventProducer[T], -) (*ProducerGroup[T], error) { - producerAlias := fmt.Sprintf("%s-producer", alias) - if transformer == nil { - return nil, errors.Newf("nil transformer provided to %s", producerAlias) - } - if len(validators) == 0 { - return nil, errors.Newf("must provide at least one Validator to %s", producerAlias) - } - if len(producers) == 0 { - return nil, errors.Newf("must provide at least one EventProducer to %s", producerAlias) - } - return &ProducerGroup[T]{ - alias: producerAlias, - ownerTeam: ownerTeam, - logPrefix: fmt.Sprintf("[%s,%s]", ownerTeam, producerAlias), - transformer: transformer, - validators: validators, - producers: producers, - }, nil -} - -// TODO(abarganier): histogram for ProducerGroup latency. -// TODO(abarganier): smarter logging strategy for errors, to avoid log spam. -func (p *ProducerGroup[T]) Consume(ctx context.Context, event *obspb.Event) error { - // TODO(abarganier): event-agnostic metadata validation. - transformed, err := p.transformer.Transform(event) - if err != nil { - // TODO(abarganier): Counter metrics for transformation errors. - log.Errorf(ctx, "%s failed to transform, err = %v", p.logPrefix, err) - return errors.Wrap(err, "transforming event") - } - var validationErrors error - for _, validator := range p.validators { - if err := validator.Validate(transformed); err != nil { - // TODO(abarganier): Counter metrics for validation errors. - validationErrors = errors.CombineErrors(err, validationErrors) - } - } - if validationErrors != nil { - log.Errorf(ctx, "%s event validation failed, err = %v", p.logPrefix, err) - return validationErrors - } - var produceErrors error - for _, producer := range p.producers { - if err := producer.Produce(transformed); err != nil { - // TODO(abarganier): Counter metrics for producer errors. - produceErrors = errors.CombineErrors(err, produceErrors) - } - } - if produceErrors != nil { - log.Errorf(ctx, "%s failed to produce event, err = %v", p.logPrefix, err) - return produceErrors - } - return nil -} diff --git a/pkg/obsservice/obslib/produce/producer_test.go b/pkg/obsservice/obslib/produce/producer_test.go deleted file mode 100644 index d0bae331d72c..000000000000 --- a/pkg/obsservice/obslib/produce/producer_test.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package produce - -import ( - "context" - "testing" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/transform" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/validate" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - "github.com/cockroachdb/cockroach/pkg/util/leaktest" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/errors" - "github.com/stretchr/testify/require" -) - -func TestProducerGroup_Consume(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - - ctx := context.Background() - - tests := []struct { - name string - transformer *TestTransformer - validators []validate.Validator[string] - producers []EventProducer[string] - wantErr bool - errMsg string - }{ - { - name: "consumes event", - transformer: &TestTransformer{ - toReturn: "data", - }, - validators: []validate.Validator[string]{&TestValidator{}, &TestValidator{}}, // Empty TestValidators will succeed - producers: []EventProducer[string]{&TestProducer{}, &TestProducer{}}, // Empty TestProducers will succeed - }, - { - name: "returns transform error", - transformer: &TestTransformer{ - retErr: errors.New("transform error"), - }, - validators: []validate.Validator[string]{&TestValidator{}}, - producers: []EventProducer[string]{&TestProducer{}}, - wantErr: true, - errMsg: "transform error", - }, - { - name: "returns validation errors", - transformer: &TestTransformer{ - toReturn: "data", - }, - validators: []validate.Validator[string]{ - &TestValidator{}, - &TestValidator{retErr: errors.New("validation error")}, - }, - producers: []EventProducer[string]{&TestProducer{}}, - wantErr: true, - errMsg: "validation error", - }, - { - name: "returns producer errors", - transformer: &TestTransformer{ - toReturn: "data", - }, - validators: []validate.Validator[string]{ - &TestValidator{}, - }, - producers: []EventProducer[string]{ - &TestProducer{}, - &TestProducer{ - retErr: errors.New("producer error"), - }, - }, - wantErr: true, - errMsg: "producer error", - }, - } - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - pg, err := NewProducerGroup[string]( - "test-alias", // alias - "test-team", // ownerTeam - tc.transformer, - tc.validators, - tc.producers) - require.NoError(t, err) - testEvent := &obspb.Event{} - err = pg.Consume(ctx, testEvent) - if tc.wantErr { - require.Error(t, err) - require.ErrorContains(t, err, tc.errMsg) - return - } - require.NoError(t, err) - require.Truef(t, tc.transformer.called, "transformer not called") - for _, validator := range tc.validators { - require.Truef(t, validator.(*TestValidator).called, "validator not called") - } - for _, producer := range tc.producers { - require.Truef(t, producer.(*TestProducer).called, "producer not called") - } - }) - } -} - -type TestProducer struct { - retErr error - called bool -} - -func (t *TestProducer) Produce(_ string) error { - t.called = true - return t.retErr -} - -var _ EventProducer[string] = (*TestProducer)(nil) - -type TestValidator struct { - retErr error - called bool -} - -var _ validate.Validator[string] = (*TestValidator)(nil) - -func (t *TestValidator) Validate(_ string) error { - t.called = true - return t.retErr -} - -type TestTransformer struct { - toReturn string - retErr error - called bool -} - -var _ transform.EventTransformer[string] = (*TestTransformer)(nil) - -func (t *TestTransformer) Transform(_ *obspb.Event) (string, error) { - t.called = true - if t.toReturn != "" { - return t.toReturn, nil - } - return "", t.retErr -} diff --git a/pkg/obsservice/obslib/queue/BUILD.bazel b/pkg/obsservice/obslib/queue/BUILD.bazel deleted file mode 100644 index 17d7c41649c8..000000000000 --- a/pkg/obsservice/obslib/queue/BUILD.bazel +++ /dev/null @@ -1,24 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "queue", - srcs = ["mem_queue.go"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/queue", - visibility = ["//visibility:public"], - deps = [ - "//pkg/util/syncutil", - "@com_github_cockroachdb_errors//:errors", - ], -) - -go_test( - name = "queue_test", - srcs = ["mem_queue_test.go"], - embed = [":queue"], - deps = [ - "//pkg/util/leaktest", - "//pkg/util/log", - "@com_github_gogo_protobuf//proto", - "@com_github_stretchr_testify//require", - ], -) diff --git a/pkg/obsservice/obslib/queue/mem_queue.go b/pkg/obsservice/obslib/queue/mem_queue.go deleted file mode 100644 index d89baae15d93..000000000000 --- a/pkg/obsservice/obslib/queue/mem_queue.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package queue - -import ( - "container/list" - - "github.com/cockroachdb/cockroach/pkg/util/syncutil" - "github.com/cockroachdb/errors" -) - -// SizeFn returns the size, in bytes, of type T. Used for the MemoryQueue -// to determine the size of enqueued/dequeued elements. -type SizeFn[T any] func(T) int - -// MemoryQueue is a FIFO, in-memory event queue designed for use by the -// observability service for buffering events awaiting processing. -// It's elements are intended to be protobuf messages, which by default -// implement the proto.Sizer interface. This provides us a convenient -// way to determine the size of buffered events on Enqueue / Dequeue -// to enforce the configured maxSize. -// -// MemoryQueue is backed by the container/list package from the Golang -// stdlib, which is a linked list under the hood. This allows us to avoid -// holding onto unused memory like you would by trimming a pre-allocated -// slice (e.g. mySlice[1:]) when dequeue'ing elements from the front. -// See: https://pkg.go.dev/container/list for details. -// -// See NewMemoryQueue for initialization. -type MemoryQueue[T any] struct { - alias string - sizeFn SizeFn[T] - mu struct { - syncutil.Mutex - queue *list.List - maxSize int - curSize int - } -} - -// NewMemoryQueue instantiates and returns a new *MemoryQueue, whose size -// in bytes is bounded by the provided maxBytes amount. -// -// An alias should also be provided to describe the events being buffered, -// for clearer error messaging (and therefore, clearer logging). -func NewMemoryQueue[T any](maxBytes int, sizeFn SizeFn[T], alias string) *MemoryQueue[T] { - q := &MemoryQueue[T]{ - alias: alias, - sizeFn: sizeFn, - } - q.mu.queue = list.New() - q.mu.maxSize = maxBytes - return q -} - -// Alias returns this MemoryQueue's alias, provided at initialization. Useful for logging. -func (q *MemoryQueue[T]) Alias() string { - return q.alias -} - -// Enqueue adds the provided element to the MemoryQueue, so long -// as it would not exceed the configured max size for this -// MemoryQueue in bytes. FIFO order is maintained. -// -// If buffering the provided element would exceed the configured -// max size, an error is returned and the element is not buffered. -func (q *MemoryQueue[T]) Enqueue(e T) error { - size := q.sizeFn(e) - q.mu.Lock() - defer q.mu.Unlock() - if q.mu.curSize+size > q.mu.maxSize { - return errors.Newf("size limit reached for %s queue, message dropped", q.alias) - } - // TODO(abarganier): Gauge metric(s) to track queue size & length. - q.mu.curSize = q.mu.curSize + size - q.mu.queue.PushBack(e) - return nil -} - -// Dequeue removes and returns the oldest element from this -// MemoryQueue. If this MemoryQueue is empty, false is returned along -// with the zero-value of T, else true is returned along with the dequeued -// element. -func (q *MemoryQueue[T]) Dequeue() (T, bool) { - q.mu.Lock() - defer q.mu.Unlock() - // NB: The value of ret is the zero value of T, unless assigned. - var ret T - if q.mu.queue.Len() == 0 { - return ret, false - } - e := q.mu.queue.Front() - q.mu.queue.Remove(e) - ret, ok := e.Value.(T) - if !ok { - panic(errors.AssertionFailedf("unable to assert type on Dequeue() for %s queue: %v", q.alias, e.Value)) - } - size := q.sizeFn(ret) - // TODO(abarganier): Gauge metric(s) to track queue size & length. - q.mu.curSize = q.mu.curSize - size - return ret, true -} - -func (q *MemoryQueue[T]) Len() int { - q.mu.Lock() - defer q.mu.Unlock() - return q.mu.queue.Len() -} diff --git a/pkg/obsservice/obslib/queue/mem_queue_test.go b/pkg/obsservice/obslib/queue/mem_queue_test.go deleted file mode 100644 index bbeeef3f2772..000000000000 --- a/pkg/obsservice/obslib/queue/mem_queue_test.go +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package queue - -import ( - "testing" - - "github.com/cockroachdb/cockroach/pkg/util/leaktest" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/require" -) - -func TestMemoryQueue_Enqueue(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - sizeFn := func(e *testElement) int { - return e.Size() - } - - tests := []struct { - name string - maxBytes int - toEnqueue []*testElement - expLen int - // Expected size of queue in bytes after a single Dequeue call - expByteSize int - // applies to the final enqueue call for elements in toEnqueue - wantErr bool - }{ - { - name: "enqueues up to maxBytes", - maxBytes: 20, - toEnqueue: []*testElement{ - newTestEl(10), - newTestEl(10), - }, - expByteSize: 20, - expLen: 2, - }, - { - name: "returns error past maxBytes, does not enqueue", - maxBytes: 29, - toEnqueue: []*testElement{ - newTestEl(10), - newTestEl(10), - newTestEl(10), - }, - expByteSize: 20, - expLen: 2, - wantErr: true, - }, - } - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - q := NewMemoryQueue[*testElement](tc.maxBytes, sizeFn, "enqueue_test") - var err error - for i, el := range tc.toEnqueue { - err = q.Enqueue(el) - if i < len(tc.toEnqueue)-1 { - require.NoError(t, err) - } - } - func() { - q.mu.Lock() - defer q.mu.Unlock() - require.Equalf(t, q.mu.curSize, tc.expByteSize, "unexpected size in bytes") - }() - require.Equalf(t, q.Len(), tc.expLen, "unexpected queue length") - if tc.wantErr { - require.Error(t, err) - return - } - require.NoError(t, err) - }) - } -} - -func TestMemoryQueue_Dequeue(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - sizeFn := func(e *testElement) int { - return e.Size() - } - - element1 := newTestEl(10) - element2 := newTestEl(10) - element3 := newTestEl(10) - tests := []struct { - name string - maxBytes int - toEnqueue []*testElement - expected *testElement - // Expected size of queue in bytes after a single Dequeue call - expByteSize int - // Expected length after a single Dequeue call - expLen int - }{ - { - name: "one in, one out", - maxBytes: 10, - toEnqueue: []*testElement{ - element1, - }, - expected: element1, - expByteSize: 0, - expLen: 0, - }, - { - name: "two in, one out", - maxBytes: 20, - toEnqueue: []*testElement{ - element1, - element2, - }, - expected: element1, - expByteSize: 10, - expLen: 1, - }, - { - name: "three in, max bytes reached, one out", - maxBytes: 20, - toEnqueue: []*testElement{ - element1, - element2, - element3, - }, - expected: element1, - expByteSize: 10, - expLen: 1, - }, - { - name: "nothing in, nothing out", - maxBytes: 20, - toEnqueue: []*testElement{}, - expected: nil, - expByteSize: 0, - expLen: 0, - }, - } - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - q := NewMemoryQueue[*testElement](tc.maxBytes, sizeFn, "enqueue_test") - for _, el := range tc.toEnqueue { - // Expected returns of Enqueue are tested separately. - _ = q.Enqueue(el) - } - actual, ok := q.Dequeue() - require.Equal(t, tc.expected, actual) - if tc.expected != nil { - require.True(t, ok) - } else { - require.False(t, ok) - } - require.Equalf(t, q.Len(), tc.expLen, "unexpected queue length") - func() { - q.mu.Lock() - defer q.mu.Unlock() - require.Equalf(t, q.mu.curSize, tc.expByteSize, "unexpected size in bytes") - }() - }) - } -} - -type testElement struct { - size int -} - -func newTestEl(size int) *testElement { - return &testElement{size: size} -} - -func (t *testElement) Size() int { - return t.size -} - -var _ proto.Sizer = (*testElement)(nil) diff --git a/pkg/obsservice/obslib/router/BUILD.bazel b/pkg/obsservice/obslib/router/BUILD.bazel deleted file mode 100644 index 743811260ac6..000000000000 --- a/pkg/obsservice/obslib/router/BUILD.bazel +++ /dev/null @@ -1,30 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "router", - srcs = ["event_router.go"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/router", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obslib", - "//pkg/obsservice/obspb", - "//pkg/util/log", - "@com_github_cockroachdb_errors//:errors", - ], -) - -go_test( - name = "router_test", - srcs = ["event_router_test.go"], - embed = [":router"], - deps = [ - "//pkg/obsservice/obslib", - "//pkg/obsservice/obslib/obsutil", - "//pkg/obsservice/obspb", - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:common", - "//pkg/util/leaktest", - "//pkg/util/log", - "@com_github_cockroachdb_errors//:errors", - "@com_github_stretchr_testify//require", - ], -) diff --git a/pkg/obsservice/obslib/router/event_router.go b/pkg/obsservice/obslib/router/event_router.go deleted file mode 100644 index 61e7ed66db99..000000000000 --- a/pkg/obsservice/obslib/router/event_router.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package router - -import ( - "context" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/errors" -) - -// EventRouter is meant to router events based on their event -// type to the appropriate producer group for the given events. -type EventRouter struct { - routes map[obspb.EventType]obslib.EventConsumer -} - -func NewEventRouter(routes map[obspb.EventType]obslib.EventConsumer) *EventRouter { - return &EventRouter{ - routes: routes, - } -} - -// Consume consumes the event and routes it accordingly based on its event type. -// We intentionally log & swallow errors related to various validation errors -// (e.g. missing event.Scope or an event type we don't know how to route) as we -// want to avoid returning errors to CRDB clients for minor issues like these. -func (e *EventRouter) Consume(ctx context.Context, event *obspb.Event) error { - if event.Scope == nil { - // TODO(abarganier): track drop records due to validation errors such as - // this using metrics. - log.Errorf(ctx, "unable to route event, missing instrumentation scope: %v", event) - return errors.Newf("missing event InstrumentationScope: %v", event) - } - if route, ok := e.routes[obspb.EventType(event.Scope.Name)]; ok { - if err := route.Consume(ctx, event); err != nil { - log.Errorf(ctx, "unable to consume event: %v", event) - return errors.Wrapf(err, "consuming event") - } - } else { - // TODO(abarganier): track drop records due to validation errors such as - // this using metrics. - log.Errorf(ctx, "router not equipped to handle event type: %s", event.Scope.Name) - return errors.Newf("router does not know how to route event type: %q", event.Scope.Name) - } - return nil -} - -var _ obslib.EventConsumer = (*EventRouter)(nil) diff --git a/pkg/obsservice/obslib/router/event_router_test.go b/pkg/obsservice/obslib/router/event_router_test.go deleted file mode 100644 index de66afdc421a..000000000000 --- a/pkg/obsservice/obslib/router/event_router_test.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package router - -import ( - "context" - "testing" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/obsutil" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - otel_pb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/common/v1" - "github.com/cockroachdb/cockroach/pkg/util/leaktest" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/errors" - "github.com/stretchr/testify/require" -) - -func TestEventRouter_Consume(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - - ctx := context.Background() - - var testEventType obspb.EventType = "testeventtype" - var testErrorEventType obspb.EventType = "testerroreventtype" - errorConsumer := obsutil.NewTestErrorConsumer(errors.New("test error")) - - tests := []struct { - name string - event *obspb.Event - wantErr bool - errMsg string - }{ - { - name: "routes event", - event: &obspb.Event{ - Scope: &otel_pb.InstrumentationScope{ - Name: string(obspb.EventlogEvent), - Version: "1.0", - }, - }, - }, - { - name: "errors with unknown event type", - event: &obspb.Event{ - Scope: &otel_pb.InstrumentationScope{ - Name: "unknown type", - Version: "1.0", - }, - }, - wantErr: true, - errMsg: "router does not know how to route event type", - }, - { - name: "errors with missing instrumentation scope", - event: &obspb.Event{}, - wantErr: true, - errMsg: "missing event InstrumentationScope", - }, - { - name: "passes back consumer errors", - event: &obspb.Event{ - Scope: &otel_pb.InstrumentationScope{ - Name: string(testErrorEventType), - Version: "1.0", - }, - }, - wantErr: true, - errMsg: "test error", - }, - } - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - wantConsumer := obsutil.NewTestCaptureConsumer() - otherConsumer := obsutil.NewTestCaptureConsumer() - e := NewEventRouter(map[obspb.EventType]obslib.EventConsumer{ - obspb.EventlogEvent: wantConsumer, - testEventType: otherConsumer, - testErrorEventType: errorConsumer, - }) - err := e.Consume(ctx, tc.event) - if tc.wantErr { - require.Error(t, err) - require.ErrorContains(t, err, tc.errMsg) - return - } - require.NoError(t, err) - require.Equal(t, wantConsumer.Len(), 1) - require.Zero(t, otherConsumer.Len()) - }) - } -} diff --git a/pkg/obsservice/obslib/transform/BUILD.bazel b/pkg/obsservice/obslib/transform/BUILD.bazel deleted file mode 100644 index f7c9714c4345..000000000000 --- a/pkg/obsservice/obslib/transform/BUILD.bazel +++ /dev/null @@ -1,19 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "transform", - srcs = [ - "event_info_transformer.go", - "log_record_to_event.go", - "transformer.go", - ], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/transform", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obspb", - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:common", - "//pkg/obsservice/obspb/opentelemetry-proto/logs/v1:logs", - "//pkg/obsservice/obspb/opentelemetry-proto/resource/v1:resource", - "//pkg/util/timeutil", - ], -) diff --git a/pkg/obsservice/obslib/transform/event_info_transformer.go b/pkg/obsservice/obslib/transform/event_info_transformer.go deleted file mode 100644 index 8422289cf3d4..000000000000 --- a/pkg/obsservice/obslib/transform/event_info_transformer.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package transform - -import ( - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - "github.com/cockroachdb/cockroach/pkg/util/timeutil" -) - -func GetEventInfo(event *obspb.Event, eventId string) *obspb.EventInfo { - ts := timeutil.FromUnixNanos(int64(event.LogRecord.TimeUnixNano)) - - eventInfo := obspb.EventInfo{ - Timestamp: &ts, - EventID: eventId, - OrgID: "org_id", // TODO(marylia): replace with real value - } - - for _, attribute := range event.Resource.Attributes { - if attribute.Key == obspb.ClusterID { - eventInfo.ClusterID = attribute.Value.GetStringValue() - } - if attribute.Key == obspb.TenantID { - eventInfo.TenantID = attribute.Value.GetStringValue() - } - } - - return &eventInfo -} diff --git a/pkg/obsservice/obslib/transform/log_record_to_event.go b/pkg/obsservice/obslib/transform/log_record_to_event.go deleted file mode 100644 index 2afc0a66b97d..000000000000 --- a/pkg/obsservice/obslib/transform/log_record_to_event.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package transform - -import ( - "time" - - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - commonv1 "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/common/v1" - logsv1 "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/logs/v1" - resourcev1 "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/resource/v1" -) - -// LogRecordToEvent transforms a given LogRecord, with an accompanying -// Resource and Scope, into an internal Event message for further -// processing. -// -// We avoid using the EventTransformer here because the resulting -// obspb.Event's are not yet event-specific. -func LogRecordToEvent( - ingestTime time.Time, - resource *resourcev1.Resource, - scope *commonv1.InstrumentationScope, - logRecord *logsv1.LogRecord, -) *obspb.Event { - logRecord.ObservedTimeUnixNano = uint64(ingestTime.UnixNano()) - return &obspb.Event{ - Resource: resource, - Scope: scope, - LogRecord: logRecord, - } -} diff --git a/pkg/obsservice/obslib/transform/transformer.go b/pkg/obsservice/obslib/transform/transformer.go deleted file mode 100644 index cade7c8ddb75..000000000000 --- a/pkg/obsservice/obslib/transform/transformer.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package transform - -import "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - -// EventTransformer defines the interface used to transform -// a generic obspb.Event into its event-specific type. This -// is generally used prior to event-specific validation and -// enqueuing for processing. -// -// EventTransformer implementations are expected to be thread-safe. -type EventTransformer[T any] interface { - // Transform transforms the obspb.Event into an event-specific - // type, or returns an error if it was unable to do so. - Transform(event *obspb.Event) (T, error) -} diff --git a/pkg/obsservice/obslib/validate/BUILD.bazel b/pkg/obsservice/obslib/validate/BUILD.bazel deleted file mode 100644 index 226e2c505970..000000000000 --- a/pkg/obsservice/obslib/validate/BUILD.bazel +++ /dev/null @@ -1,8 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "validate", - srcs = ["validate.go"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/validate", - visibility = ["//visibility:public"], -) diff --git a/pkg/obsservice/obslib/validate/validate.go b/pkg/obsservice/obslib/validate/validate.go deleted file mode 100644 index 8d0d7b778125..000000000000 --- a/pkg/obsservice/obslib/validate/validate.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -package validate - -// Validator is the interface used to validate -// event-specific types. -// -// Validator implementations are expected to be thread-safe. -type Validator[T any] interface { - Validate(T) error -} diff --git a/pkg/obsservice/obspb/BUILD.bazel b/pkg/obsservice/obspb/BUILD.bazel deleted file mode 100644 index e291be6b8127..000000000000 --- a/pkg/obsservice/obspb/BUILD.bazel +++ /dev/null @@ -1,42 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "obspb", - srcs = [ - "event_types.go", - "resource.go", - ], - embed = [":obspb_go_proto"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb", - visibility = ["//visibility:public"], -) - -proto_library( - name = "obspb_proto", - srcs = ["obsservice.proto"], - strip_import_prefix = "/pkg", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:v1_proto", - "//pkg/obsservice/obspb/opentelemetry-proto/logs/v1:v1_proto", - "//pkg/obsservice/obspb/opentelemetry-proto/resource/v1:v1_proto", - "@com_github_gogo_protobuf//gogoproto:gogo_proto", - "@com_google_protobuf//:timestamp_proto", - ], -) - -go_proto_library( - name = "obspb_go_proto", - compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb", - proto = ":obspb_proto", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:common", - "//pkg/obsservice/obspb/opentelemetry-proto/logs/v1:logs", - "//pkg/obsservice/obspb/opentelemetry-proto/resource/v1:resource", - "@com_github_gogo_protobuf//gogoproto", - ], -) diff --git a/pkg/obsservice/obspb/README.md b/pkg/obsservice/obspb/README.md deleted file mode 100644 index 5d546eb9cb02..000000000000 --- a/pkg/obsservice/obspb/README.md +++ /dev/null @@ -1,21 +0,0 @@ -This dir contains the gRPC service definition used by CockroachDB to export data -to the Observability Service. - - -The `opentelemetry-proto` dir contains protos copied from -[opentelemetry-proto](https://github.com/open-telemetry/opentelemetry-proto). -They can be kept up to date with upstream by running -`./update-opentelemetry-proto.sh`. - - -We copy the protos that we need from `opentelemetry-proto` into our tree because -vendoring the upstream repo proved too difficult (it's not `go get`-able, some -of the protos in it don't build with gogoproto and also we already vendor -[opentelemetry-proto-go](https://github.com/open-telemetry/opentelemetry-proto-go), -which contains the protoc-compiled protos. This other repo clashes with the -import path the opentelemetry-proto wants. - -[opentelemetry-collector](https://github.com/open-telemetry/opentelemetry-collector) -also uses gogoproto, and has a complicated build pipeline for the protos. For -example, they transform all "optional" fields into "oneof" [using -sed](https://github.com/open-telemetry/opentelemetry-collector/blob/feab9491538a882737a5bceb8757b4458a86edd3/proto_patch.sed). diff --git a/pkg/obsservice/obspb/event_types.go b/pkg/obsservice/obspb/event_types.go deleted file mode 100644 index 713a953925ec..000000000000 --- a/pkg/obsservice/obspb/event_types.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 The Cockroach Authors. -// -// Licensed 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 - -package obspb - -// EventType identifies a type of event that the Obs Service can ingest. -type EventType string - -const ( - // EventlogEvent represents general events about the cluster that historically - // have been persisted inside CRDB in the system.eventlog table. - EventlogEvent EventType = "eventlog" -) - -// EventlogEventTypeAttribute represents the key of the attribute containing -// the event type of an EventlogEvent. -const EventlogEventTypeAttribute = "event_type" diff --git a/pkg/obsservice/obspb/obsservice.proto b/pkg/obsservice/obspb/obsservice.proto deleted file mode 100644 index 5cf5ab9bcbce..000000000000 --- a/pkg/obsservice/obspb/obsservice.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Licensed 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 - -syntax = "proto3"; - -package cockroach.obspb; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "obsservice/obspb/opentelemetry-proto/logs/v1/logs.proto"; -import "obsservice/obspb/opentelemetry-proto/common/v1/common.proto"; -import "obsservice/obspb/opentelemetry-proto/resource/v1/resource.proto"; - -option go_package = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb"; - -// A generic event record used within the Observability Service. -// Generally, the data within log_record is eventually transformed -// into an event-specific protobuf message for further processing, -// but this message represents the event in its raw form. -message Event { - // The resource for the event. - // If this field is not set then resource info is unknown. - // Contains information referring to the source of the event. - // For example, cluster ID, node ID, etc. - opentelemetry.proto.resource.v1.Resource resource = 1; - - // The instrumentation scope information for the event. Contains - // event-specific information. For example, event type and version. - opentelemetry.proto.common.v1.InstrumentationScope scope = 2; - - // The LogRecord containing the specific event information. - opentelemetry.proto.logs.v1.LogRecord log_record = 3; -} - -message EventInfo { - google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true]; - string event_id = 2 [(gogoproto.customname) = "EventID"]; - string org_id = 3 [(gogoproto.customname) = "OrgID"]; - string cluster_id = 4 [(gogoproto.customname) = "ClusterID"]; - string tenant_id = 5 [(gogoproto.customname) = "TenantID"]; -} diff --git a/pkg/obsservice/obspb/opentelemetry-proto.patch b/pkg/obsservice/obspb/opentelemetry-proto.patch deleted file mode 100644 index bdaee811f7a5..000000000000 --- a/pkg/obsservice/obspb/opentelemetry-proto.patch +++ /dev/null @@ -1,33 +0,0 @@ -This patch is applied by update-opentelemetry-proto.sh to the otel protos. - -diff --git a/pkg/obsservice/obspb/opentelemetry-proto/logs/v1/logs.proto b/pkg/obsservice/obspb/opentelemetry-proto/logs/v1/logs.proto -index 9629e39e9c..d5db90161f 100644 ---- a/pkg/obsservice/obspb/opentelemetry-proto/logs/v1/logs.proto -+++ b/pkg/obsservice/obspb/opentelemetry-proto/logs/v1/logs.proto -@@ -19,6 +19,8 @@ package opentelemetry.proto.logs.v1; - import "obsservice/obspb/opentelemetry-proto/common/v1/common.proto"; - import "obsservice/obspb/opentelemetry-proto/resource/v1/resource.proto"; - -+import "gogoproto/gogo.proto"; -+ - option csharp_namespace = "OpenTelemetry.Proto.Logs.V1"; - option java_multiple_files = true; - option java_package = "io.opentelemetry.proto.logs.v1"; -@@ -53,7 +55,7 @@ message ResourceLogs { - opentelemetry.proto.resource.v1.Resource resource = 1; - - // A list of ScopeLogs that originate from a resource. -- repeated ScopeLogs scope_logs = 2; -+ repeated ScopeLogs scope_logs = 2 [(gogoproto.nullable) = false ]; - - // This schema_url applies to the data in the "resource" field. It does not apply - // to the data in the "scope_logs" field which have their own schema_url field. -@@ -68,7 +70,7 @@ message ScopeLogs { - opentelemetry.proto.common.v1.InstrumentationScope scope = 1; - - // A list of log records. -- repeated LogRecord log_records = 2; -+ repeated LogRecord log_records = 2 [(gogoproto.nullable) = false ]; - - // This schema_url applies to all logs in the "logs" field. - string schema_url = 3; diff --git a/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1/BUILD.bazel b/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1/BUILD.bazel deleted file mode 100644 index 0c5da356d38c..000000000000 --- a/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1/BUILD.bazel +++ /dev/null @@ -1,27 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -proto_library( - name = "v1_proto", - srcs = ["logs_service.proto"], - strip_import_prefix = "/pkg", - visibility = ["//visibility:public"], - deps = ["//pkg/obsservice/obspb/opentelemetry-proto/logs/v1:v1_proto"], -) - -go_proto_library( - name = "v1_go_proto", - compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_grpc_compiler"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1", - proto = ":v1_proto", - visibility = ["//visibility:public"], - deps = ["//pkg/obsservice/obspb/opentelemetry-proto/logs/v1:logs"], -) - -go_library( - name = "logs_service", - embed = [":v1_go_proto"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1", - visibility = ["//visibility:public"], -) diff --git a/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1/logs_service.proto b/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1/logs_service.proto deleted file mode 100644 index 76aeaa5e4230..000000000000 --- a/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1/logs_service.proto +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2020, OpenTelemetry Authors -// -// Licensed 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. - -syntax = "proto3"; - -package opentelemetry.proto.collector.logs.v1; - -import "obsservice/obspb/opentelemetry-proto/logs/v1/logs.proto"; - -option csharp_namespace = "OpenTelemetry.Proto.Collector.Logs.V1"; -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.collector.logs.v1"; -option java_outer_classname = "LogsServiceProto"; -option go_package = "v1"; - -// Service that can be used to push logs between one Application instrumented with -// OpenTelemetry and an collector, or between an collector and a central collector (in this -// case logs are sent/received to/from multiple Applications). -service LogsService { - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. - rpc Export(ExportLogsServiceRequest) returns (ExportLogsServiceResponse) {} -} - -message ExportLogsServiceRequest { - // An array of ResourceLogs. - // For data coming from a single resource this array will typically contain one - // element. Intermediary nodes (such as OpenTelemetry Collector) that receive - // data from multiple origins typically batch the data before forwarding further and - // in that case this array will contain multiple elements. - repeated opentelemetry.proto.logs.v1.ResourceLogs resource_logs = 1; -} - -message ExportLogsServiceResponse { - // The details of a partially successful export request. - // - // If the request is only partially accepted - // (i.e. when the server accepts only parts of the data and rejects the rest) - // the server MUST initialize the `partial_success` field and MUST - // set the `rejected_` with the number of items it rejected. - // - // Servers MAY also make use of the `partial_success` field to convey - // warnings/suggestions to senders even when the request was fully accepted. - // In such cases, the `rejected_` MUST have a value of `0` and - // the `error_message` MUST be non-empty. - // - // A `partial_success` message with an empty value (rejected_ = 0 and - // `error_message` = "") is equivalent to it not being set/present. Senders - // SHOULD interpret it the same way as in the full success case. - ExportLogsPartialSuccess partial_success = 1; -} - -message ExportLogsPartialSuccess { - // The number of rejected log records. - // - // A `rejected_` field holding a `0` value indicates that the - // request was fully accepted. - int64 rejected_log_records = 1; - - // A developer-facing human-readable message in English. It should be used - // either to explain why the server rejected parts of the data during a partial - // success or to convey warnings/suggestions during a full success. The message - // should offer guidance on how users can address such issues. - // - // error_message is an optional field. An error_message with an empty value - // is equivalent to it not being set. - string error_message = 2; -} diff --git a/pkg/obsservice/obspb/opentelemetry-proto/common/v1/BUILD.bazel b/pkg/obsservice/obspb/opentelemetry-proto/common/v1/BUILD.bazel deleted file mode 100644 index 26791bc9eeec..000000000000 --- a/pkg/obsservice/obspb/opentelemetry-proto/common/v1/BUILD.bazel +++ /dev/null @@ -1,25 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -proto_library( - name = "v1_proto", - srcs = ["common.proto"], - strip_import_prefix = "/pkg", - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "v1_go_proto", - compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/common/v1", - proto = ":v1_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "common", - embed = [":v1_go_proto"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/common/v1", - visibility = ["//visibility:public"], -) diff --git a/pkg/obsservice/obspb/opentelemetry-proto/common/v1/common.proto b/pkg/obsservice/obspb/opentelemetry-proto/common/v1/common.proto deleted file mode 100644 index e7c20b5d257c..000000000000 --- a/pkg/obsservice/obspb/opentelemetry-proto/common/v1/common.proto +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2019, OpenTelemetry Authors -// -// Licensed 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. - -syntax = "proto3"; - -package opentelemetry.proto.common.v1; - -option csharp_namespace = "OpenTelemetry.Proto.Common.V1"; -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.common.v1"; -option java_outer_classname = "CommonProto"; -option go_package = "v1"; - -// AnyValue is used to represent any type of attribute value. AnyValue may contain a -// primitive value such as a string or integer or it may contain an arbitrary nested -// object containing arrays, key-value lists and primitives. -message AnyValue { - // The value is one of the listed fields. It is valid for all values to be unspecified - // in which case this AnyValue is considered to be "empty". - oneof value { - string string_value = 1; - bool bool_value = 2; - int64 int_value = 3; - double double_value = 4; - ArrayValue array_value = 5; - KeyValueList kvlist_value = 6; - bytes bytes_value = 7; - } -} - -// ArrayValue is a list of AnyValue messages. We need ArrayValue as a message -// since oneof in AnyValue does not allow repeated fields. -message ArrayValue { - // Array of values. The array may be empty (contain 0 elements). - repeated AnyValue values = 1; -} - -// KeyValueList is a list of KeyValue messages. We need KeyValueList as a message -// since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need -// a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to -// avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches -// are semantically equivalent. -message KeyValueList { - // A collection of key/value pairs of key-value pairs. The list may be empty (may - // contain 0 elements). - // The keys MUST be unique (it is not allowed to have more than one - // value with the same key). - repeated KeyValue values = 1; -} - -// KeyValue is a key-value pair that is used to store Span attributes, Link -// attributes, etc. -message KeyValue { - string key = 1; - AnyValue value = 2; -} - -// InstrumentationScope is a message representing the instrumentation scope information -// such as the fully qualified name and version. -message InstrumentationScope { - // An empty instrumentation scope name means the name is unknown. - string name = 1; - string version = 2; - - // Additional attributes that describe the scope. [Optional]. - // Attribute keys MUST be unique (it is not allowed to have more than one - // attribute with the same key). - repeated KeyValue attributes = 3; - uint32 dropped_attributes_count = 4; -} diff --git a/pkg/obsservice/obspb/opentelemetry-proto/logs/v1/BUILD.bazel b/pkg/obsservice/obspb/opentelemetry-proto/logs/v1/BUILD.bazel deleted file mode 100644 index 629a2a276fbb..000000000000 --- a/pkg/obsservice/obspb/opentelemetry-proto/logs/v1/BUILD.bazel +++ /dev/null @@ -1,35 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -proto_library( - name = "v1_proto", - srcs = ["logs.proto"], - strip_import_prefix = "/pkg", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:v1_proto", - "//pkg/obsservice/obspb/opentelemetry-proto/resource/v1:v1_proto", - "@com_github_gogo_protobuf//gogoproto:gogo_proto", - ], -) - -go_proto_library( - name = "v1_go_proto", - compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/logs/v1", - proto = ":v1_proto", - visibility = ["//visibility:public"], - deps = [ - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:common", - "//pkg/obsservice/obspb/opentelemetry-proto/resource/v1:resource", - "@com_github_gogo_protobuf//gogoproto", - ], -) - -go_library( - name = "logs", - embed = [":v1_go_proto"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/logs/v1", - visibility = ["//visibility:public"], -) diff --git a/pkg/obsservice/obspb/opentelemetry-proto/logs/v1/logs.proto b/pkg/obsservice/obspb/opentelemetry-proto/logs/v1/logs.proto deleted file mode 100644 index 6d5ec8e20690..000000000000 --- a/pkg/obsservice/obspb/opentelemetry-proto/logs/v1/logs.proto +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright 2020, OpenTelemetry Authors -// -// Licensed 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. - -syntax = "proto3"; - -package opentelemetry.proto.logs.v1; - -import "obsservice/obspb/opentelemetry-proto/common/v1/common.proto"; -import "obsservice/obspb/opentelemetry-proto/resource/v1/resource.proto"; - -import "gogoproto/gogo.proto"; - -option csharp_namespace = "OpenTelemetry.Proto.Logs.V1"; -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.logs.v1"; -option java_outer_classname = "LogsProto"; -option go_package = "v1"; - -// LogsData represents the logs data that can be stored in a persistent storage, -// OR can be embedded by other protocols that transfer OTLP logs data but do not -// implement the OTLP protocol. -// -// The main difference between this message and collector protocol is that -// in this message there will not be any "control" or "metadata" specific to -// OTLP protocol. -// -// When new fields are added into this message, the OTLP request MUST be updated -// as well. -message LogsData { - // An array of ResourceLogs. - // For data coming from a single resource this array will typically contain - // one element. Intermediary nodes that receive data from multiple origins - // typically batch the data before forwarding further and in that case this - // array will contain multiple elements. - repeated ResourceLogs resource_logs = 1; -} - -// A collection of ScopeLogs from a Resource. -message ResourceLogs { - reserved 1000; - - // The resource for the logs in this message. - // If this field is not set then resource info is unknown. - opentelemetry.proto.resource.v1.Resource resource = 1; - - // A list of ScopeLogs that originate from a resource. - repeated ScopeLogs scope_logs = 2; - - // This schema_url applies to the data in the "resource" field. It does not apply - // to the data in the "scope_logs" field which have their own schema_url field. - string schema_url = 3; -} - -// A collection of Logs produced by a Scope. -message ScopeLogs { - // The instrumentation scope information for the logs in this message. - // Semantically when InstrumentationScope isn't set, it is equivalent with - // an empty instrumentation scope name (unknown). - opentelemetry.proto.common.v1.InstrumentationScope scope = 1; - - // A list of log records. - repeated LogRecord log_records = 2; - - // This schema_url applies to all logs in the "logs" field. - string schema_url = 3; -} - -// Possible values for LogRecord.SeverityNumber. -enum SeverityNumber { - // UNSPECIFIED is the default SeverityNumber, it MUST NOT be used. - SEVERITY_NUMBER_UNSPECIFIED = 0; - SEVERITY_NUMBER_TRACE = 1; - SEVERITY_NUMBER_TRACE2 = 2; - SEVERITY_NUMBER_TRACE3 = 3; - SEVERITY_NUMBER_TRACE4 = 4; - SEVERITY_NUMBER_DEBUG = 5; - SEVERITY_NUMBER_DEBUG2 = 6; - SEVERITY_NUMBER_DEBUG3 = 7; - SEVERITY_NUMBER_DEBUG4 = 8; - SEVERITY_NUMBER_INFO = 9; - SEVERITY_NUMBER_INFO2 = 10; - SEVERITY_NUMBER_INFO3 = 11; - SEVERITY_NUMBER_INFO4 = 12; - SEVERITY_NUMBER_WARN = 13; - SEVERITY_NUMBER_WARN2 = 14; - SEVERITY_NUMBER_WARN3 = 15; - SEVERITY_NUMBER_WARN4 = 16; - SEVERITY_NUMBER_ERROR = 17; - SEVERITY_NUMBER_ERROR2 = 18; - SEVERITY_NUMBER_ERROR3 = 19; - SEVERITY_NUMBER_ERROR4 = 20; - SEVERITY_NUMBER_FATAL = 21; - SEVERITY_NUMBER_FATAL2 = 22; - SEVERITY_NUMBER_FATAL3 = 23; - SEVERITY_NUMBER_FATAL4 = 24; -} - -// LogRecordFlags is defined as a protobuf 'uint32' type and is to be used as -// bit-fields. Each non-zero value defined in this enum is a bit-mask. -// To extract the bit-field, for example, use an expression like: -// -// (logRecord.flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK) -// -enum LogRecordFlags { - // The zero value for the enum. Should not be used for comparisons. - // Instead use bitwise "and" with the appropriate mask as shown above. - LOG_RECORD_FLAGS_DO_NOT_USE = 0; - - // Bits 0-7 are used for trace flags. - LOG_RECORD_FLAGS_TRACE_FLAGS_MASK = 0x000000FF; - - // Bits 8-31 are reserved for future use. -} - -// A log record according to OpenTelemetry Log Data Model: -// https://github.com/open-telemetry/oteps/blob/main/text/logs/0097-log-data-model.md -message LogRecord { - reserved 4; - - // time_unix_nano is the time when the event occurred. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // Value of 0 indicates unknown or missing timestamp. - fixed64 time_unix_nano = 1; - - // Time when the event was observed by the collection system. - // For events that originate in OpenTelemetry (e.g. using OpenTelemetry Logging SDK) - // this timestamp is typically set at the generation time and is equal to Timestamp. - // For events originating externally and collected by OpenTelemetry (e.g. using - // Collector) this is the time when OpenTelemetry's code observed the event measured - // by the clock of the OpenTelemetry code. This field MUST be set once the event is - // observed by OpenTelemetry. - // - // For converting OpenTelemetry log data to formats that support only one timestamp or - // when receiving OpenTelemetry log data by recipients that support only one timestamp - // internally the following logic is recommended: - // - Use time_unix_nano if it is present, otherwise use observed_time_unix_nano. - // - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // Value of 0 indicates unknown or missing timestamp. - fixed64 observed_time_unix_nano = 11; - - // Numerical value of the severity, normalized to values described in Log Data Model. - // [Optional]. - SeverityNumber severity_number = 2; - - // The severity text (also known as log level). The original string representation as - // it is known at the source. [Optional]. - string severity_text = 3; - - // A value containing the body of the log record. Can be for example a human-readable - // string message (including multi-line) describing the event in a free form or it can - // be a structured data composed of arrays and maps of other values. [Optional]. - opentelemetry.proto.common.v1.AnyValue body = 5; - - // Additional attributes that describe the specific event occurrence. [Optional]. - // Attribute keys MUST be unique (it is not allowed to have more than one - // attribute with the same key). - repeated opentelemetry.proto.common.v1.KeyValue attributes = 6; - uint32 dropped_attributes_count = 7; - - // Flags, a bit field. 8 least significant bits are the trace flags as - // defined in W3C Trace Context specification. 24 most significant bits are reserved - // and must be set to 0. Readers must not assume that 24 most significant bits - // will be zero and must correctly mask the bits when reading 8-bit trace flag (use - // flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK). [Optional]. - fixed32 flags = 8; - - // A unique identifier for a trace. All logs from the same trace share - // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR - // of length other than 16 bytes is considered invalid (empty string in OTLP/JSON - // is zero-length and thus is also invalid). - // - // This field is optional. - // - // The receivers SHOULD assume that the log record is not associated with a - // trace if any of the following is true: - // - the field is not present, - // - the field contains an invalid value. - bytes trace_id = 9; - - // A unique identifier for a span within a trace, assigned when the span - // is created. The ID is an 8-byte array. An ID with all zeroes OR of length - // other than 8 bytes is considered invalid (empty string in OTLP/JSON - // is zero-length and thus is also invalid). - // - // This field is optional. If the sender specifies a valid span_id then it SHOULD also - // specify a valid trace_id. - // - // The receivers SHOULD assume that the log record is not associated with a - // span if any of the following is true: - // - the field is not present, - // - the field contains an invalid value. - bytes span_id = 10; -} diff --git a/pkg/obsservice/obspb/opentelemetry-proto/resource/v1/BUILD.bazel b/pkg/obsservice/obspb/opentelemetry-proto/resource/v1/BUILD.bazel deleted file mode 100644 index 322be7f17953..000000000000 --- a/pkg/obsservice/obspb/opentelemetry-proto/resource/v1/BUILD.bazel +++ /dev/null @@ -1,27 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -proto_library( - name = "v1_proto", - srcs = ["resource.proto"], - strip_import_prefix = "/pkg", - visibility = ["//visibility:public"], - deps = ["//pkg/obsservice/obspb/opentelemetry-proto/common/v1:v1_proto"], -) - -go_proto_library( - name = "v1_go_proto", - compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/resource/v1", - proto = ":v1_proto", - visibility = ["//visibility:public"], - deps = ["//pkg/obsservice/obspb/opentelemetry-proto/common/v1:common"], -) - -go_library( - name = "resource", - embed = [":v1_go_proto"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/resource/v1", - visibility = ["//visibility:public"], -) diff --git a/pkg/obsservice/obspb/opentelemetry-proto/resource/v1/resource.proto b/pkg/obsservice/obspb/opentelemetry-proto/resource/v1/resource.proto deleted file mode 100644 index c3ce770ed2fc..000000000000 --- a/pkg/obsservice/obspb/opentelemetry-proto/resource/v1/resource.proto +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2019, OpenTelemetry Authors -// -// Licensed 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. - -syntax = "proto3"; - -package opentelemetry.proto.resource.v1; - -import "obsservice/obspb/opentelemetry-proto/common/v1/common.proto"; - -option csharp_namespace = "OpenTelemetry.Proto.Resource.V1"; -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.resource.v1"; -option java_outer_classname = "ResourceProto"; -option go_package = "v1"; - -// Resource information. -message Resource { - // Set of attributes that describe the resource. - // Attribute keys MUST be unique (it is not allowed to have more than one - // attribute with the same key). - repeated opentelemetry.proto.common.v1.KeyValue attributes = 1; - - // dropped_attributes_count is the number of dropped attributes. If the value is 0, then - // no attributes were dropped. - uint32 dropped_attributes_count = 2; -} diff --git a/pkg/obsservice/obspb/resource.go b/pkg/obsservice/obspb/resource.go deleted file mode 100644 index 3618a0ab7954..000000000000 --- a/pkg/obsservice/obspb/resource.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 The Cockroach Authors. -// -// Licensed 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 - -package obspb - -// Names of fields used for Resource.Attributes. -const ( - ClusterID string = "ClusterID" - // NodeID corresponds to either a roachpb.NodeID (for KV nodes) or a - // base.SQLInstanceID (for SQL tenants). - NodeID string = "NodeID" - NodeBinaryVersion string = "NodeBinaryVersion" - TenantID string = "TenantID" -) diff --git a/pkg/obsservice/obspb/update-opentelemetry-proto.sh b/pkg/obsservice/obspb/update-opentelemetry-proto.sh deleted file mode 100755 index 55b866bbb01b..000000000000 --- a/pkg/obsservice/obspb/update-opentelemetry-proto.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash - -# Copyright 2022 The Cockroach Authors. -# -# Use of this software is governed by the CockroachDB Software License -# included in the /LICENSE file. - - -# This script updates the .proto files under the opentelemetry-proto dir with -# upstream protos from https://github.com/open-telemetry/opentelemetry-proto. -# -# Use as -# cd pkg/obsservice/obspb -# ./update-opentelemetry-proto.sh [-k] [] -# -# We copy the protos that we need from opentelemetry-proto into our tree because -# vendoring the upstream repo proved too difficult (it's not `go get`-able, some -# of the protos in it don't build with gogoproto (*), and also we already vendor -# https://github.com/open-telemetry/opentelemetry-proto-go, which contains the -# protoc-compiled protos. This other repo clashes with the import path the -# opentelemetry-proto wants. -# -# (*) opentelemetry-collector also uses gogoproto, and has a complicated build -# pipeline for the protos. For example, they transform all "optional" fields -# into "oneof" using sed: -# https://github.com/open-telemetry/opentelemetry-collector/blob/feab9491538a882737a5bceb8757b4458a86edd3/proto_patch.sed - -set -euo pipefail - -if [[ ! $(pwd) == */obspb ]]; then - echo "$0 needs to be run from the obspb dir." - exit -fi - -keep="" -while getopts k flag -do - case "$flag" in - k) - keep=true - ;; - esac -done -shift $(($OPTIND - 1)) - -SHA="" -if [ $# -eq 1 ]; then - SHA=$1 - echo "No SHA supplied; will use latest from opentelemetry-proto." -fi - -WORK_DIR=`mktemp -d` - -# deletes the temp directory -function cleanup { - if [ ! "$keep" ] ; then - rm -rf "$WORK_DIR" - echo "Deleted temp working directory $WORK_DIR" - else - echo "-k specified; keeping temp dir $WORK_DIR" - fi -} -# register the cleanup function to be called on the EXIT signal -trap cleanup EXIT - -echo "Cloning opentelemetry-proto in $WORK_DIR." -git clone git@github.com:open-telemetry/opentelemetry-proto.git $WORK_DIR --quiet -if [[ ! -z $SHA ]]; then - echo "Checking out SHA: $SHA." - git -C $WORK_DIR checkout --quiet $SHA -fi - -BKDIR=`mktemp -d` -echo "Making a backup copy of opentelemetry-proto in $BKDIR." -cp -r opentelemetry-proto $BKDIR/ -DEST_DIR=opentelemetry-proto - -echo "Copying protos." -# Copy the protos from the repo. -rsync -avrq --include "*/" --include="common.proto" --include="resource.proto" --include="logs.proto" --include="logs_service.proto" --exclude="*" --prune-empty-dirs $WORK_DIR/opentelemetry/proto/* $DEST_DIR - -# Massage the protos so that they work in our tree. -echo "Editing protos." - -# Change lines like: -# option go_package = "go.opentelemetry.io/proto/otlp/common/v1"; -# into: -# option go_package = "v1"; -find $DEST_DIR -type f -name "*.proto" -exec sed -i.bak -e "s/option go_package = \"go.opentelemetry.io\/proto\/otlp\/.*\/v1\"/option go_package = \"v1\"/" {} + ; - -# Change lines like: -# import "obsservice/obspb/opentelemetry-proto/common/v1/common.proto"; -# into -# import "opentelemetry/proto/common/v1/common.proto"; -find $DEST_DIR -type f -name "*.proto" -exec sed -i.bak -e "s/import \"opentelemetry\/proto\/\(.*\)\/v1/import \"obsservice\/obspb\/opentelemetry-proto\/\1\/v1/" {} + ; - -# delete the .bak files created in previous steps -find . -name "*.bak" -type f -delete - -# Apply a final patch customizing the code generation (sprinkle some gogo.nullable=false). -git apply opentelemetry-proto.patch - -echo 'Done. Do not forget to run `./dev generate bazel` and `./dev generate protobuf`' diff --git a/pkg/server/BUILD.bazel b/pkg/server/BUILD.bazel index dea17db291a7..4bafa4203bf6 100644 --- a/pkg/server/BUILD.bazel +++ b/pkg/server/BUILD.bazel @@ -56,7 +56,6 @@ go_library( "server_controller_new_server.go", "server_controller_sql.go", "server_http.go", - "server_obs_service.go", "server_sql.go", "server_systemlog_gc.go", "session_writer.go", @@ -159,14 +158,6 @@ go_library( "//pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer", "//pkg/multitenant/tenantcapabilities/tenantcapabilitieswatcher", "//pkg/multitenant/tenantcostmodel", - "//pkg/obs", - "//pkg/obsservice/obslib", - "//pkg/obsservice/obslib/ingest", - "//pkg/obsservice/obslib/migrations", - "//pkg/obsservice/obslib/obsutil", - "//pkg/obsservice/obslib/router", - "//pkg/obsservice/obspb", - "//pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1:logs_service", "//pkg/raft", "//pkg/roachpb", "//pkg/rpc", @@ -366,7 +357,6 @@ go_library( "@com_github_gorilla_mux//:mux", "@com_github_grpc_ecosystem_grpc_gateway//runtime:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway//utilities:go_default_library", - "@com_github_jackc_pgx_v5//pgxpool", "@com_github_lib_pq//:pq", "@com_github_marusama_semaphore//:semaphore", "@com_github_nightlyone_lockfile//:lockfile", diff --git a/pkg/server/config.go b/pkg/server/config.go index 410ccea8ddc2..72b583a49065 100644 --- a/pkg/server/config.go +++ b/pkg/server/config.go @@ -264,11 +264,6 @@ type BaseConfig struct { // route SQL connections instead. DisableSQLListener bool - // ObsServiceAddr is the address of the OTLP sink to send events to, if any. - // These events are meant for the Observability Service, but they might pass - // through an OpenTelemetry Collector. - ObsServiceAddr string - // RPCListenerFactory provides an alternate implementation of // ListenAndUpdateAddrs for use when creating gPRC // listeners. This is set by in-memory tenants if the user has diff --git a/pkg/server/initial_sql.go b/pkg/server/initial_sql.go index f9786806f9ec..d8494d18e5ab 100644 --- a/pkg/server/initial_sql.go +++ b/pkg/server/initial_sql.go @@ -9,9 +9,7 @@ import ( "context" "fmt" - "github.com/cockroachdb/cockroach/pkg/base" "github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvstorage" - "github.com/cockroachdb/cockroach/pkg/obs" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" "github.com/cockroachdb/cockroach/pkg/util/log" @@ -28,16 +26,6 @@ import ( func (s *topLevelServer) RunInitialSQL( ctx context.Context, startSingleNode bool, adminUser, adminPassword string, ) error { - if s.cfg.ObsServiceAddr == base.ObsServiceEmbedFlagValue { - var knobs *obs.EventExporterTestingKnobs - if s.cfg.TestingKnobs.EventExporter != nil { - knobs = s.cfg.TestingKnobs.EventExporter.(*obs.EventExporterTestingKnobs) - } - if err := s.startEmbeddedObsService(ctx, knobs); err != nil { - return err - } - } - newCluster := s.InitialStart() && s.NodeID() == kvstorage.FirstNodeID if !newCluster || s.cfg.DisableSQLServer { // The initial SQL code only runs the first time the cluster is initialized. diff --git a/pkg/server/server.go b/pkg/server/server.go index c600dd392d13..9e12620b7ab4 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -20,7 +20,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/base" "github.com/cockroachdb/cockroach/pkg/blobs" "github.com/cockroachdb/cockroach/pkg/blobs/blobspb" - "github.com/cockroachdb/cockroach/pkg/build" "github.com/cockroachdb/cockroach/pkg/clusterversion" "github.com/cockroachdb/cockroach/pkg/gossip" "github.com/cockroachdb/cockroach/pkg/inspectz" @@ -63,7 +62,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities" "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer" "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities/tenantcapabilitieswatcher" - "github.com/cockroachdb/cockroach/pkg/obs" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/rpc" "github.com/cockroachdb/cockroach/pkg/rpc/nodedialer" @@ -181,9 +179,6 @@ type topLevelServer struct { // keyVisualizerServer implements `keyvispb.KeyVisualizerServer` keyVisualizerServer *KeyVisualizerServer - // The Observability Server, used by the Observability Service to subscribe to - // CRDB data. - eventsExporter obs.EventsExporterInterface recoveryServer *loqrecovery.Server raftTransport *kvserver.RaftTransport stopper *stop.Stopper @@ -1065,54 +1060,6 @@ func NewServer(cfg Config, stopper *stop.Stopper) (serverctl.ServerStartupInterf }) nodeRegistry.AddMetricStruct(kvProber.Metrics()) - flushInterval := 5 * time.Second - flushTriggerBytesSize := uint64(1 << 20) // 1MB - if cfg.TestingKnobs.EventExporter != nil { - knobs := cfg.TestingKnobs.EventExporter.(*obs.EventExporterTestingKnobs) - if knobs.FlushInterval != time.Duration(0) { - flushInterval = knobs.FlushInterval - } - if knobs.FlushTriggerByteSize != 0 { - flushTriggerBytesSize = knobs.FlushTriggerByteSize - } - } - - // Create the EventExporter, which will export events to the Obs Service. - // We'll start it later, once we know our node ID. - var eventsExporter obs.EventsExporterInterface - if cfg.ObsServiceAddr != "" { - if cfg.ObsServiceAddr == base.ObsServiceEmbedFlagValue { - ee := obs.NewEventsExporter( - "", // targetAddr - we'll configure a custom dialer connecting to the local node later - timeutil.DefaultTimeSource{}, - cfg.Tracer, - flushInterval, - flushTriggerBytesSize, - 10*1<<20, // maxBufferSizeBytes - 10MB - sqlMonitorAndMetrics.rootSQLMemoryMonitor, // memMonitor - this is not "SQL" usage, but we don't have another memory pool - ) - eventsExporter = ee - } else { - targetAddr, err := obs.ValidateOTLPTargetAddr(cfg.ObsServiceAddr) - if err != nil { - return nil, err - } - ee := obs.NewEventsExporter( - targetAddr, - timeutil.DefaultTimeSource{}, - cfg.Tracer, - flushInterval, - flushTriggerBytesSize, - 10*1<<20, // maxBufferSizeBytes - 10MB - sqlMonitorAndMetrics.rootSQLMemoryMonitor, // memMonitor - this is not "SQL" usage, but we don't have another memory pool - ) - log.Infof(ctx, "will export events over OTLP to: %s", cfg.ObsServiceAddr) - eventsExporter = ee - } - } else { - eventsExporter = &obs.NoopEventsExporter{} - } - // The settings cache writer is responsible for persisting the // cluster settings on KV nodes across restarts. settingsWriter := newSettingsCacheWriter(engines[0], stopper) @@ -1192,7 +1139,6 @@ func NewServer(cfg Config, stopper *stop.Stopper) (serverctl.ServerStartupInterf tenantUsageServer: tenantUsage, monitorAndMetrics: sqlMonitorAndMetrics, settingsStorage: settingsWriter, - eventsExporter: eventsExporter, admissionPacerFactory: gcoords.Elastic, rangeDescIteratorFactory: rangedesc.NewIteratorFactory(db), tenantCapabilitiesReader: sql.MakeSystemTenantOnly[tenantcapabilities.Reader](tenantCapabilitiesWatcher), @@ -1332,7 +1278,6 @@ func NewServer(cfg Config, stopper *stop.Stopper) (serverctl.ServerStartupInterf authentication: sAuth, tsDB: tsDB, tsServer: &sTS, - eventsExporter: eventsExporter, recoveryServer: recoveryServer, raftTransport: raftTransport, stopper: stopper, @@ -2140,18 +2085,6 @@ func (s *topLevelServer) PreStart(ctx context.Context) error { s.startDiagnostics(workersCtx) } - s.eventsExporter.SetNodeInfo(obs.NodeInfo{ - ClusterID: state.clusterID, - NodeID: int32(state.nodeID), - TenantID: 0, - BinaryVersion: build.BinaryVersion(), - }) - if s.cfg.ObsServiceAddr != base.ObsServiceEmbedFlagValue { - if err := s.eventsExporter.Start(ctx, s.stopper); err != nil { - return errors.Wrapf(err, "failed to start events exporter") - } - } - if storage.WorkloadCollectorEnabled { if err := s.debug.RegisterWorkloadCollector(s.node.stores); err != nil { return errors.Wrapf(err, "failed to register workload collector with debug server") diff --git a/pkg/server/server_obs_service.go b/pkg/server/server_obs_service.go deleted file mode 100644 index 0836a227398b..000000000000 --- a/pkg/server/server_obs_service.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2023 The Cockroach Authors. -// -// Use of this software is governed by the CockroachDB Software License -// included in the /LICENSE file. - -package server - -import ( - "context" - "net" - - "github.com/cockroachdb/cockroach/pkg/obs" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/ingest" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/migrations" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/obsutil" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/router" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - logspb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/collector/logs/v1" - "github.com/cockroachdb/cockroach/pkg/util/log" - "github.com/cockroachdb/cockroach/pkg/util/netutil" - "github.com/jackc/pgx/v5/pgxpool" - "google.golang.org/grpc" -) - -// TODO(abarganier): Nuke the embedded obsservice code. We no longer use this. -// startEmbeddedObsService creates the schema for the Observability Service (if -// it doesn't exist already), starts the internal RPC service for event -// ingestion and hooks up the event exporter to talk to the local service. -func (s *topLevelServer) startEmbeddedObsService( - ctx context.Context, knobs *obs.EventExporterTestingKnobs, -) error { - // Create the Obs Service schema. - loopbackConfig, err := pgxpool.ParseConfig("") - if err != nil { - return err - } - loopbackConfig.ConnConfig.User = "root" - loopbackConfig.ConnConfig.Database = "crdb_observability" - loopbackConfig.ConnConfig.DialFunc = func(ctx context.Context, network, addr string) (net.Conn, error) { - return s.loopbackPgL.Connect(ctx) - } - log.Infof(ctx, "running migrations for embedded Observability Service") - if err := migrations.RunDBMigrations(ctx, loopbackConfig.ConnConfig); err != nil { - return err - } - - // Create the internal ingester RPC server. - // TODO(abarganier): implement a more useful EventConsumer. - // TODO(abarganier): implement unified initialization for EventIngester. - var consumer obslib.EventConsumer - if knobs != nil && knobs.TestConsumer != nil { - consumer = knobs.TestConsumer - } else { - consumer = router.NewEventRouter(map[obspb.EventType]obslib.EventConsumer{ - obspb.EventlogEvent: &obsutil.StdOutConsumer{}, - }) - } - embeddedObsSvc := ingest.MakeEventIngester(ctx, consumer, nil) - // We'll use an RPC server serving on a "loopback" interface implemented with - // in-memory pipes. - grpcServer := grpc.NewServer() - logspb.RegisterLogsServiceServer(grpcServer, embeddedObsSvc) - rpcLoopbackL := netutil.NewLoopbackListener(ctx, s.stopper) - if err := s.stopper.RunAsyncTask( - ctx, "obssvc-loopback-quiesce", func(ctx context.Context) { - <-s.stopper.ShouldQuiesce() - grpcServer.Stop() - }, - ); err != nil { - return err - } - if err := s.stopper.RunAsyncTask( - ctx, "obssvc-listener", func(ctx context.Context) { - netutil.FatalIfUnexpected(grpcServer.Serve(rpcLoopbackL)) - }); err != nil { - return err - } - - // Now that the ingester is listening for RPCs, we can hook up the exporter to - // it and start the exporter. Note that in the non-embedded case, Start() has - // already been called. - s.eventsExporter.SetDialer(func(ctx context.Context, _ string) (net.Conn, error) { - conn, err := rpcLoopbackL.Connect(ctx) - return conn, err - }) - log.Infof(ctx, "starting event exporting talking to local event ingester") - if err := s.eventsExporter.Start(ctx, s.stopper); err != nil { - return err - } - return nil -} diff --git a/pkg/server/server_sql.go b/pkg/server/server_sql.go index 7aa108f2e1a6..93057f342bec 100644 --- a/pkg/server/server_sql.go +++ b/pkg/server/server_sql.go @@ -43,7 +43,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/multitenant" "github.com/cockroachdb/cockroach/pkg/multitenant/mtinfopb" "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities" - "github.com/cockroachdb/cockroach/pkg/obs" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/rpc" "github.com/cockroachdb/cockroach/pkg/rpc/nodedialer" @@ -395,9 +394,6 @@ type sqlServerArgs struct { // grpc is the RPC service. grpc *grpcServer - // eventsExporter communicates with the Observability Service. - eventsExporter obs.EventsExporterInterface - // externalStorageBuilder is the constructor for accesses to external // storage. externalStorageBuilder *externalStorageBuilder @@ -1052,7 +1048,6 @@ func newSQLServer(ctx context.Context, cfg sqlServerArgs) (*SQLServer, error) { RangeProber: rangeprober.NewRangeProber(cfg.db), DescIDGenerator: descidgen.NewGenerator(cfg.Settings, codec, cfg.db), RangeStatsFetcher: rangeStatsFetcher, - EventsExporter: cfg.eventsExporter, NodeDescs: cfg.nodeDescs, TenantCapabilitiesReader: cfg.tenantCapabilitiesReader, CidrLookup: cfg.BaseConfig.CidrLookup, diff --git a/pkg/server/tenant.go b/pkg/server/tenant.go index 21d11fad02af..72f75b143fe5 100644 --- a/pkg/server/tenant.go +++ b/pkg/server/tenant.go @@ -17,7 +17,6 @@ import ( "time" "github.com/cockroachdb/cockroach/pkg/base" - "github.com/cockroachdb/cockroach/pkg/build" "github.com/cockroachdb/cockroach/pkg/gossip" "github.com/cockroachdb/cockroach/pkg/inspectz" "github.com/cockroachdb/cockroach/pkg/jobs" @@ -39,7 +38,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities" "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer" "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcostmodel" - "github.com/cockroachdb/cockroach/pkg/obs" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/rpc" "github.com/cockroachdb/cockroach/pkg/rpc/nodedialer" @@ -116,9 +114,7 @@ type SQLServerWrapper struct { tenantStatus *statusServer drainServer *drainServer authentication authserver.Server - // eventsExporter exports data to the Observability Service. - eventsExporter obs.EventsExporterInterface - stopper *stop.Stopper + stopper *stop.Stopper debug *debug.Server @@ -520,7 +516,6 @@ func newTenantServer( tenantStatus: sStatus, drainServer: drainServer, authentication: sAuth, - eventsExporter: args.eventsExporter, stopper: args.stopper, debug: debugServer, @@ -884,15 +879,6 @@ func (s *SQLServerWrapper) PreStart(ctx context.Context) error { if instanceID == 0 { log.Fatalf(ctx, "expected SQLInstanceID to be initialized after preStart") } - s.eventsExporter.SetNodeInfo(obs.NodeInfo{ - ClusterID: clusterID, - TenantID: int64(s.rpcContext.TenantID.InternalValue), - NodeID: int32(instanceID), - BinaryVersion: build.BinaryVersion(), - }) - if err := s.eventsExporter.Start(ctx, s.stopper); err != nil { - return errors.Wrap(err, "failed to start the event exporter") - } // Add more context to the Sentry reporter. sentry.ConfigureScope(func(scope *sentry.Scope) { @@ -1327,30 +1313,6 @@ func makeTenantSQLServerArgs( remoteFlowRunnerAcc := monitorAndMetrics.rootSQLMemoryMonitor.MakeBoundAccount() remoteFlowRunner := flowinfra.NewRemoteFlowRunner(baseCfg.AmbientCtx, stopper, &remoteFlowRunnerAcc) - // Create the EventServer. It will be made operational later, after the - // cluster ID is known, with a Start() call. - var eventsExporter obs.EventsExporterInterface - if baseCfg.ObsServiceAddr != "" { - if baseCfg.ObsServiceAddr == base.ObsServiceEmbedFlagValue { - // TODO(andrei): Add support for this option for tenants - at least for - // shared-process tenants where the event exporting should be hooked up to - // the ingester running in the host process. - return sqlServerArgs{}, errors.New("--obsservice-addr=embed is not currently supported for tenants") - } - ee := obs.NewEventsExporter( - baseCfg.ObsServiceAddr, - timeutil.DefaultTimeSource{}, - baseCfg.Tracer, - 5*time.Second, // maxStaleness - 1<<20, // triggerSizeBytes - 1MB - 10*1<<20, // maxBufferSizeBytes - 10MB - monitorAndMetrics.rootSQLMemoryMonitor, // memMonitor - this is not "SQL" usage, but we don't have another memory pool - ) - eventsExporter = ee - } else { - eventsExporter = &obs.NoopEventsExporter{} - } - // TODO(irfansharif): hook up NewGrantCoordinatorSQL. var noopElasticCPUGrantCoord *admission.ElasticCPUGrantCoordinator = nil return sqlServerArgs{ @@ -1404,7 +1366,6 @@ func makeTenantSQLServerArgs( costController: costController, monitorAndMetrics: monitorAndMetrics, grpc: grpcServer, - eventsExporter: eventsExporter, externalStorageBuilder: esb, admissionPacerFactory: noopElasticCPUGrantCoord, rangeDescIteratorFactory: tenantConnect, diff --git a/pkg/server/testserver.go b/pkg/server/testserver.go index 76f0440e1d7f..627100833e63 100644 --- a/pkg/server/testserver.go +++ b/pkg/server/testserver.go @@ -301,8 +301,6 @@ func makeTestConfigFromParams(params base.TestServerArgs) Config { cfg.TestingKnobs.AdmissionControlOptions = &admission.Options{} } - cfg.ObsServiceAddr = params.ObsServiceAddr - return cfg } diff --git a/pkg/sql/BUILD.bazel b/pkg/sql/BUILD.bazel index eb2a1cd39912..987b9e455243 100644 --- a/pkg/sql/BUILD.bazel +++ b/pkg/sql/BUILD.bazel @@ -343,10 +343,6 @@ go_library( "//pkg/multitenant/multitenantcpu", "//pkg/multitenant/tenantcapabilities", "//pkg/multitenant/tenantcapabilities/tenantcapabilitiespb", - "//pkg/obs", - "//pkg/obsservice/obspb", - "//pkg/obsservice/obspb/opentelemetry-proto/common/v1:common", - "//pkg/obsservice/obspb/opentelemetry-proto/logs/v1:logs", "//pkg/repstream", "//pkg/repstream/streampb", "//pkg/roachpb", diff --git a/pkg/sql/event_log.go b/pkg/sql/event_log.go index 0f94a6b83f31..bca393a0ca71 100644 --- a/pkg/sql/event_log.go +++ b/pkg/sql/event_log.go @@ -15,9 +15,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/base" "github.com/cockroachdb/cockroach/pkg/jobs" "github.com/cockroachdb/cockroach/pkg/jobs/jobspb" - "github.com/cockroachdb/cockroach/pkg/obsservice/obspb" - v1 "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/common/v1" - otel_logs_pb "github.com/cockroachdb/cockroach/pkg/obsservice/obspb/opentelemetry-proto/logs/v1" "github.com/cockroachdb/cockroach/pkg/security/username" "github.com/cockroachdb/cockroach/pkg/settings" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" @@ -582,8 +579,7 @@ func insertEventRecords( syncWrites := execCfg.EventLogTestingKnobs != nil && execCfg.EventLogTestingKnobs.SyncWrites if txn != nil && syncWrites { // Yes, do it now. - query, args, otelEvents := prepareEventWrite(ctx, execCfg, entries) - txn.KV().AddCommitTrigger(func(ctx context.Context) { sendEventsToObsService(ctx, execCfg, otelEvents) }) + query, args := prepareEventWrite(ctx, execCfg, entries) return writeToSystemEventsTable(ctx, txn, len(entries), query, args) } // No: do them async. @@ -629,10 +625,7 @@ func asyncWriteToOtelAndSystemEventsTable( defer stopCancel() // Prepare the data to send. - query, args, otelEvents := prepareEventWrite(ctx, execCfg, entries) - - // Send to the Obs Service. - sendEventsToObsService(ctx, execCfg, otelEvents) + query, args := prepareEventWrite(ctx, execCfg, entries) // We use a retry loop in case there are transient // non-retriable errors on the cluster during the table write. @@ -665,17 +658,9 @@ func asyncWriteToOtelAndSystemEventsTable( } } -func sendEventsToObsService( - ctx context.Context, execCfg *ExecutorConfig, events []*otel_logs_pb.LogRecord, -) { - for i := range events { - execCfg.EventsExporter.SendEvent(ctx, obspb.EventlogEvent, events[i]) - } -} - func prepareEventWrite( ctx context.Context, execCfg *ExecutorConfig, entries []logpb.EventPayload, -) (query string, args []interface{}, events []*otel_logs_pb.LogRecord) { +) (query string, args []interface{}) { reportingID := execCfg.NodeInfo.NodeID.SQLInstanceID() const colsPerEvent = 4 // Note: we insert the value zero as targetID because sadly this @@ -688,7 +673,6 @@ INSERT INTO system.eventlog ( VALUES($1, $2, $3, $4, 0)` args = make([]interface{}, 0, len(entries)*colsPerEvent) - events = make([]*otel_logs_pb.LogRecord, len(entries)) sp := tracing.SpanFromContext(ctx) var traceID [16]byte var spanID [8]byte @@ -701,7 +685,6 @@ VALUES($1, $2, $3, $4, 0)` binary.BigEndian.PutUint64(traceID[:], uint64(sp.TraceID())) binary.BigEndian.PutUint64(spanID[:], uint64(sp.SpanID())) } - nowNanos := timeutil.Now().UnixNano() for i := 0; i < len(entries); i++ { event := entries[i] @@ -719,17 +702,6 @@ VALUES($1, $2, $3, $4, 0)` reportingID, string(infoBytes), ) - - events[i] = &otel_logs_pb.LogRecord{ - TimeUnixNano: uint64(nowNanos), - Body: &v1.AnyValue{Value: &v1.AnyValue_StringValue{StringValue: args[len(args)-1].(string)}}, - Attributes: []*v1.KeyValue{{ - Key: obspb.EventlogEventTypeAttribute, - Value: &v1.AnyValue{Value: &v1.AnyValue_StringValue{StringValue: eventType}}, - }}, - TraceId: traceID[:], - SpanId: spanID[:], - } } // In the common case where we have just 1 event, we want to skeep @@ -750,7 +722,7 @@ VALUES($1, $2, $3, $4, 0)` query = completeQuery.String() } - return query, args, events + return query, args } func writeToSystemEventsTable( diff --git a/pkg/sql/exec_util.go b/pkg/sql/exec_util.go index 57d60be42568..4da7ca02cb85 100644 --- a/pkg/sql/exec_util.go +++ b/pkg/sql/exec_util.go @@ -45,7 +45,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/kv/kvserver/protectedts" "github.com/cockroachdb/cockroach/pkg/multitenant" "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities" - "github.com/cockroachdb/cockroach/pkg/obs" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/rpc" "github.com/cockroachdb/cockroach/pkg/security/username" @@ -1454,9 +1453,6 @@ type ExecutorConfig struct { // RangeStatsFetcher is used to fetch RangeStats. RangeStatsFetcher eval.RangeStatsFetcher - // EventsExporter is the client for the Observability Service. - EventsExporter obs.EventsExporterInterface - // NodeDescs stores {Store,Node}Descriptors in an in-memory cache. NodeDescs kvclient.NodeDescStore diff --git a/pkg/testutils/lint/lint_test.go b/pkg/testutils/lint/lint_test.go index cb0c235326d7..21399c949a4d 100644 --- a/pkg/testutils/lint/lint_test.go +++ b/pkg/testutils/lint/lint_test.go @@ -299,9 +299,6 @@ func TestLint(t *testing.T) { stream.GrepNot(`/embedded.go`), stream.GrepNot(`geo/geographiclib/geodesic\.c$`), stream.GrepNot(`geo/geographiclib/geodesic\.h$`), - // The opentelemetry-proto files are copied from otel with their own - // license. - stream.GrepNot(`opentelemetry-proto/.*.proto$`), // These files are copied from bazel upstream with its own license. stream.GrepNot(`build/bazel/bes/.*.proto$`), // These files are copied from raft upstream with its own license. @@ -322,16 +319,8 @@ func TestLint(t *testing.T) { } data = data[0:n] - isApache := strings.HasPrefix(filename, "pkg/obsservice") - switch { - case isApache: - if apacheHeader.Find(data) == nil { - t.Errorf("did not find expected Apache license header in %s", filename) - } - default: - if cslHeader.Find(data) == nil { - t.Errorf("did not find expected CSL license header in %s", filename) - } + if cslHeader.Find(data) == nil { + t.Errorf("did not find expected CSL license header in %s", filename) } }); err != nil { t.Fatal(err) @@ -1242,8 +1231,6 @@ func TestLint(t *testing.T) { ":!ccl/sqlproxyccl/tenantdirsvr/test_directory_svr.go", ":!ccl/sqlproxyccl/tenantdirsvr/test_simple_directory_svr.go", ":!ccl/sqlproxyccl/tenantdirsvr/test_static_directory_svr.go", - ":!obsservice/cmd/obsservice/main.go", - ":!obsservice/obslib/ingest/ingest_test.go", ":!cmd/bazci/*.go", ) if err != nil { diff --git a/pkg/ui/workspaces/cluster-ui/src/api/sqlApi.ts b/pkg/ui/workspaces/cluster-ui/src/api/sqlApi.ts index f91733bcab5f..8a6c01294e15 100644 --- a/pkg/ui/workspaces/cluster-ui/src/api/sqlApi.ts +++ b/pkg/ui/workspaces/cluster-ui/src/api/sqlApi.ts @@ -212,7 +212,6 @@ export function sqlApiErrorMessage(message: string): string { export function createSqlExecutionRequest( dbName: string, statements: SqlStatement[], - useObsService?: boolean, ): SqlExecutionRequest { return { execute: true, @@ -220,7 +219,6 @@ export function createSqlExecutionRequest( database: dbName, max_result_size: LARGE_RESULT_SIZE, timeout: LONG_TIMEOUT, - use_obs_service: useObsService || false, }; }