Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nithunikzz committed Apr 15, 2024
1 parent 29cf584 commit 291b2df
Showing 1 changed file with 75 additions and 15 deletions.
90 changes: 75 additions & 15 deletions client/pkg/clients/bridge_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.RepoName = pl.Resource.Repository.Name
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertAzureDevops)
err = conn.InsertGitCommon(gca, dbstatement.InsertAzureDevops)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted AzureDevops metrics:", string(msg.Data))
log.Println()
case string(azuremodel.GitPullRequestMergedEventType):
Expand All @@ -121,7 +125,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.RepoName = pl.Resource.Repository.Name
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertAzureDevops)
err = conn.InsertGitCommon(gca, dbstatement.InsertAzureDevops)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted AzureDevops metrics:", string(msg.Data))
log.Println()
default:
Expand All @@ -134,7 +142,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.EventType = event
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertAzureDevops)
err := conn.InsertGitCommon(gca, dbstatement.InsertAzureDevops)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted GitHub metrics:", string(msg.Data))
log.Println()
}
Expand Down Expand Up @@ -168,7 +180,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.RepoName = pl.Repository.Name
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertGithub)
err = conn.InsertGitCommon(gca, dbstatement.InsertGithub)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted GitHub metrics:", string(msg.Data))
log.Println()
case string(github.PullRequestEvent):
Expand All @@ -192,7 +208,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.RepoName = pl.Repository.Name
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertGithub)
err := conn.InsertGitCommon(gca, dbstatement.InsertGithub)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted GitHub metrics:", string(msg.Data))
log.Println()
}
Expand All @@ -206,7 +226,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.EventType = event
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertGithub)
err := conn.InsertGitCommon(gca, dbstatement.InsertGithub)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted GitHub metrics:", string(msg.Data))
log.Println()
}
Expand All @@ -232,7 +256,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.RepoName = pl.Repo.Name
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertGitea)
err = conn.InsertGitCommon(gca, dbstatement.InsertGitea)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted Gitea metrics:", string(msg.Data))
log.Println()
case string(gitea.PullRequestEvent):
Expand Down Expand Up @@ -266,7 +294,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
}
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertGitea)
err := conn.InsertGitCommon(gca, dbstatement.InsertGitea)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted Gitea metrics:", string(msg.Data))
log.Println()
}
Expand All @@ -279,7 +311,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.TimeStamp = time.Now().UTC()
gca.RepoName = ""
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertGitea)
err := conn.InsertGitCommon(gca, dbstatement.InsertGitea)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted Gitea metrics:", string(msg.Data))
log.Println()
}
Expand All @@ -305,7 +341,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.RepoName = pl.Project.Name
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertGitlab)
err = conn.InsertGitCommon(gca, dbstatement.InsertGitlab)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted Gitlab metrics:", string(msg.Data))
log.Println()
case string(gitlab.MergeRequestEvents):
Expand All @@ -325,7 +365,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.RepoName = pl.Project.Name
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertGitlab)
err = conn.InsertGitCommon(gca, dbstatement.InsertGitlab)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted Gitlab metrics:", string(msg.Data))
log.Println()
}
Expand All @@ -339,7 +383,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.TimeStamp = time.Now().UTC()
gca.RepoName = ""
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertGitlab)
err := conn.InsertGitCommon(gca, dbstatement.InsertGitlab)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted Gitlab metrics:", string(msg.Data))
log.Println()
}
Expand All @@ -366,7 +414,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.RepoName = pl.Repository.Name
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertBitbucket)
err = conn.InsertGitCommon(gca, dbstatement.InsertBitbucket)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted BitBucket metrics:", string(msg.Data))
log.Println()
case string(bitbucket.PullRequestMergedEvent):
Expand All @@ -385,7 +437,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.RepoName = pl.Repository.Name
gca.TimeStamp = time.Now().UTC()
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertBitbucket)
err = conn.InsertGitCommon(gca, dbstatement.InsertBitbucket)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted BitBucket metrics:", string(msg.Data))
log.Println()
default:
Expand All @@ -398,7 +454,11 @@ func (n *NATSContext) SubscribeGitBridgeNats(conn clickhouse.DBInterface) {
gca.TimeStamp = time.Now().UTC()
gca.RepoName = ""
gca.Event = string(msg.Data)
conn.InsertGitCommon(gca, dbstatement.InsertBitbucket)
err := conn.InsertGitCommon(gca, dbstatement.InsertBitbucket)
if err != nil {
log.Println("error occurred while connecting the payload Error:")

}
log.Println("Inserted BitBucket metrics:", string(msg.Data))
log.Println()
}
Expand Down

0 comments on commit 291b2df

Please sign in to comment.