Add additional performance spans
This commit is contained in:
@ -8,6 +8,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/getsentry/sentry-go"
|
||||
nomadApi "github.com/hashicorp/nomad/api"
|
||||
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
|
||||
"github.com/openHPI/poseidon/internal/nomad"
|
||||
@ -153,7 +154,7 @@ func (r *NomadJob) ListFileSystem(
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *NomadJob) UpdateFileSystem(copyRequest *dto.UpdateFileSystemRequest) error {
|
||||
func (r *NomadJob) UpdateFileSystem(copyRequest *dto.UpdateFileSystemRequest, ctx context.Context) error {
|
||||
r.ResetTimeout()
|
||||
|
||||
var tarBuffer bytes.Buffer
|
||||
@ -166,10 +167,11 @@ func (r *NomadJob) UpdateFileSystem(copyRequest *dto.UpdateFileSystemRequest) er
|
||||
updateFileCommand := (&dto.ExecutionRequest{Command: fileDeletionCommand + copyCommand}).FullCommand()
|
||||
stdOut := bytes.Buffer{}
|
||||
stdErr := bytes.Buffer{}
|
||||
span := sentry.StartSpan(ctx, "Execute Update File System")
|
||||
exitCode, err := r.api.ExecuteCommand(r.id, context.Background(), updateFileCommand, false,
|
||||
nomad.PrivilegedExecution, // All files should be written and owned by a privileged user #211.
|
||||
&tarBuffer, &stdOut, &stdErr)
|
||||
|
||||
span.Finish()
|
||||
if err != nil {
|
||||
return fmt.Errorf(
|
||||
"%w: nomad error during file copy: %v",
|
||||
|
Reference in New Issue
Block a user