diff --git a/src/auth-service/go.mod b/src/auth-service/go.mod index 2fe8ebd..0b77433 100644 --- a/src/auth-service/go.mod +++ b/src/auth-service/go.mod @@ -1,6 +1,6 @@ module auth-service -go 1.21 +go 1.23.0 require ( github.com/gin-gonic/gin v1.10.1 @@ -9,9 +9,10 @@ require ( ) require ( + github.com/beorn7/perks v1.0.1 // indirect github.com/bytedance/sonic v1.11.6 // indirect github.com/bytedance/sonic/loader v0.1.1 // indirect - github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect @@ -26,14 +27,20 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/prometheus/client_golang v1.23.2 // indirect + github.com/prometheus/client_model v0.6.2 // indirect + github.com/prometheus/common v0.66.1 // indirect + github.com/prometheus/procfs v0.16.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect golang.org/x/arch v0.8.0 // indirect - golang.org/x/crypto v0.23.0 // indirect - golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - google.golang.org/protobuf v1.34.1 // indirect + golang.org/x/crypto v0.41.0 // indirect + golang.org/x/net v0.43.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.28.0 // indirect + google.golang.org/protobuf v1.36.8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/src/auth-service/go.sum b/src/auth-service/go.sum index efadc06..c2446d6 100644 --- a/src/auth-service/go.sum +++ b/src/auth-service/go.sum @@ -1,52 +1,50 @@ -github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= -github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ= github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= -github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -54,10 +52,20 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= +github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= +github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= +github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= +github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -67,39 +75,43 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= +google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/src/auth-service/main.go b/src/auth-service/main.go index 32bbde2..43096ee 100644 --- a/src/auth-service/main.go +++ b/src/auth-service/main.go @@ -2,12 +2,14 @@ package main import ( "auth-service/handlers" + "auth-service/metrics" "auth-service/middleware" "log" "os" "github.com/gin-gonic/gin" "github.com/joho/godotenv" + "github.com/prometheus/client_golang/prometheus/promhttp" ) func main() { @@ -24,9 +26,19 @@ func main() { // Initialize router router := gin.Default() + // Initialize Prometheus metrics (MUST be before middleware usage) + metrics.Init() + + // Prometheus metrics middleware (counts all requests) + router.Use(middleware.MetricsMiddleware()) + // Add CORS middleware router.Use(middleware.CORSMiddleware()) + // 🔍 Register Prometheus metrics endpoint (NO auth) + log.Println("Registering /metrics endpoint") + router.GET("/metrics", gin.WrapH(promhttp.Handler())) + // Health check endpoint router.GET("/api/auth/health", handlers.HealthCheck) @@ -51,6 +63,7 @@ func main() { log.Fatal("AUTH_SERVICE_PORT not set in environment") os.Exit(0) } + log.Printf("Auth Service starting on port %s", port) if err := router.Run(":" + port); err != nil { log.Fatal("Failed to start server:", err) diff --git a/src/auth-service/metrics/metrics.go b/src/auth-service/metrics/metrics.go new file mode 100644 index 0000000..8515dcf --- /dev/null +++ b/src/auth-service/metrics/metrics.go @@ -0,0 +1,17 @@ +package metrics + +import "github.com/prometheus/client_golang/prometheus" + +var ( + HttpRequestsTotal = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "auth_http_requests_total", + Help: "Total HTTP requests received by auth service", + }, + []string{"method", "path", "status"}, + ) +) + +func Init() { + prometheus.MustRegister(HttpRequestsTotal) +} diff --git a/src/auth-service/middleware/metrics.go b/src/auth-service/middleware/metrics.go new file mode 100644 index 0000000..24cf043 --- /dev/null +++ b/src/auth-service/middleware/metrics.go @@ -0,0 +1,21 @@ +package middleware + +import ( + "fmt" + + "auth-service/metrics" + + "github.com/gin-gonic/gin" +) + +func MetricsMiddleware() gin.HandlerFunc { + return func(c *gin.Context) { + c.Next() + + metrics.HttpRequestsTotal.WithLabelValues( + c.Request.Method, + c.FullPath(), + fmt.Sprintf("%d", c.Writer.Status()), + ).Inc() + } +} diff --git a/src/login-service/pom.xml b/src/login-service/pom.xml index ccefae7..78817df 100644 --- a/src/login-service/pom.xml +++ b/src/login-service/pom.xml @@ -45,18 +45,32 @@ spring-boot-starter-validation + org.springframework.boot spring-boot-starter-actuator - + + + io.micrometer + micrometer-registry-prometheus + + + com.mysql mysql-connector-j runtime + + + com.h2database + h2 + runtime + + io.jsonwebtoken diff --git a/src/metadata-service/app.py b/src/metadata-service/app.py index 442ded8..e79716b 100644 --- a/src/metadata-service/app.py +++ b/src/metadata-service/app.py @@ -12,6 +12,9 @@ from utils.logger import setup_logger from config.settings import Config +# 🔹 Prometheus imports +from prometheus_client import Counter, Histogram, generate_latest, CONTENT_TYPE_LATEST + app = Flask(__name__) CORS(app) @@ -23,6 +26,45 @@ stress_service = StressService() env_detector = EnvironmentDetector() +# 🔹 Prometheus metrics +http_requests_total = Counter( + "metadata_http_requests_total", + "Total HTTP requests for metadata service", + ["method", "path", "status"] +) + +http_request_duration_seconds = Histogram( + "metadata_http_request_duration_seconds", + "HTTP request latency for metadata service", + ["method", "path"] +) + +@app.before_request +def before_request(): + request.start_time = time.time() + +@app.after_request +def after_request(response): + try: + duration = time.time() - request.start_time + http_requests_total.labels( + method=request.method, + path=request.path, + status=response.status_code + ).inc() + http_request_duration_seconds.labels( + method=request.method, + path=request.path + ).observe(duration) + except Exception: + pass + return response + +# 🔹 Prometheus metrics endpoint +@app.route('/metrics', methods=['GET']) +def metrics(): + return generate_latest(), 200, {"Content-Type": CONTENT_TYPE_LATEST} + # Global stress test state stress_state = { 'active': False, @@ -33,7 +75,6 @@ @app.route('/api/metadata/health', methods=['GET']) def health_check(): - """Health check endpoint""" try: system_info = metadata_service.get_system_info() return jsonify({ @@ -48,141 +89,111 @@ def health_check(): }), 200 except Exception as e: logger.error(f"Health check failed: {str(e)}") - return jsonify({ - 'status': 'DOWN', - 'error': str(e) - }), 500 + return jsonify({'status': 'DOWN', 'error': str(e)}), 500 @app.route('/api/metadata/instance', methods=['GET']) def get_instance_metadata(): - """Get instance/node metadata""" try: logger.info("Fetching instance metadata") metadata = metadata_service.get_instance_metadata() - return jsonify({ 'success': True, 'data': metadata, 'timestamp': datetime.utcnow().isoformat() + 'Z' }), 200 - except Exception as e: logger.error(f"Error fetching instance metadata: {str(e)}") return jsonify({ 'success': False, 'error': str(e), 'data': metadata_service.get_dummy_metadata() - }), 200 # Return 200 with dummy data + }), 200 @app.route('/api/metadata/deployment', methods=['GET']) def get_deployment_info(): - """Get deployment information""" try: logger.info("Fetching deployment information") deployment_info = metadata_service.get_deployment_info() - return jsonify({ 'success': True, 'data': deployment_info, 'timestamp': datetime.utcnow().isoformat() + 'Z' }), 200 - except Exception as e: logger.error(f"Error fetching deployment info: {str(e)}") return jsonify({ 'success': False, 'error': str(e), 'data': metadata_service.get_dummy_deployment_info() - }), 200 # Return 200 with dummy data + }), 200 @app.route('/api/metadata/network', methods=['GET']) def get_network_info(): - """Get network information""" try: logger.info("Fetching network information") network_info = metadata_service.get_network_info() - return jsonify({ 'success': True, 'data': network_info, 'timestamp': datetime.utcnow().isoformat() + 'Z' }), 200 - except Exception as e: logger.error(f"Error fetching network info: {str(e)}") - return jsonify({ - 'success': False, - 'error': str(e) - }), 500 + return jsonify({'success': False, 'error': str(e)}), 500 @app.route('/api/stress/start', methods=['POST']) def start_stress_test(): - """Start stress test""" try: global stress_state data = request.get_json() - duration = data.get('duration', 300) # Default 5 minutes - stress_type = data.get('type', 'cpu') # cpu, memory, or mixed - + duration = data.get('duration', 300) + stress_type = data.get('type', 'cpu') + if stress_state['active']: - return jsonify({ - 'success': False, - 'message': 'Stress test already running' - }), 400 - + return jsonify({'success': False, 'message': 'Stress test already running'}), 400 + logger.info(f"Starting {stress_type} stress test for {duration} seconds") - - # Start stress test in background thread + def run_stress(): + global stress_state stress_state = { 'active': True, 'start_time': datetime.utcnow(), 'duration': duration, 'type': stress_type } - stress_service.start_stress(stress_type, duration) - stress_state = { 'active': False, 'start_time': None, 'duration': 0, 'type': None } - - thread = threading.Thread(target=run_stress) - thread.daemon = True + + thread = threading.Thread(target=run_stress, daemon=True) thread.start() - + return jsonify({ 'success': True, 'message': f'{stress_type.title()} stress test started', 'duration_seconds': duration, 'stress_type': stress_type }), 200 - except Exception as e: logger.error(f"Error starting stress test: {str(e)}") - return jsonify({ - 'success': False, - 'error': str(e) - }), 500 + return jsonify({'success': False, 'error': str(e)}), 500 @app.route('/api/stress/status', methods=['GET']) def get_stress_status(): - """Get current stress test status""" try: current_metrics = stress_service.get_current_metrics() - stress_info = { 'active': stress_state['active'], 'metrics': current_metrics } - if stress_state['active']: elapsed = (datetime.utcnow() - stress_state['start_time']).total_seconds() remaining = max(0, stress_state['duration'] - elapsed) - stress_info.update({ 'start_time': stress_state['start_time'].isoformat() + 'Z', 'duration': stress_state['duration'], @@ -190,74 +201,43 @@ def get_stress_status(): 'remaining_seconds': int(remaining), 'type': stress_state['type'] }) - - return jsonify({ - 'success': True, - 'data': stress_info - }), 200 - + return jsonify({'success': True, 'data': stress_info}), 200 except Exception as e: logger.error(f"Error getting stress status: {str(e)}") - return jsonify({ - 'success': False, - 'error': str(e) - }), 500 + return jsonify({'success': False, 'error': str(e)}), 500 @app.route('/api/stress/stop', methods=['POST']) def stop_stress_test(): - """Stop current stress test""" global stress_state try: if not stress_state['active']: - return jsonify({ - 'success': False, - 'message': 'No active stress test to stop' - }), 400 - + return jsonify({'success': False, 'message': 'No active stress test to stop'}), 400 + stress_service.stop_stress() - stress_state = { 'active': False, 'start_time': None, 'duration': 0, 'type': None } - logger.info("Stress test stopped manually") - - return jsonify({ - 'success': True, - 'message': 'Stress test stopped' - }), 200 - + return jsonify({'success': True, 'message': 'Stress test stopped'}), 200 except Exception as e: logger.error(f"Error stopping stress test: {str(e)}") - return jsonify({ - 'success': False, - 'error': str(e) - }), 500 + return jsonify({'success': False, 'error': str(e)}), 500 @app.errorhandler(404) def not_found(error): - return jsonify({ - 'success': False, - 'error': 'Endpoint not found', - 'path': request.path - }), 404 + return jsonify({'success': False, 'error': 'Endpoint not found', 'path': request.path}), 404 @app.errorhandler(500) def internal_error(error): logger.error(f"Internal server error: {str(error)}") - return jsonify({ - 'success': False, - 'error': 'Internal server error' - }), 500 + return jsonify({'success': False, 'error': 'Internal server error'}), 500 if __name__ == '__main__': - port = int(os.environ.get('METADATA_SERVICE_PORT')) + port = int(os.environ.get('METADATA_SERVICE_PORT', 8084)) debug = os.environ.get('FLASK_ENV') == 'development' - logger.info("Running on port %d", port) logger.info(f"Starting Metadata Service on port {port}") logger.info(f"Environment: {env_detector.detect_environment()}") - - app.run(host='0.0.0.0', port=port, debug=debug) \ No newline at end of file + app.run(host='0.0.0.0', port=port, debug=debug) diff --git a/src/metadata-service/requirements.txt b/src/metadata-service/requirements.txt index c0d589c..bc6eb33 100644 --- a/src/metadata-service/requirements.txt +++ b/src/metadata-service/requirements.txt @@ -5,4 +5,5 @@ kubernetes==28.1.0 psutil==5.9.6 requests==2.31.0 python-dotenv==1.0.0 -gunicorn==21.2.0 \ No newline at end of file +gunicorn==21.2.0 +prometheus-client diff --git a/src/notification-service/app.js b/src/notification-service/app.js index b5f223f..19fec39 100644 --- a/src/notification-service/app.js +++ b/src/notification-service/app.js @@ -13,12 +13,48 @@ const notificationRoutes = require('./routes/notifications'); const healthRoutes = require('./routes/health'); const errorHandler = require('./middleware/errorHandler'); +/* ========================= + 🔥 PROMETHEUS SETUP +========================= */ +const client = require('prom-client'); + +// Create registry +const register = new client.Registry(); + +// Collect default Node.js metrics +client.collectDefaultMetrics({ register }); + +// Custom HTTP request counter +const httpRequestsTotal = new client.Counter({ + name: 'notification_http_requests_total', + help: 'Total HTTP requests to notification service', + labelNames: ['method', 'route', 'status'] +}); + +register.registerMetric(httpRequestsTotal); +/* ========================= */ + const app = express(); app.use((req, res, next) => { - res.setHeader('Origin-Agent-Cluster', '?1'); // Enable origin-keying + res.setHeader('Origin-Agent-Cluster', '?1'); + next(); +}); + +/* ========================= + 📊 METRICS MIDDLEWARE +========================= */ +app.use((req, res, next) => { + res.on('finish', () => { + httpRequestsTotal.labels( + req.method, + req.route?.path || req.path, + res.statusCode + ).inc(); + }); next(); }); +/* ========================= */ // Security middleware app.use(helmet()); @@ -29,8 +65,8 @@ app.use(cors({ // Rate limiting const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100, // limit each IP to 100 requests per windowMs + windowMs: 15 * 60 * 1000, + max: 100, message: 'Too many requests from this IP, please try again later.' }); app.use(limiter); @@ -41,29 +77,40 @@ app.use(express.json({ limit: '10mb' })); app.use(express.urlencoded({ extended: true, limit: '10mb' })); // Logging middleware -app.use(morgan('combined', { +app.use(morgan('combined', { stream: { write: message => logger.info(message.trim()) } })); async function initializeDatabase() { - try { - await sequelize.authenticate(); - console.log('📊 Database connected successfully'); - - // Create tables if they don't exist - await sequelize.sync(); - console.log('📋 Database tables synchronized'); - - } catch (error) { - console.error('❌ Database connection failed:', error); - process.exit(1); - } + try { + await sequelize.authenticate(); + console.log('📊 Database connected successfully'); + + await sequelize.sync(); + console.log('📋 Database tables synchronized'); + } catch (error) { + console.error('❌ Database connection failed:', error); + process.exit(1); + } } +/* ========================= + 📈 METRICS ENDPOINT +========================= */ +app.get('/metrics', async (req, res) => { + try { + res.set('Content-Type', register.contentType); + res.end(await register.metrics()); + } catch (err) { + res.status(500).end(err.message); + } +}); +/* ========================= */ + // Routes app.use('/api/notifications', notificationRoutes); app.use('/api/notifications', healthRoutes); -app.use('/actuator', healthRoutes); // Spring Boot compatibility +app.use('/actuator', healthRoutes); // 404 handler app.use('*', (req, res) => { @@ -90,13 +137,12 @@ process.on('SIGINT', () => { const PORT = process.env.NOTIFICATION_SERVICE_PORT; - initializeDatabase().then(() => { - app.listen(PORT, () => { - logger.info(`🚀 Notification Service started on port ${PORT}`); - logger.info(`📧 Email service configured: ${process.env.MAIL_HOST || 'Not configured'}`); - logger.info(`🌍 Environment: ${process.env.NODE_ENV || 'development'}`); - }); + app.listen(PORT, () => { + logger.info(`🚀 Notification Service started on port ${PORT}`); + logger.info(`📧 Email service configured: ${process.env.MAIL_HOST || 'Not configured'}`); + logger.info(`🌍 Environment: ${process.env.NODE_ENV || 'development'}`); + }); }); -module.exports = app; \ No newline at end of file +module.exports = app; diff --git a/src/notification-service/package-lock.json b/src/notification-service/package-lock.json index 2fcd407..69ff1fa 100644 --- a/src/notification-service/package-lock.json +++ b/src/notification-service/package-lock.json @@ -19,6 +19,7 @@ "morgan": "^1.10.0", "mysql2": "^3.6.5", "nodemailer": "^6.9.7", + "prom-client": "^15.1.3", "sequelize": "^6.35.1", "uuid": "^9.0.1", "winston": "^3.11.0" @@ -80,6 +81,7 @@ "integrity": "sha512-yDBHV9kQNcr2/sUr9jghVyz9C3Y5G2zUM2H2lo+9mKv4sFgbA8s8Z9t8D1jiTkGoO/NoIfKMyKWr4s6CN23ZwQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.27.1", @@ -1280,6 +1282,15 @@ "node": ">= 8" } }, + "node_modules/@opentelemetry/api": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", + "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", + "license": "Apache-2.0", + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@paralleldrive/cuid2": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/@paralleldrive/cuid2/-/cuid2-2.2.2.tgz", @@ -1515,6 +1526,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1814,6 +1826,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "license": "MIT" + }, "node_modules/body-parser": { "version": "1.20.3", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", @@ -1882,6 +1900,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001737", "electron-to-chromium": "^1.5.211", @@ -2631,6 +2650,7 @@ "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", @@ -2878,6 +2898,7 @@ "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "license": "MIT", + "peer": true, "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", @@ -5390,6 +5411,19 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/prom-client": { + "version": "15.1.3", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.3.tgz", + "integrity": "sha512-6ZiOBfCywsD4k1BN9IX0uZhF+tJkV8q8llP64G5Hajs4JOeVLPCwpPVcpXy3BwYiUGgyJzsJJQeOIv7+hDSq8g==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + }, + "engines": { + "node": "^16 || ^18 || >=20" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -6339,6 +6373,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "license": "MIT", + "dependencies": { + "bintrees": "1.0.2" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", diff --git a/src/notification-service/package.json b/src/notification-service/package.json index faab921..c462be0 100644 --- a/src/notification-service/package.json +++ b/src/notification-service/package.json @@ -29,6 +29,7 @@ "morgan": "^1.10.0", "mysql2": "^3.6.5", "nodemailer": "^6.9.7", + "prom-client": "^15.1.3", "sequelize": "^6.35.1", "uuid": "^9.0.1", "winston": "^3.11.0"