apache / apache/hertzbeat

[BUG] Gotify fallback webhook URL is missing token placeholder

Open Beginner friendly
#4,349 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
7.4k
Forks
1.3k
Avg merge
1d 20h
Merged PRs (30d)
32

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Current Behavior

### Describe the bug

`AlerterProperties.java` defines the fallback default Gotify webhook URL as:

```java
private String gotifyWebhookUrl = "https://push.example.de/message?token=";
```

But `GotifyAlertNotifyHandlerImpl` formats this value with the receiver token:

```java
String webHookUrl = String.format(alerterProperties.getGotifyWebhookUrl(), receiver.getGotifyToken());
```

Because the fallback default does not contain a `%s` placeholder, `String.format()` ignores `receiver.getGotifyToken()`. If this Java fallback value is used, the generated URL becomes:

```text
https://push.example.de/message?token=
```

instead of including the Gotify token.

The configured value in `application.yml` already uses the expected format:

```yaml
gotify-webhook-url: http://127.0.0.1/message?token=%s
```

So the Java fallback default should be consistent with the configured default.

### Expected Behavior

The fallback default should include the token placeholder:

```java
private String gotifyWebhookUrl = "https://push.example.de/message?token=%s";
```

### Steps To Reproduce

_No response_

### Environment

```markdown
HertzBeat master branch / 2.0-SNAPSHOT.
```

### Debug logs

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by comparing the fallback value in AlerterProperties.java with the formatting call in GotifyAlertNotifyHandlerImpl. Confirm that the fallback URL contains the token placeholder and that formatting it with a receiver token produces the expected Gotify URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability-sre
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
92/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.