Skip to content

Commit

Permalink
fix(core): Return task is no longer failing with empty format
Browse files Browse the repository at this point in the history
closes #2105
  • Loading branch information
brian-mulier-p committed Sep 13, 2023
1 parent 8c47569 commit 0328e82
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/java/io/kestra/core/tasks/debugs/Return.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.slf4j.Logger;

import java.time.Duration;
import java.util.Optional;

@SuperBuilder
@ToString
Expand Down Expand Up @@ -56,7 +57,7 @@ public Return.Output run(RunContext runContext) throws Exception {
long end = System.nanoTime();

runContext
.metric(Counter.of("length", render.length(), "format", format))
.metric(Counter.of("length", Optional.ofNullable(render).map(String::length).orElse(0), "format", format))
.metric(Timer.of("duration", Duration.ofNanos(end - start), "format", format));

return Output.builder()
Expand Down

0 comments on commit 0328e82

Please sign in to comment.