Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
0de4349f
Commit
0de4349f
authored
Jul 20, 2023
by
李科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 完善处置
parent
6b404ed5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
src/service/alert.go
src/service/alert.go
+15
-1
No files found.
src/service/alert.go
View file @
0de4349f
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"context"
"context"
"errors"
"errors"
"fmt"
"fmt"
"github.com/jinzhu/copier"
json
"github.com/json-iterator/go"
json
"github.com/json-iterator/go"
"github.com/olivere/elastic/v7"
"github.com/olivere/elastic/v7"
"github.com/opensearch-project/opensearch-go/opensearchapi"
"github.com/opensearch-project/opensearch-go/opensearchapi"
...
@@ -15,11 +16,13 @@ import (
...
@@ -15,11 +16,13 @@ import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/util"
"go.uber.org/zap"
"go.uber.org/zap"
"io"
"io"
"log"
"log"
"net/http"
"net/http"
"strings"
"strings"
"time"
"xorm.io/xorm"
"xorm.io/xorm"
)
)
...
@@ -404,9 +407,18 @@ func (a *AlertSvc) Update(req request.UpdateAlert) error {
...
@@ -404,9 +407,18 @@ func (a *AlertSvc) Update(req request.UpdateAlert) error {
func
(
a
*
AlertSvc
)
BatchPushAlert
(
session
*
xorm
.
Session
,
req
request
.
BatchPushAlert
)
error
{
func
(
a
*
AlertSvc
)
BatchPushAlert
(
session
*
xorm
.
Session
,
req
request
.
BatchPushAlert
)
error
{
now
:=
jsontime
.
Now
()
now
:=
jsontime
.
Now
()
_
=
now
data
:=
entity
.
PushRecord
{
CreatedBy
:
a
.
User
.
SystemAccount
,
CreatedAt
:
now
,
UpdatedBy
:
a
.
User
.
SystemAccount
,
UpdatedAt
:
now
,
}
_
=
copier
.
Copy
(
&
data
,
&
req
)
data
.
NotifyMethod
=
util
.
ConvertToString
(
req
.
NotifyMethod
)
data
.
SystemAccount
=
util
.
ConvertToString
(
req
.
NotifyRecipients
)
// 循环查询
// TODO 批量推送用户告警
// TODO 批量推送用户告警
conf
.
Logger
.
Info
(
"batch push"
,
zap
.
Any
(
"payload"
,
req
))
conf
.
Logger
.
Info
(
"batch push"
,
zap
.
Any
(
"payload"
,
req
))
time
.
Sleep
(
time
.
Second
)
return
nil
return
nil
}
}
...
@@ -429,6 +441,7 @@ func (a *AlertSvc) BatchCloseAlert(req request.BatchCloseAlert) (err error) {
...
@@ -429,6 +441,7 @@ func (a *AlertSvc) BatchCloseAlert(req request.BatchCloseAlert) (err error) {
}
}
}
}
conf
.
Logger
.
Info
(
"batch close"
,
zap
.
Any
(
"payload"
,
req
))
conf
.
Logger
.
Info
(
"batch close"
,
zap
.
Any
(
"payload"
,
req
))
time
.
Sleep
(
time
.
Second
)
return
return
}
}
...
@@ -518,5 +531,6 @@ func (a *AlertSvc) DisposeAlert(req request.DisposeAlert) (err error) {
...
@@ -518,5 +531,6 @@ func (a *AlertSvc) DisposeAlert(req request.DisposeAlert) (err error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
time
.
Sleep
(
time
.
Second
)
return
nil
return
nil
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment