Add TwirpRequestStatusReporter twirp server hook to count requests (#1309)

This commit is contained in:
Benjamin Pracht
2023-01-18 11:53:20 -08:00
committed by GitHub
parent bccf7a6842
commit edc39da0b1
7 changed files with 120 additions and 25 deletions
+2 -1
View File
@@ -12,6 +12,7 @@ import (
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils"
"github.com/twitchtv/twirp"
"github.com/livekit/livekit-server/pkg/telemetry"
)
@@ -301,7 +302,7 @@ func (s *EgressService) StopEgress(ctx context.Context, req *livekit.StopEgressR
} else {
if info.Status != livekit.EgressStatus_EGRESS_STARTING &&
info.Status != livekit.EgressStatus_EGRESS_ACTIVE {
return nil, fmt.Errorf("egress with status %s cannot be stopped", info.Status.String())
return nil, twirp.NewError(twirp.FailedPrecondition, fmt.Sprintf("egress with status %s cannot be stopped", info.Status.String()))
}
}