Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Missing Connection Successful Logs #1206

Open
wants to merge 32 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c66c110
added missing connection logs
coolwednesday Nov 15, 2024
6b4db8b
Merge branch 'gofr-dev:development' into missing-logs
coolwednesday Nov 15, 2024
ad0d1e1
modifying logs
coolwednesday Nov 15, 2024
e8af568
adding mocks previously removed from build
coolwednesday Nov 15, 2024
a11736e
add kafka metrics mocks in build
coolwednesday Nov 15, 2024
65e3ac9
remove build exclude from file mocks
coolwednesday Nov 17, 2024
4dd2c12
Merge branch 'development' into missing-logs
coolwednesday Nov 17, 2024
bb023e9
Merge branch 'development' into missing-logs
Umang01-hash Nov 18, 2024
7fa66ec
temp
coolwednesday Nov 18, 2024
fe8d419
implementing review suggestions
coolwednesday Nov 18, 2024
eef56e2
corrected incorrect spacing in comments
coolwednesday Nov 18, 2024
5b21715
Bump google.golang.org/protobuf from 1.35.1 to 1.35.2 (#1216)
dependabot[bot] Nov 19, 2024
f16d428
Bump go.opentelemetry.io/otel/sdk from 1.31.0 to 1.32.0 (#1224)
dependabot[bot] Nov 19, 2024
98a2d56
Bump golang.org/x/text from 0.19.0 to 0.20.0 (#1219)
dependabot[bot] Nov 19, 2024
eafd85e
Bump modernc.org/sqlite from 1.33.1 to 1.34.1 (#1221)
dependabot[bot] Nov 19, 2024
1782fc4
Bump go.opentelemetry.io/otel/exporters/zipkin from 1.31.0 to 1.32.0 …
dependabot[bot] Nov 19, 2024
79189e1
Bump google.golang.org/api from 0.204.0 to 0.206.0 (#1217)
dependabot[bot] Nov 19, 2024
94715b0
Bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc …
dependabot[bot] Nov 19, 2024
1bf0da0
Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (#…
dependabot[bot] Nov 19, 2024
9eace35
shifting all status: connecting logs to debug
coolwednesday Nov 20, 2024
17daaeb
removed go.mod from examples
coolwednesday Nov 20, 2024
dc4ad24
shifting all status: connecting logs to debug
coolwednesday Nov 20, 2024
eac6f69
reverting mock files and other changes
coolwednesday Nov 20, 2024
8887454
Merge branch 'development' into missing-logs
coolwednesday Nov 20, 2024
c0b027e
minor changes
coolwednesday Nov 20, 2024
e659050
minor changes
coolwednesday Nov 20, 2024
09e9299
update go.mod of ftp/s3/sftp
coolwednesday Nov 20, 2024
35bbc72
removing exclude build commands for future addition of external datas…
coolwednesday Nov 21, 2024
1e6fc6b
revert deleted go.mod in examples
coolwednesday Nov 21, 2024
4c18d9d
add debugf in interface wherever needed
coolwednesday Nov 21, 2024
2c8ac55
removed repeating logs in NATS: resolving review comment
coolwednesday Nov 21, 2024
88ad0e2
added missed return statements
coolwednesday Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/gofr/datasource/cassandra/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ func New(conf Config) *Client {

// Connect establishes a connection to Cassandra and registers metrics using the provided configuration when the client was Created.
func (c *Client) Connect() {
c.logger.Logf("connecting to cassandra at %v on port %v to keyspace %v", c.config.Hosts, c.config.Port, c.config.Keyspace)
c.logger.Debugf("connecting to Cassandra at %v on port %v to keyspace %v", c.config.Hosts, c.config.Port, c.config.Keyspace)

sess, err := c.cassandra.clusterConfig.createSession()
if err != nil {
c.logger.Error("error connecting to cassandra: ", err)
c.logger.Error("error connecting to Cassandra: ", err)

return
}
Expand Down
8 changes: 3 additions & 5 deletions pkg/gofr/datasource/cassandra/cassandra_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build exclude

package cassandra

import (
Expand Down Expand Up @@ -82,7 +80,7 @@ func Test_Connect(t *testing.T) {

cassandraBuckets := []float64{.05, .075, .1, .125, .15, .2, .3, .5, .75, 1, 2, 3, 4, 5, 7.5, 10}

mockLogger.EXPECT().Logf("connecting to cassandra at %v on port %v to keyspace %v", "host1", 9042, "test_keyspace")
mockLogger.EXPECT().Debugf("connecting to Cassandra at %v on port %v to keyspace %v", "host1", 9042, "test_keyspace")

testCases := []struct {
desc string
Expand All @@ -93,12 +91,12 @@ func Test_Connect(t *testing.T) {
mockClusterConfig.EXPECT().createSession().Return(&cassandraSession{}, nil).Times(1)
mockMetrics.EXPECT().NewHistogram("app_cassandra_stats", "Response time of CASSANDRA queries in milliseconds.",
cassandraBuckets).Times(1)
mockLogger.EXPECT().Logf("connecting to cassandra at %v on port %v to keyspace %v", "host1", 9042, "test_keyspace")
mockLogger.EXPECT().Debugf("connecting to Cassandra at %v on port %v to keyspace %v", "host1", 9042, "test_keyspace")
mockLogger.EXPECT().Logf("connected to '%s' keyspace at host '%s' and port '%d'", "test_keyspace", "host1", 9042)
}, &cassandraSession{}},
{"connection failure", func() {
mockClusterConfig.EXPECT().createSession().Return(nil, errConnFail).Times(1)
mockLogger.EXPECT().Error("error connecting to cassandra: ")
mockLogger.EXPECT().Error("error connecting to Cassandra: ")
}, nil},
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/gofr/datasource/cassandra/mock_interfaces.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/gofr/datasource/cassandra/mock_logger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/gofr/datasource/cassandra/mock_metrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/gofr/datasource/clickhouse/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *client) UseTracer(tracer any) {
func (c *client) Connect() {
var err error

c.logger.Logf("connecting to clickhouse db at %v to database %v", c.config.Hosts, c.config.Database)
c.logger.Debugf("connecting to Clickhouse db at %v to database %v", c.config.Hosts, c.config.Database)

clickHouseBuckets := []float64{.05, .075, .1, .125, .15, .2, .3, .5, .75, 1, 2, 3, 4, 5, 7.5, 10}
c.metrics.NewHistogram("app_clickhouse_stats", "Response time of Clickhouse queries in milliseconds.", clickHouseBuckets...)
Expand All @@ -91,15 +91,15 @@ func (c *client) Connect() {
})

if err != nil {
c.logger.Errorf("error while connecting to clickhouse %v", err)
c.logger.Errorf("error while connecting to Clickhouse %v", err)

return
}

if err = c.conn.Ping(ctx); err != nil {
c.logger.Errorf("ping failed with error %v", err)
} else {
c.logger.Logf("successfully connected to clickhouseDB")
c.logger.Logf("successfully connected to ClickhouseDB")
}

go pushDBMetrics(c.conn, c.metrics)
Expand Down
4 changes: 1 addition & 3 deletions pkg/gofr/datasource/clickhouse/clickhouse_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build exclude

package clickhouse

import (
Expand Down Expand Up @@ -54,7 +52,7 @@ func Test_ClickHouse_ConnectAndMetricRegistrationAndPingFailure(t *testing.T) {
mockMetric.EXPECT().NewGauge("app_clickhouse_idle_connections", "Number of idle Clickhouse connections.")
mockMetric.EXPECT().SetGauge("app_clickhouse_open_connections", gomock.Any()).AnyTimes()
mockMetric.EXPECT().SetGauge("app_clickhouse_idle_connections", gomock.Any()).AnyTimes()
mockLogger.EXPECT().Logf("connecting to clickhouse db at %v to database %v", "localhost:8000", "test")
mockLogger.EXPECT().Debugf("connecting to Clickhouse db at %v to database %v", "localhost:8000", "test")
mockLogger.EXPECT().Errorf("ping failed with error %v", gomock.Any())

cl.Connect()
Expand Down
2 changes: 0 additions & 2 deletions pkg/gofr/datasource/clickhouse/mock_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions pkg/gofr/datasource/clickhouse/mock_logger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/gofr/datasource/clickhouse/mock_metrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/gofr/datasource/file/ftp/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func (f *fileSystem) Connect() {
Status: &status,
}, time.Now())

f.logger.Debug(fmt.Sprintf("connecting to FTP Server at %v", ftpServer))

if f.config.DialTimeout == 0 {
f.config.DialTimeout = time.Second * 5
}
Expand All @@ -116,7 +118,7 @@ func (f *fileSystem) Connect() {

status = "LOGIN SUCCESS"

f.logger.Logf("Connected to FTP server at '%v'", ftpServer)
f.logger.Logf("connected to FTP server at '%v'", ftpServer)
}

// Create creates an empty file on the FTP server.
Expand Down
2 changes: 0 additions & 2 deletions pkg/gofr/datasource/file/ftp/fs_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build exclude

package ftp

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/file/ftp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ require (
github.com/rogpeppe/go-internal v1.10.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
)
13 changes: 6 additions & 7 deletions pkg/gofr/datasource/file/ftp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
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=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 0 additions & 2 deletions pkg/gofr/datasource/file/ftp/mock_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/gofr/datasource/file/s3/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ func (f *fileSystem) Connect() {
Message: &msg,
}, time.Now())

f.logger.Debug(fmt.Sprintf("connecting to S3 bucket: %s", f.config.BucketName))

// Load the AWS configuration
cfg, err := awsConfig.LoadDefaultConfig(context.TODO(),
awsConfig.WithRegion(f.config.Region),
Expand All @@ -109,7 +111,7 @@ func (f *fileSystem) Connect() {
st = statusSuccess
msg = "S3 Client connected."

f.logger.Logf("Connected to S3 bucket %s", f.config.BucketName)
f.logger.Logf("connected to S3 bucket %s", f.config.BucketName)
}

// Create creates a new file in the S3 bucket.
Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/file/s3/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
)
13 changes: 6 additions & 7 deletions pkg/gofr/datasource/file/s3/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
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=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
6 changes: 3 additions & 3 deletions pkg/gofr/datasource/file/sftp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/stretchr/testify v1.9.0
go.uber.org/mock v0.5.0
gofr.dev v0.19.0
golang.org/x/crypto v0.28.0
golang.org/x/crypto v0.29.0
)

require (
Expand All @@ -20,6 +20,6 @@ require (
github.com/kr/fs v0.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/sys v0.27.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
)
21 changes: 8 additions & 13 deletions pkg/gofr/datasource/file/sftp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
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/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
Expand All @@ -41,15 +38,13 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
Expand All @@ -62,4 +57,4 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+
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=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4 changes: 3 additions & 1 deletion pkg/gofr/datasource/kv-store/badger/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (c *client) UseTracer(tracer any) {

// Connect establishes a connection to BadgerDB and registers metrics using the provided configuration when the client was Created.
func (c *client) Connect() {
c.logger.Infof("connecting to BadgerDB at %v", c.configs.DirPath)
c.logger.Debugf("connecting to BadgerDB at %v", c.configs.DirPath)

badgerBuckets := []float64{.05, .075, .1, .125, .15, .2, .3, .5, .75, 1, 2, 3, 4, 5, 7.5, 10}
c.metrics.NewHistogram("app_badger_stats", "Response time of Badger queries in milliseconds.", badgerBuckets...)
Expand All @@ -65,6 +65,8 @@ func (c *client) Connect() {
}

c.db = db

c.logger.Infof("connected to BadgerDB at %v", c.configs.DirPath)
}

func (c *client) Get(ctx context.Context, key string) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/kv-store/badger/mock_logger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions pkg/gofr/datasource/mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (c *Client) UseTracer(tracer any) {

// Connect establishes a connection to MongoDB and registers metrics using the provided configuration when the client was Created.
func (c *Client) Connect() {
c.logger.Logf("connecting to mongoDB at %v to database %v", c.config.URI, c.config.Database)
c.logger.Debug(fmt.Sprintf("connecting to MongoDB at %v to database %v", c.config.URI, c.config.Database))

uri := c.config.URI

Expand All @@ -89,7 +89,7 @@ func (c *Client) Connect() {

m, err := mongo.Connect(context.Background(), options.Client().ApplyURI(uri))
if err != nil {
c.logger.Errorf("error connecting to mongoDB, err:%v", err)
c.logger.Errorf("error connecting to MongoDB, err:%v", err)

return
}
Expand All @@ -98,6 +98,8 @@ func (c *Client) Connect() {
c.metrics.NewHistogram("app_mongo_stats", "Response time of MONGO queries in milliseconds.", mongoBuckets...)

c.Database = m.Database(c.config.Database)

c.logger.Logf("connected to MongoDB at %v to database %v", uri, c.Database)
}

// InsertOne inserts a single document into the specified collection.
Expand Down
Loading
Loading