-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: basis opentelemetry støtte i for prosesstask (#746)
* feat: basis opentelemetry støtte i for prosesstask. * Review * Rydder versjonering
- Loading branch information
Showing
6 changed files
with
110 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/util/OtelUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package no.nav.vedtak.felles.prosesstask.impl.util; | ||
|
||
import java.util.function.UnaryOperator; | ||
|
||
import io.opentelemetry.api.GlobalOpenTelemetry; | ||
import io.opentelemetry.api.trace.SpanBuilder; | ||
import io.opentelemetry.api.trace.SpanKind; | ||
import no.nav.vedtak.felles.prosesstask.api.ProsessTaskData; | ||
import no.nav.vedtak.log.tracing.OtelSpanWrapper; | ||
|
||
public class OtelUtil { | ||
|
||
private static OtelSpanWrapper WRAPPER = new OtelSpanWrapper(GlobalOpenTelemetry.getTracer("fp-prosesstask")); | ||
|
||
public static OtelSpanWrapper wrapper() { | ||
return WRAPPER; | ||
} | ||
|
||
private OtelUtil() { | ||
// Sonar | ||
} | ||
|
||
public static UnaryOperator<SpanBuilder> taskAttributter(ProsessTaskData data) { | ||
return spanBuilder -> { | ||
var builder = spanBuilder | ||
.setAttribute("prosesstaskId", data.getId()) | ||
.setAttribute("prosesstaskType", data.taskType().value()); | ||
if (data.getSaksnummer() != null) { | ||
builder = builder.setAttribute("saksnummer", data.getSaksnummer()); | ||
} | ||
if (data.getBehandlingUuid() != null) { | ||
builder = builder.setAttribute("behandlingUuid", data.getBehandlingUuid().toString()); | ||
} else if (data.getBehandlingId() != null) { | ||
builder = builder.setAttribute("behandlingId", data.getBehandlingId()); | ||
} | ||
return builder.setSpanKind(SpanKind.INTERNAL); | ||
}; | ||
} | ||
} |