Files
houston-be/cmd/main.go
Ajay Devarakonda 45fce5521f TP-55035 | Added alerts for conference event creation, fetching and deletion failures (#357)
* TP-38709 | Merging the changes to master on the logfix

* TP-55035 | Added alerts for failures while creating, fetching and deleting conference events

* TP-55035 | Fixed conflicts

* TP-55035 | trying guage metric to reset counter

* TP-55035 | Revertingn guage metrics
2024-01-23 18:51:56 +05:30

63 lines
1.6 KiB
Go

package main
import (
"github.com/prometheus/client_golang/prometheus"
"houston/appcontext"
"houston/cmd/app"
"houston/config"
"houston/internal/clients"
"houston/internal/metrics"
"houston/logger"
"os"
"time"
"github.com/spf13/viper"
ginzap "github.com/gin-contrib/zap"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"github.com/spf13/cobra"
"go.uber.org/zap"
)
func main() {
config.LoadHoustonConfig()
godotenv.Load()
logger.InitLogger()
appcontext.InitiateContext()
appcontext.InitializeServices()
prometheus.MustRegister(metrics.SlackChannelCreationFailureCounter, metrics.RCAGenerationFailureCounter, metrics.ConferenceFailureCounter)
command := &cobra.Command{
Use: "houston",
Short: "houston is replacement for blameless and incident management slackbot bot at Navi",
Long: "houston is replacement for blameless and incident management slackbot bot at Navi",
RunE: func(cmd *cobra.Command, args []string) error {
r := gin.New()
r.Use(ginzap.Ginzap(logger.GetLogger(), time.RFC3339, true))
r.Use(ginzap.RecoveryWithZap(logger.GetLogger(), true))
houston := r.Group("/houston")
httpClient := clients.NewHttpClient()
mjolnirClient := clients.NewMjolnirClient(
httpClient.HttpClient,
viper.GetString("mjolnir.service.url"),
viper.GetString("mjolnir.realm.id"),
)
sv := app.NewServer(r, appcontext.GetDB(), mjolnirClient)
sv.Handler(houston)
sv.Start()
return nil
},
}
if err := command.Execute(); err != nil {
logger.Error("houston core command execution failed", zap.Error(err))
os.Exit(1)
}
}