Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cleanup span names for reader and writer #2855

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading