Skip to content
Merged
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
4 changes: 2 additions & 2 deletions charts/veaiops/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.1.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"
appVersion: "0.1.1"

dependencies:
- name: common
Expand Down
10 changes: 5 additions & 5 deletions charts/veaiops/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ backend:
image:
registry: veaiops-registry-cn-beijing.cr.volces.com
repository: veaiops/backend
tag: v0.1.0
tag: v0.1.1
pullPolicy: Always
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
Expand Down Expand Up @@ -312,7 +312,7 @@ chatops:
image:
registry: veaiops-registry-cn-beijing.cr.volces.com
repository: veaiops/chatops
tag: v0.1.0
tag: v0.1.1
pullPolicy: Always
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
Expand Down Expand Up @@ -378,7 +378,7 @@ frontend:
image:
registry: veaiops-registry-cn-beijing.cr.volces.com
repository: veaiops/frontend
tag: v0.1.0
tag: v0.1.1
pullPolicy: Always
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
Expand Down Expand Up @@ -445,7 +445,7 @@ intelligentThreshold:
image:
registry: veaiops-registry-cn-beijing.cr.volces.com
repository: veaiops/intelligent-threshold
tag: v0.1.0
tag: v0.1.1
pullPolicy: Always
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
Expand Down Expand Up @@ -538,7 +538,7 @@ initial:
image:
registry: veaiops-registry-cn-beijing.cr.volces.com
repository: veaiops/initial
tag: v0.1.0
tag: v0.1.1
pullPolicy: Always
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
Expand Down
58 changes: 34 additions & 24 deletions veaiops/handler/services/event/subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,40 +93,50 @@ async def create_notice_details(event: Event, subscribes: List[Subscribe]) -> Li
"""
logger.info(f"start create notice details. event_id={event.id} matched_subscribes={subscribes}")
notice_details = []
seen_notifications = set()
for subscribe in subscribes:
# 2.1 Webhook notification
if subscribe.enable_webhook is True and subscribe.webhook_endpoint:
logger.info(f"create notice detail with webhook endpoint {subscribe.webhook_endpoint} meet")
notice_details.append(
EventNoticeDetail(
event_main_id=event.id,
notice_channel=ChannelType.Webhook,
target=subscribe.webhook_endpoint,
extra={"headers": subscribe.webhook_headers},
status=EventStatus.INITIAL,
key = (event.id, ChannelType.Webhook, subscribe.webhook_endpoint)
if key not in seen_notifications:
logger.info(f"create notice detail with webhook endpoint {subscribe.webhook_endpoint} meet")
notice_details.append(
EventNoticeDetail(
event_main_id=event.id,
notice_channel=ChannelType.Webhook,
target=subscribe.webhook_endpoint,
extra={"headers": subscribe.webhook_headers},
status=EventStatus.INITIAL,
)
)
)
seen_notifications.add(key)

# 2.2 Channel notifications
for strategy in subscribe.inform_strategy_ids:
logger.info(f"create notice detail with channel strategy {strategy}")
for chat_id in strategy.chat_ids:
logger.info(
f"create notice detail with channel strategy {strategy} channel{strategy.channel} chat_id {chat_id}"
)
notice_details.append(
EventNoticeDetail(
event_main_id=event.id,
notice_channel=ChannelType(strategy.channel),
target=chat_id,
extra={
"bot_id": strategy.bot_id,
"msg_id": event.raw_data.msg_id if isinstance(event.raw_data, AgentNotification) else "",
"chat_id": chat_id,
},
status=EventStatus.INITIAL,
key = (event.id, ChannelType(strategy.channel), chat_id)
if key not in seen_notifications:
logger.info(
f"create notice detail with channel strategy {strategy} "
f"channel {strategy.channel} chat_id {chat_id}"
)
)
notice_details.append(
EventNoticeDetail(
event_main_id=event.id,
notice_channel=ChannelType(strategy.channel),
target=chat_id,
extra={
"bot_id": strategy.bot_id,
"msg_id": event.raw_data.msg_id
if isinstance(event.raw_data, AgentNotification)
else "",
"chat_id": chat_id,
},
status=EventStatus.INITIAL,
)
)
seen_notifications.add(key)

return notice_details

Expand Down