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: Correcting time unit for logs of added http-service #1214

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/cassandra/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ func (*Client) getColumnsFromColumnsInfo(columns []gocql.ColumnInfo) []string {
}

func (c *Client) sendOperationStats(ql *QueryLog, startTime time.Time, method string, span trace.Span) {
duration := time.Since(startTime).Milliseconds()
duration := time.Since(startTime).Microseconds()

ql.Duration = duration

Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/clickhouse/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (c *client) AsyncInsert(ctx context.Context, query string, wait bool, args

func (c *client) sendOperationStats(start time.Time, methodType, query string, method string,
span trace.Span, args ...interface{}) {
duration := time.Since(start).Milliseconds()
duration := time.Since(start).Microseconds()

c.logger.Debug(&Log{
Type: methodType,
Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/file/ftp/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func (f *file) WriteAt(p []byte, off int64) (n int, err error) {
}

func (f *file) sendOperationStats(fl *FileLog, startTime time.Time) {
duration := time.Since(startTime).Milliseconds()
duration := time.Since(startTime).Microseconds()

fl.Duration = duration

Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/file/ftp/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func (f *fileSystem) Rename(oldname, newname string) error {
}

func (f *fileSystem) sendOperationStats(fl *FileLog, startTime time.Time) {
duration := time.Since(startTime).Milliseconds()
duration := time.Since(startTime).Microseconds()

fl.Duration = duration

Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/file/s3/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ func (f *s3file) Seek(offset int64, whence int) (int64, error) {

// sendOperationStats logs the FileLog of any file operations performed in S3.
func (f *s3file) sendOperationStats(fl *FileLog, startTime time.Time) {
duration := time.Since(startTime).Milliseconds()
duration := time.Since(startTime).Microseconds()

fl.Duration = duration

Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/file/s3/fs_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func (f *fileSystem) renameDirectory(st, msg *string, oldPath, newPath string) e

// sendOperationStats logs the FileLog of any file operations performed in S3.
func (f *fileSystem) sendOperationStats(fl *FileLog, startTime time.Time) {
duration := time.Since(startTime).Milliseconds()
duration := time.Since(startTime).Microseconds()

fl.Duration = duration

Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/file/sftp/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (f *fileSystem) Getwd() (string, error) {
}

func (f *fileSystem) sendOperationStats(fl *FileLog, startTime time.Time) {
duration := time.Since(startTime).Milliseconds()
duration := time.Since(startTime).Microseconds()

fl.Duration = duration

Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/kv-store/badger/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (c *client) useTransaction(f func(txn *badger.Txn) error) error {

func (c *client) sendOperationStats(start time.Time, methodType string, method string,
span trace.Span, kv ...string) {
duration := time.Since(start).Milliseconds()
duration := time.Since(start).Microseconds()

c.logger.Debug(&Log{
Type: methodType,
Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (c *Client) CreateCollection(ctx context.Context, name string) error {
}

func (c *Client) sendOperationStats(ql *QueryLog, startTime time.Time, method string, span trace.Span) {
duration := time.Since(startTime).Milliseconds()
duration := time.Since(startTime).Microseconds()

ql.Duration = duration

Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/redis/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (ql *QueryLog) String() string {

// logQuery logs the Redis query information.
func (r *redisHook) sendOperationStats(start time.Time, query string, args ...interface{}) {
duration := time.Since(start).Milliseconds()
duration := time.Since(start).Microseconds()

r.logger.Debug(&QueryLog{
Query: query,
Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/solr/solr.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (c *Client) createRequest(ctx context.Context, method, url string, params m
}

func (c *Client) sendOperationStats(ctx context.Context, ql *QueryLog, startTime time.Time, method string, span trace.Span) {
duration := time.Since(startTime).Milliseconds()
duration := time.Since(startTime).Microseconds()

ql.Duration = duration

Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/datasource/sql/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func clean(query string) string {
}

func (d *DB) sendOperationStats(start time.Time, queryType, query string, args ...interface{}) {
duration := time.Since(start).Milliseconds()
duration := time.Since(start).Microseconds()

d.logger.Debug(&Log{
Type: queryType,
Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/service/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (h *httpService) createAndSendRequest(ctx context.Context, method string, p

respTime := time.Since(requestStart)

log.ResponseTime = respTime.Milliseconds()
log.ResponseTime = respTime.Microseconds()

if err != nil {
log.ResponseCode = http.StatusInternalServerError
Expand Down
Loading