Skip to content

Commit

Permalink
as: Add new event types
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Vitan committed Aug 27, 2024
1 parent 101b9d4 commit c631daa
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions pkg/applicationserver/observability.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,36 @@ var (
events.WithDataType(&ttnpb.ApplicationUp{}),
events.WithPropagateToParent(),
)
evtDownlinkQueueInvalidated = events.Define(
"as.up.downlink.queue.invalidated", "downlink queue invalidated",
events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ),
events.WithDataType(&ttnpb.ApplicationUp{}),
events.WithPropagateToParent(),
)
evtDownlinkFailed = events.Define(
"as.up.downlink.failed", "downlink failed",
events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ),
events.WithDataType(&ttnpb.ApplicationUp{}),
events.WithPropagateToParent(),
)
evtDownlinkSent = events.Define(
"as.up.downlink.sent", "downlink sent",
events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ),
events.WithDataType(&ttnpb.ApplicationUp{}),
events.WithPropagateToParent(),
)
evtDownlinkAck = events.Define(
"as.up.downlink.ack", "downlink acknowledged",
events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ),
events.WithDataType(&ttnpb.ApplicationUp{}),
events.WithPropagateToParent(),
)
evtDownlinkNack = events.Define(
"as.up.downlink.nack", "downlink not acknowledged",
events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ),
events.WithDataType(&ttnpb.ApplicationUp{}),
events.WithPropagateToParent(),
)
evtReceiveDataDown = events.Define(
"as.down.data.receive", "receive downlink data message",
events.WithVisibility(ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ),
Expand Down Expand Up @@ -283,6 +313,16 @@ func registerForwardUp(ctx context.Context, msg *ttnpb.ApplicationUp) {
events.Publish(evtForwardLocationSolved.NewWithIdentifiersAndData(ctx, msg.EndDeviceIds, msg))
case *ttnpb.ApplicationUp_ServiceData:
events.Publish(evtForwardServiceData.NewWithIdentifiersAndData(ctx, msg.EndDeviceIds, msg))
case *ttnpb.ApplicationUp_DownlinkQueueInvalidated:
events.Publish(evtDownlinkQueueInvalidated.NewWithIdentifiersAndData(ctx, msg.EndDeviceIds, msg))
case *ttnpb.ApplicationUp_DownlinkFailed:
events.Publish(evtDownlinkFailed.NewWithIdentifiersAndData(ctx, msg.EndDeviceIds, msg))
case *ttnpb.ApplicationUp_DownlinkSent:
events.Publish(evtDownlinkSent.NewWithIdentifiersAndData(ctx, msg.EndDeviceIds, msg))
case *ttnpb.ApplicationUp_DownlinkAck:
events.Publish(evtDownlinkAck.NewWithIdentifiersAndData(ctx, msg.EndDeviceIds, msg))
case *ttnpb.ApplicationUp_DownlinkNack:
events.Publish(evtDownlinkNack.NewWithIdentifiersAndData(ctx, msg.EndDeviceIds, msg))
default:
return
}
Expand Down

0 comments on commit c631daa

Please sign in to comment.