Skip to content

Tweak Sentry SDK setup #291

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build libdispatch for the strip binary
FROM --platform=linux/amd64 debian:12-slim AS libdispatch-build

Check warning on line 2 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-pr-amd64

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
Expand Down Expand Up @@ -109,5 +109,8 @@
# Expose ports
EXPOSE 2218

ARG LAUNCHPAD_VERSION_SHA
ENV LAUNCHPAD_VERSION_SHA=$LAUNCHPAD_VERSION_SHA

# Default command
CMD ["launchpad", "serve", "--verbose"]
1 change: 1 addition & 0 deletions cloudbuild.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ steps:
set -euxo pipefail
docker buildx build \
--platform linux/amd64,linux/arm64 \
--build-arg LAUNCHPAD_VERSION_SHA=$COMMIT_SHA \
-t $LOCATION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:$COMMIT_SHA \
--label org.opencontainers.image.revision=$COMMIT_SHA \
--label org.opencontainers.image.version=$COMMIT_SHA \
Expand Down
1 change: 1 addition & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ steps:
docker buildx build \
--push \
--platform linux/amd64 \
--build-arg LAUNCHPAD_VERSION_SHA=$COMMIT_SHA \
-t $LOCATION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:$COMMIT_SHA \
-t $LOCATION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:$SHORT_SHA \
-t $LOCATION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:nightly \
Expand Down
11 changes: 5 additions & 6 deletions src/launchpad/sentry_sdk_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ def initialize_sentry_sdk() -> None:
dsn=config["dsn"],
integrations=integrations,
send_default_pii=True,
# Release is the git sha
release=config.get("release"),
environment=config.get("environment"),
# Convention is to set the Sentry environment to the region (us, de, etc).
environment=config["region"],
)

if config.get("region"):
sentry_sdk.set_tag("sentry_region", config["region"])

logger.info(f"Sentry SDK initialized for environment: {config.get('environment')}")


Expand All @@ -65,6 +64,6 @@ def get_sentry_config() -> Dict[str, Any]:
return {
"dsn": os.getenv("SENTRY_DSN"),
"environment": environment.lower(),
"release": os.getenv("LAUNCHPAD_VERSION_SHA", "unknown"), # TODO: auto fetch latest git commit hash
"region": os.getenv("SENTRY_REGION"),
"release": os.getenv("LAUNCHPAD_VERSION_SHA", "unknown"),
"region": os.getenv("SENTRY_REGION", "unknown"),
}