-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added calls to error handlers (#274)
* Added handler errors to send stack to platform * added exec func * fixed the error handler call in the main module. * increased version * Fixed syntax
- Loading branch information
Showing
15 changed files
with
121 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ import ( | |
) | ||
|
||
const ( | ||
ReleemAgentVersion = "1.12.0" | ||
ReleemAgentVersion = "1.13.0" | ||
) | ||
|
||
type Config struct { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.12.0 | ||
1.13.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package errors | ||
|
||
import ( | ||
"net/http" | ||
"strings" | ||
|
||
"github.com/Releem/mysqlconfigurer/config" | ||
"github.com/advantageous/go-logback/logging" | ||
|
||
"time" | ||
) | ||
|
||
type ReleemErrorsRepeater struct { | ||
logger logging.Logger | ||
configuration *config.Config | ||
} | ||
|
||
func (repeater ReleemErrorsRepeater) ProcessErrors(message string) interface{} { | ||
var env string | ||
bodyReader := strings.NewReader(message) | ||
|
||
repeater.logger.Debug("Result Send data: ", message) | ||
var api_domain string | ||
if repeater.configuration != nil { | ||
env = repeater.configuration.Env | ||
} else { | ||
env = "prod" | ||
} | ||
if env == "dev2" { | ||
api_domain = "https://api.dev2.releem.com/v2/events/saving_agent_errors_log" | ||
} else if env == "dev" { | ||
api_domain = "https://api.dev.releem.com/v2/events/saving_agent_errors_log" | ||
} else if env == "stage" { | ||
api_domain = "https://api.stage.releem.com/v2/events/saving_agent_errors_log" | ||
} else { | ||
api_domain = "https://api.releem.com/v2/events/saving_agent_errors_log" | ||
} | ||
req, err := http.NewRequest(http.MethodPost, api_domain, bodyReader) | ||
if err != nil { | ||
repeater.logger.Error("Request: could not create request: ", err) | ||
return nil | ||
} | ||
if repeater.configuration != nil { | ||
req.Header.Set("x-releem-api-key", repeater.configuration.ApiKey) | ||
} | ||
|
||
client := http.Client{ | ||
Timeout: 30 * time.Second, | ||
} | ||
|
||
res, err := client.Do(req) | ||
if err != nil { | ||
repeater.logger.Error("Request: error making http request: ", err) | ||
return nil | ||
} | ||
repeater.logger.Debug("Response: status code: ", res.StatusCode) | ||
return nil | ||
} | ||
|
||
func NewReleemErrorsRepeater(configuration *config.Config) ReleemErrorsRepeater { | ||
logger := logging.NewSimpleLogger("ReleemRepeaterMetrics") | ||
return ReleemErrorsRepeater{logger, configuration} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters