Skip to content

Commit

Permalink
fix: cleanup span names for reader and writer
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWhitehead committed Dec 18, 2024
1 parent 55e5770 commit 142af35
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@ public GrpcBlobReadChannel reader(String bucket, String blob, BlobSourceOption..

@Override
public GrpcBlobReadChannel reader(BlobId blob, BlobSourceOption... options) {
Span otelSpan = openTelemetryTraceUtil.startSpan("reader", this.getClass().getName());
try (Scope unused = otelSpan.makeCurrent()) {
Span otelSpan = openTelemetryTraceUtil.startSpan("reader", MODULE_STORAGE);
try (Scope ignore = otelSpan.makeCurrent()) {
Opts<ObjectSourceOpt> opts = Opts.unwrap(options).resolveFrom(blob).prepend(defaultOpts);
ReadObjectRequest request = getReadObjectRequest(blob, opts);
GrpcCallContext grpcCallContext = Retrying.newCallContext();
Expand Down Expand Up @@ -856,8 +856,8 @@ public void downloadTo(BlobId blob, OutputStream outputStream, BlobSourceOption.

@Override
public GrpcBlobWriteChannel writer(BlobInfo blobInfo, BlobWriteOption... options) {
Span otelSpan = openTelemetryTraceUtil.startSpan("writer", this.getClass().getName());
try (Scope unused = otelSpan.makeCurrent()) {
Span otelSpan = openTelemetryTraceUtil.startSpan("writer", MODULE_STORAGE);
try (Scope ignore = otelSpan.makeCurrent()) {
Opts<ObjectTargetOpt> opts = Opts.unwrap(options).resolveFrom(blobInfo).prepend(defaultOpts);
GrpcCallContext grpcCallContext =
opts.grpcMetadataMapper().apply(GrpcCallContext.createDefault());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,8 @@ public StorageReadChannel reader(String bucket, String blob, BlobSourceOption...

@Override
public StorageReadChannel reader(BlobId blob, BlobSourceOption... options) {
Span otelSpan = openTelemetryTraceUtil.startSpan("reader", this.getClass().getName());
try (Scope unused = otelSpan.makeCurrent()) {
Span otelSpan = openTelemetryTraceUtil.startSpan("reader", MODULE_STORAGE);
try (Scope ignored = otelSpan.makeCurrent()) {
Opts<ObjectSourceOpt> opts = Opts.unwrap(options).resolveFrom(blob);
StorageObject storageObject = Conversions.json().blobId().encode(blob);
ImmutableMap<StorageRpc.Option, ?> optionsMap = opts.getRpcOptions();
Expand Down Expand Up @@ -789,8 +789,8 @@ public void downloadTo(BlobId blob, OutputStream outputStream, BlobSourceOption.

@Override
public StorageWriteChannel writer(BlobInfo blobInfo, BlobWriteOption... options) {
Span otelSpan = openTelemetryTraceUtil.startSpan("writer", this.getClass().getName());
try (Scope unused = otelSpan.makeCurrent()) {
Span otelSpan = openTelemetryTraceUtil.startSpan("writer", MODULE_STORAGE);
try (Scope ignored = otelSpan.makeCurrent()) {
Opts<ObjectTargetOpt> opts = Opts.unwrap(options).resolveFrom(blobInfo);
final Map<StorageRpc.Option, ?> optionsMap = opts.getRpcOptions();
BlobInfo.Builder builder = blobInfo.toBuilder().setMd5(null).setCrc32c(null);
Expand Down Expand Up @@ -819,8 +819,8 @@ public StorageWriteChannel writer(BlobInfo blobInfo, BlobWriteOption... options)

@Override
public StorageWriteChannel writer(URL signedURL) {
Span otelSpan = openTelemetryTraceUtil.startSpan("writer", this.getClass().getName());
try (Scope unused = otelSpan.makeCurrent()) {
Span otelSpan = openTelemetryTraceUtil.startSpan("writer", MODULE_STORAGE);
try (Scope ignored = otelSpan.makeCurrent()) {
// TODO: is it possible to know if a signed url is configured to have a constraint which makes
// it idempotent?
ResultRetryAlgorithm<?> forResumableUploadSessionCreate =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public Scope makeCurrent() {
@Override
public OpenTelemetryTraceUtil.Span startSpan(String methodName, String module) {
String formatSpanName = String.format("%s/%s", module, methodName);
SpanBuilder spanBuilder = tracer.spanBuilder(formatSpanName).setSpanKind(SpanKind.CLIENT);
SpanBuilder spanBuilder = tracer.spanBuilder(formatSpanName);
io.opentelemetry.api.trace.Span span =
addSettingsAttributesToCurrentSpan(spanBuilder).startSpan();
return new Span(span, formatSpanName);
Expand Down

0 comments on commit 142af35

Please sign in to comment.