Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ NOTE: all releases may include dependency updates, not specifically mentioned
## UNRELEASED

- feat: integrate try-as library [#912](https://github.com/hypermodeinc/modus/pull/912)
- fix: sentry source context [#940](https://github.com/hypermodeinc/modus/pull/940)

## 2025-07-09 - Runtime v0.18.4

Expand Down
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# copy runtime binary from the build phase
COPY --from=builder /src/runtime/modus_runtime /usr/bin/modus_runtime

# copy the runtime source code to the container (for Sentry source context)
# keep only go source files and remove tests
COPY ./runtime /src/runtime/
COPY ./lib /src/lib/
RUN find /src -type f ! -name '*.go' -delete && \
find /src -type f -name '*_test.go' -delete && \
find /src -type d -name '*test*' -exec rm -rf {} +

# update certificates and time zones every build
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
Expand Down
29 changes: 9 additions & 20 deletions runtime/sentryutils/sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,20 @@ import (

const max_breadcrumbs = 100

// NOTE: If this code is moved, adjust these constants accordingly.
const thisPackageDepth = 1 // root is 0
const thisPackagePath = "github.com/hypermodeinc/modus/runtime/sentryutils"

var rootSourcePath = func() string {
pc, filename, _, ok := runtime.Caller(0)
_, filename, _, ok := runtime.Caller(0)
if !ok {
return ""
}

callerName := runtime.FuncForPC(pc).Name()
depth := strings.Count(callerName, "/") + 1
s := filename
for range depth {
s = path.Dir(s)
}
return s + "/"
}()

var thisPackagePath = func() string {
pc, _, _, ok := runtime.Caller(0)
if !ok {
return ""
dir := path.Dir(filename)
for range thisPackageDepth {
dir = path.Dir(dir)
}

callerName := runtime.FuncForPC(pc).Name()
i := max(strings.LastIndexByte(callerName, '/'), 0)
j := strings.IndexByte(callerName[i:], '.')
return callerName[0 : i+j]
return dir + "/"
}()

func InitializeSentry() {
Expand Down
Loading