diff --git a/collector.go b/collector.go index 705e59c..29c438b 100644 --- a/collector.go +++ b/collector.go @@ -76,12 +76,10 @@ func (c *SuccintCollector) Collect(ch chan<- prometheus.Metric) { var proofs []SuccintProof if err := json.Unmarshal(body, &proofs); err != nil { - log.Fatalf("Error parsing JSON: %v", err) + level.Error(c.logger).Log("msg", "Error parsing JSON", "err", err) + return } - // Print result to verify - fmt.Printf("%+v\n", proofs) - c.processMetrics(proofs, ch) level.Debug(c.logger).Log("msg", "Stopped metrics collection") diff --git a/succint.go b/succint.go index ec13364..2c15603 100644 --- a/succint.go +++ b/succint.go @@ -1,73 +1,11 @@ package main -type ProofRequestData struct { - Input string `json:"input"` -} - -type ProofRequest struct { - Type string `json:"type"` - ReleaseID string `json:"releaseId"` - Data ProofRequestData `json:"data"` -} - -type Organization struct { - ID string `json:"id"` - OrgName string `json:"org_name"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` -} - -type Project struct { - ID string `json:"id"` - Name string `json:"name"` - GitAccountName string `json:"git_account_name"` - OrganizationID string `json:"organization_id"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` - Edges struct { - Organization Organization `json:"organization"` - } `json:"edges"` -} - -type Release struct { - ID string `json:"id"` - Number int `json:"number"` - ProjectID string `json:"project_id"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` - Edges struct { - Project Project `json:"project"` - } `json:"edges"` -} - -type Request struct { - ID string `json:"id"` - ChainID int `json:"chain_id"` - GatewayAddress string `json:"gateway_address"` - Sender string `json:"sender"` - Origin string `json:"origin"` - FunctionID string `json:"function_id"` - Input string `json:"input"` - CallbackAddress string `json:"callback_address"` - CallbackData string `json:"callback_data"` - CallbackGasLimit int `json:"callback_gas_limit"` - RequestType string `json:"request_type"` - Status string `json:"status"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` -} - -type Edges struct { - Release Release `json:"release"` - Requests []Request `json:"requests"` -} - type SuccintProof struct { - ID string `json:"id"` - Status string `json:"status"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` - ProofRequest ProofRequest `json:"proof_request"` - ProofRelease string `json:"proof_release"` - Edges Edges `json:"edges"` -} + ID string json:"id" + Status string json:"status" + CreatedAt string json:"created_at" + ProofRequest interface{} json:"proof_request" + ProofRelease interface{} json:"proof_release" + Edges interface{} json:"edges" + // Requests interface{} json:"requests" + } \ No newline at end of file