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

Cherry-pick errWebhookDisabled update #7509

Closed
wants to merge 2 commits into from
Closed
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
14 changes: 0 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,10 @@ For details about compatibility between different releases, see the **Commitment

### Added

- Add recvTime field to the decodeUplink input in payload formatters
- Add the latest battery percentage of the end device in the `ApplicationUplink` message.
- Add live data split view tutorial to the Console.
- Add end device attributes to ApplicationUp messages.
- Add the locations, version_ids, network_ids fields to the following ApplicationUp messages:
- ApplicationJoinAccept
- ApplicationDownlink
- ApplicationDownlinkFailed
- ApplicationInvalidatedDownlinks
- ApplicationServiceData
- Add Timeout and Cache fields in the EndDeviceMetadataStorageConfig of the AS.

### Changed

### Deprecated

- Deprecate the Location field (and its subfields) in the EndDeviceMetadataStorageConfig of AS.

### Removed

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion config/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2764,7 +2764,7 @@
},
"error:pkg/applicationserver/io/web/sink:webhook_disabled": {
"translations": {
"en": "webhook disabled"
"en": "webhook {webhook_id} of application {application_id} is disabled"
},
"description": {
"package": "pkg/applicationserver/io/web/sink",
Expand Down
10 changes: 8 additions & 2 deletions pkg/applicationserver/io/web/sink/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"net/http"
"time"

"go.thethings.network/lorawan-stack/v3/pkg/applicationserver/io/web/internal"
"go.thethings.network/lorawan-stack/v3/pkg/errors"
"go.thethings.network/lorawan-stack/v3/pkg/ttnpb"
"google.golang.org/protobuf/types/known/timestamppb"
Expand Down Expand Up @@ -60,7 +61,9 @@ const (
healthStateUnhealthy
)

var errWebhookDisabled = errors.DefineAborted("webhook_disabled", "webhook disabled")
var errWebhookDisabled = errors.DefineAborted(
"webhook_disabled", "webhook {webhook_id} of application {application_id} is disabled",
)

// preRunCheck verifies if the webhook should be executed.
func (hcs *healthCheckSink) preRunCheck(ctx context.Context) (healthState, error) {
Expand Down Expand Up @@ -102,7 +105,10 @@ func (hcs *healthCheckSink) preRunCheck(ctx context.Context) (healthState, error

default:
// The webhook is above the threshold, and the cooldown period has not passed yet.
return healthStateUnhealthy, errWebhookDisabled.New()
return healthStateUnhealthy, errWebhookDisabled.WithAttributes(
"application_id", internal.WebhookIDFromContext(ctx).ApplicationIds.ApplicationId,
"webhook_id", internal.WebhookIDFromContext(ctx).WebhookId,
)
}

default:
Expand Down
Loading