Skip to content

Commit

Permalink
comments removed
Browse files Browse the repository at this point in the history
  • Loading branch information
an1l4 committed Mar 4, 2024
1 parent 4de4ab7 commit 48df320
Showing 1 changed file with 0 additions and 79 deletions.
79 changes: 0 additions & 79 deletions client/pkg/clickhouse/db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1035,85 +1035,6 @@ func (c *DBClient) InsertTrivySbomMetrics(metrics model.Sbom) {
stmt.Close()
}

// func (c *DBClient) InsertTrivySbomMetrics(metrics model.Sbom) {
// //opentelemetry
// opentelconfig, err := opentelemetry.GetConfigurations()
// if err != nil {
// log.Println("Unable to read open telemetry configurations")
// }
// if opentelconfig.IsEnabled {
// ctx := context.Background()
// tracer := otel.Tracer("insert-trivy-sbom")
// _, span := tracer.Start(opentelemetry.BuildContext(ctx), "InsertTrivySbomMetrics")
// defer span.End()
// }

// tx, err := c.conn.Begin()
// if err != nil {
// log.Fatalf("error beginning transaction, clickhouse connection not available: %v", err)
// }
// stmt, err := tx.Prepare(InsertTrivySbom)
// if err != nil {
// log.Fatalf("error preparing statement: %v", err)
// }

// data := metrics.Report
// bomComponents, ok := data["components"].([]interface{})
// if !ok {
// log.Println("error: components not found or not in expected format")
// }
// var componentName, bomRef, serialNumber, bomFormat, purl, componentType string
// var version int32
// // Iterate over the components to find the desired name
// for _, component := range bomComponents {
// componentMap, ok := component.(map[string]interface{})
// if !ok {
// log.Println("error: component not in expected format")
// continue
// }
// if name, ok := componentMap["name"].(string); ok {
// componentName = name
// break
// }
// }
// metadata, ok := data["metadata"].(map[string]interface{})
// if !ok {
// log.Println("error: metadata not found or not in expected format")
// return
// }

// component, ok := metadata["component"].(map[string]interface{})
// if !ok {
// log.Println("error: component not found or not in expected format")
// return
// }

// bomRef, _ = component["bom-ref"].(string)
// purl, _ = component["purl"].(string)
// componentType, _ = component["type"].(string)

// serialNumber, _ = data["serialNumber"].(string)
// version, _ = data["version"].(int32)
// bomFormat, _ = data["bomFormat"].(string)

// if _, err := stmt.Exec(
// metrics.ID,
// metrics.ClusterName,
// componentName,
// componentType,
// purl,
// bomRef,
// serialNumber,
// int32(version),
// bomFormat,
// ); err != nil {
// log.Fatal(err)
// }
// if err := tx.Commit(); err != nil {
// log.Fatal(err)
// }
// stmt.Close()
// }
func (c *DBClient) Close() {
_ = c.conn.Close()
}
Expand Down

0 comments on commit 48df320

Please sign in to comment.