Skip to content

Commit

Permalink
tracing sampling return value update (#351)
Browse files Browse the repository at this point in the history
* tracing sampling return value update

* set limit only if defined
  • Loading branch information
gicont committed Mar 30, 2023
1 parent f624b07 commit 0e63a42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion backend/pkg/database/apievent.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,11 @@ func (a *APIEventsTableHandler) GetAPIEventsWithAnnotations(ctx context.Context,
sortDir = "ASC"
}

if query.Limit != 0 {
tx = tx.Limit(query.Limit)
}

if err := tx.Offset(query.Offset).
Limit(query.Limit).
Order(fmt.Sprintf("%s %s", query.Order, sortDir)).
WithContext(ctx).
Find(&events).Error; err != nil {
Expand Down
3 changes: 1 addition & 2 deletions backend/pkg/modules/internal/core/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package core

import (
"context"
"errors"
"fmt"
"net/http"

Expand Down Expand Up @@ -241,7 +240,7 @@ func (b *accessor) Notify(ctx context.Context, modName string, apiID uint, n not

func (b *accessor) EnableTraces(ctx context.Context, modName string, apiID uint) error {
if !b.traceSamplingEnabled {
return errors.New("trace sampling is not enabled")
return nil
}
if err := b.samplingManager.AddHostToTrace(modName, uint32(apiID)); err != nil {
return fmt.Errorf("failed to add API %v to trace: %v", apiID, err)
Expand Down

0 comments on commit 0e63a42

Please sign in to comment.