tracer层级问题

This commit is contained in:
2025-04-13 12:09:49 +08:00
parent b11a315b0d
commit dc10092f7a
3 changed files with 27 additions and 25 deletions

View File

@ -19,7 +19,7 @@ type LocalAdapter struct {
}
func (l *LocalAdapter) GetFileList(ctx context.Context, dirPath string, relDt time.Time) ([]dto.File, error) {
_, span := tracer.Start(ctx, "GetFileList_local")
subCtx, span := tracer.Start(ctx, "GetFileList_local")
defer span.End()
if l.StorageConfig.Path == "" {
span.SetAttributes(attribute.String("error", "未配置存储路径"))
@ -54,7 +54,7 @@ func (l *LocalAdapter) GetFileList(ctx context.Context, dirPath string, relDt ti
if startTime.Equal(stopTime) || stopTime.IsZero() {
// 如果文件名没有时间戳,则认为该文件是未录制完成的
// 尝试读取一下视频信息
duration, err := util.GetVideoDuration(ctx, path.Join(l.StorageConfig.Path, dirPath, file.Name()))
duration, err := util.GetVideoDuration(subCtx, path.Join(l.StorageConfig.Path, dirPath, file.Name()))
if err != nil {
// 如果还是没有,就按照配置文件里的加起来
stopTime = stopTime.Add(time.Second * time.Duration(config.Config.Record.Duration))