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

Add Uptime Monitoring #3304

Open
aldy505 opened this issue Aug 31, 2024 · 1 comment
Open

Add Uptime Monitoring #3304

aldy505 opened this issue Aug 31, 2024 · 1 comment

Comments

@aldy505
Copy link
Collaborator

aldy505 commented Aug 31, 2024

Problem Statement

Uptime Monitoring feature is out and it's on Early Release. We should bring that here if it hits General Availability.

Product discussion: getsentry/sentry#51110
Announcement: https://sentry.io/changelog/uptime-monitoring-early-adopters-release/
Documentation: https://docs.sentry.io/product/alerts/uptime-monitoring/

Solution Brainstorm

The way we'll tell you how to configure this should be versioned (learned this the hard way from User Feedback feature). Grab the version you're currently on (or if yours is higher than any of these, choose the highest one).

@aldy505
Copy link
Collaborator Author

aldy505 commented Aug 31, 2024

Setup guide for 24.8.0

Date of writing: 2024-08-31

Does this works for versions below 24.8.0? I have no idea.

On your docker-compose.yml, add a few new containers:

  uptime-results:
    <<: *sentry_defaults
    command: run consumer uptime-results --consumer-group uptime-results
    profiles:
      - feature-complete
  uptime-checker:
    <<: *restart_policy
    # IMPORTANT, READ THIS!
    # If you trust me enough (although we probably never met), you can use the Docker image I built to save some time, so you can use this:
    # image: "aldy505/sentry-uptime-checker:8ffa29b89b319e4b8e51154e82569796ea74c3af"
    #
    # But if you don't trust me enough and prefer to build from source yourself, use this instead (I'm using this on my instance).
    # If you're using the `image` section above, obviously you'll need to remove this `build` section (or just comment it out).
    build: ./uptime-checker-git
    command: run --config /config.yml
    volumes:
      - type: bind
        read_only: true
        source: ./uptime-checker/config.yml
        target: /config.yml
    # If you don't fancy a config file and prefer environment variables, use this instead (and remove the `volume` block above):
    # environment:
    #  UPTIME_CHECKER_REDIS_HOST: "redis://redis:6379"
    #  UPTIME_CHECKER_RESULTS_KAFKA_CLUSTER: "kafka:9092"
    #  UPTIME_CHECKER_RESULTS_KAFKA_TOPIC: "uptime-results"
    #  UPTIME_CHECKER_CONFIGS_KAFKA_CLUSTER: "kafka:9092"
    #  UPTIME_CHECKER_CONFIGS_KAFKA_TOPIC: "uptime-configs"
    #  UPTIME_CHECKER_CHECKER_CONCURRENCY: "200"
    #  UPTIME_CHECKER_LOG_LEVEL: "error"
    depends_on:
      kafka:
        <<: *depends_on-healthy
      redis:
        <<: *depends_on-healthy
    profiles:
      - feature-complete

On your sentry/sentry.conf.py, add some new feature flags:

SENTRY_FEATURES.update(
    {
        feature: True
        for feature in (
          # The rest of your features
        )
        # Uptime Monitoring related flags
        + (
            "organizations:uptime-api-create-update",
            "organizations:uptime-automatic-hostname-detection",
            "organizations:uptime-automatic-subscription-creation",
            "organizations:uptime-rule-api",
            "organizations:uptime-create-issues",
            "organizations:uptime-settings",
            "organizations:uptime-visible", # This is for issues platform
            "organizations:uptime-ingest",
            "organizations:uptime-post-process-group",
        )
    }
)

Create a new directory called uptime-checker, create a config.yml file. The resulting path is uptime-checker/config.yml. You don't need to do this if you're using environment variable as config on the docker-compose.yml:

# See https://github.com/getsentry/uptime-checker/blob/8ffa29b89b319e4b8e51154e82569796ea74c3af/src/app/config.rs
# You could technically use environment variable instead of this file, if you prefer, but I think it's better to use this instead.
# If you really want to use environment variables, do something like: UPTIME_CHECKER_SENTRY_DSN UPTIME_CHECKER_REDIS_HOST, you know the rest.

# sentry_dsn: <string, optional>
# sentry_env: <string, optional>
log_level: error # valid values: off, trace, debug, info, warn, error
log_format: auto # valid values: auto, pretty, simplified, json

checker_concurrency: 200

results_kafka_cluster: "kafka:9092"
results_kafka_topic: "uptime-results"
configs_kafka_cluster: "kafka:9092"
configs_kafka_topic: "uptime-configs"

redis_host: "redis://redis:6379"

If on the docker-compose.yml file you're not using the Docker image that I built, add a line on install.sh:

# ...
source install/update-docker-images.sh
source install/build-uptime-checker.sh # Add this (also remove this comment)
source install/build-docker-images.sh
# ...

And create the file install/build-uptime-checker.sh (still if you're not using the Docker image that I built):

echo "${_group}Building uptime-checker ... "

rm -rf uptime-checker-git

git clone --depth 1 https://github.com/getsentry/uptime-checker.git uptime-checker-git

echo "${_endgroup}"

After all that, run the ./install.sh script. Good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant