Skip to content

Commit

Permalink
refactor(tracer): Renaming span to be closed than code
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Dec 30, 2022
1 parent 17ad19d commit 65e185f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/crud/upload_chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (a App) uploadChunk(w http.ResponseWriter, r *http.Request, request provide
}

func (a App) mergeChunk(w http.ResponseWriter, r *http.Request, request provider.Request, values map[string]string) {
ctx, end := tracer.StartSpan(r.Context(), a.tracer, "mergeChunk")
ctx, end := tracer.StartSpan(r.Context(), a.tracer, "merge_chunk")
defer end()

fileName, err := safeFilename(values["filename"])
Expand Down
8 changes: 4 additions & 4 deletions pkg/metadata/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ func (a App) GetMetadataFor(ctx context.Context, item absto.Item) (provider.Meta
return provider.Metadata{}, nil
}

ctx, end := tracer.StartSpan(ctx, a.tracer, "get_exif")
ctx, end := tracer.StartSpan(ctx, a.tracer, "get_metadata")
defer end()

return a.exifCacheApp.Get(ctx, item)
}

func (a App) GetAllMetadataFor(ctx context.Context, items ...absto.Item) (map[string]provider.Metadata, error) {
ctx, end := tracer.StartSpan(ctx, a.tracer, "list_exif")
ctx, end := tracer.StartSpan(ctx, a.tracer, "get_all_metadata")
defer end()

exifs, err := a.exifCacheApp.List(ctx, onListError, items...)
Expand All @@ -59,14 +59,14 @@ func (a App) GetAggregateFor(ctx context.Context, item absto.Item) (provider.Agg
return provider.Aggregate{}, nil
}

ctx, end := tracer.StartSpan(ctx, a.tracer, "aggregate")
ctx, end := tracer.StartSpan(ctx, a.tracer, "get_aggregate")
defer end()

return a.aggregateCacheApp.Get(ctx, item)
}

func (a App) GetAllAggregateFor(ctx context.Context, items ...absto.Item) (map[string]provider.Aggregate, error) {
ctx, end := tracer.StartSpan(ctx, a.tracer, "list_aggregate")
ctx, end := tracer.StartSpan(ctx, a.tracer, "get_all_aggregate")
defer end()

exifs, err := a.aggregateCacheApp.List(ctx, onListError, items...)
Expand Down
6 changes: 3 additions & 3 deletions pkg/thumbnail/thumbnail.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (a App) List(w http.ResponseWriter, r *http.Request, item absto.Item, items
return
}

ctx, end := tracer.StartSpan(r.Context(), a.tracer, "thumbnail_list", trace.WithSpanKind(trace.SpanKindInternal))
ctx, end := tracer.StartSpan(r.Context(), a.tracer, "list", trace.WithSpanKind(trace.SpanKindInternal))
defer end()

var hash string
Expand Down Expand Up @@ -261,7 +261,7 @@ func (a App) List(w http.ResponseWriter, r *http.Request, item absto.Item, items
}

func (a App) thumbnailHash(ctx context.Context, items []absto.Item) string {
ctx, end := tracer.StartSpan(ctx, a.tracer, "thumbnail_hash", trace.WithSpanKind(trace.SpanKindInternal))
ctx, end := tracer.StartSpan(ctx, a.tracer, "hash", trace.WithSpanKind(trace.SpanKindInternal))
defer end()

ids := make([]string, len(items))
Expand All @@ -288,7 +288,7 @@ func (a App) encodeContent(ctx context.Context, w io.Writer, isDone func() bool,
return
}

ctx, end := tracer.StartSpan(ctx, a.tracer, "thumbnail_encode", trace.WithSpanKind(trace.SpanKindInternal))
ctx, end := tracer.StartSpan(ctx, a.tracer, "encode", trace.WithSpanKind(trace.SpanKindInternal))
defer end()

reader, err := a.storageApp.ReadFrom(ctx, a.PathForScale(item, SmallSize))
Expand Down

0 comments on commit 65e185f

Please sign in to comment.