From 06b3ab87f7e1b982d3fb42a3e06897a2fd1387ed Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 5 Aug 2023 17:19:03 -0400 Subject: [PATCH] feat: add newrelic support --- config/config.go | 3 +++ go.mod | 5 +++++ go.sum | 6 ++++++ main.go | 1 + 4 files changed, 15 insertions(+) diff --git a/config/config.go b/config/config.go index 5e18cc7..fb35645 100644 --- a/config/config.go +++ b/config/config.go @@ -35,6 +35,9 @@ func Init() { pflag.String("database.name", "lumeweb_portal", "Database name") pflag.String("database.path", "./db.sqlite", "Database path for SQLite") pflag.String("renterd-api-password", ".", "admin password for renterd") + pflag.String("newrelic.appname", "", "") + pflag.String("newrelic.license", "", "") + pflag.Bool("debug", false, "enable debug mode") pflag.Parse() diff --git a/go.mod b/go.mod index ea5f48f..e13b342 100644 --- a/go.mod +++ b/go.mod @@ -8,10 +8,12 @@ require ( github.com/golang-queue/queue v0.1.3 github.com/huandu/go-clone v1.6.0 github.com/imdario/mergo v0.3.16 + github.com/iris-contrib/middleware/newrelic v0.0.0-20230716223316-058c9deb31e2 github.com/iris-contrib/swagger v0.0.0-20230531125653-f4ee631290a7 github.com/kataras/iris/v12 v12.2.0 github.com/kataras/jwt v0.1.8 github.com/multiformats/go-multibase v0.2.0 + github.com/newrelic/go-agent/v3 v3.24.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.16.0 github.com/swaggo/swag v1.16.1 @@ -50,6 +52,7 @@ require ( github.com/gobwas/pool v0.2.1 // indirect github.com/gobwas/ws v1.2.1 // indirect github.com/goccy/go-json v0.10.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/css v1.0.0 // indirect @@ -105,6 +108,8 @@ require ( golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.10.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/grpc v1.55.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 6e037b7..1d17b0a 100644 --- a/go.sum +++ b/go.sum @@ -911,6 +911,8 @@ github.com/imkira/go-interpol v1.1.0 h1:KIiKr0VSG2CUW1hl1jpiyuzuJeKUUpC8iM1AIE7N github.com/iris-contrib/go.uuid v2.0.0+incompatible h1:XZubAYg61/JwnJNbZilGjf3b3pB80+OQg2qf6c8BfWE= github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= github.com/iris-contrib/httpexpect/v2 v2.12.1 h1:3cTZSyBBen/kfjCtgNFoUKi1u0FVXNaAjyRJOo6AVS4= +github.com/iris-contrib/middleware/newrelic v0.0.0-20230716223316-058c9deb31e2 h1:tUy+5WmBbtcVOgszgRvF+PLsKUy0Tv2ah00liWZN9MM= +github.com/iris-contrib/middleware/newrelic v0.0.0-20230716223316-058c9deb31e2/go.mod h1:bS+VKQ8pf+F+xOw2OkwRUHRlpU9lDWWcpmaIv7cKc3k= github.com/iris-contrib/schema v0.0.6 h1:CPSBLyx2e91H2yJzPuhGuifVRnZBBJ3pCOMbOvPZaTw= github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA= github.com/iris-contrib/swagger v0.0.0-20230531125653-f4ee631290a7 h1:rswjJ8BLLtIN94KQ/V7w1c1ZkwvJ16uKSHqrBtx3H0k= @@ -1028,6 +1030,8 @@ github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5s github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= +github.com/newrelic/go-agent/v3 v3.24.0 h1:DPfbd+p0akRjv6UpWzWJl+pfOMSs+QkAeNRUp0fPLZI= +github.com/newrelic/go-agent/v3 v3.24.0/go.mod h1:7GnP0o5ZwEsnC001iDSoZRJ63jS6AtoAOggpg5XVJh8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= @@ -1795,6 +1799,7 @@ google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cba google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234015-3fc162c6f38a/go.mod h1:xURIpW9ES5+/GZhnV6beoEtxQrnkRGIfP5VQG2tCBLc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1835,6 +1840,7 @@ google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsA google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/main.go b/main.go index ea2831b..2b6d22f 100644 --- a/main.go +++ b/main.go @@ -21,6 +21,7 @@ import ( irisContext "github.com/kataras/iris/v12/context" "github.com/kataras/iris/v12/middleware/cors" "github.com/kataras/iris/v12/mvc" + "github.com/newrelic/go-agent/v3/newrelic" "github.com/spf13/viper" "go.uber.org/zap" "log"