- 
                Notifications
    
You must be signed in to change notification settings  - Fork 8
 
[FEATURE] [internal] adds metric collection for state change operations #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
        
          
                internal/data/statechanges.go
              
                Outdated
          
        
      | ) | ||
| duration := time.Since(start).Seconds() | ||
| m.MetricsService.ObserveDBQueryDuration("INSERT", "state_changes", duration) | ||
| m.MetricsService.ObserveStateChangePersistenceDuration(duration) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think we should remove the ObserveStateChangePersistenceDuration since that is basically the same as the ObserveDBQueryDuration for insertion of state changes and is already being tracked in the DB metrics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed in a831af9
| operation = *correctOp | ||
| } | ||
| // For fee state changes (OperationID == 0), operation remains zero value | ||
| buffer.PushStateChange(*dataTx, operation, stateChange) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What makes sense is to track the count of different types of state changes created: category, type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added counts by category in 46eb13f
| return nil, fmt.Errorf("batch inserting state changes: %w", err) | ||
| } | ||
| m.MetricsService.IncDBQuery("INSERT", "state_changes") | ||
| m.MetricsService.IncStateChangesPersisted(len(insertedIDs)) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THis metric can be moved to the indexer.go file where we should also track the different types and categories of state changes apart from the total state changes created
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved the total to the indexer in 46eb13f
        
          
                internal/data/statechanges.go
              
                Outdated
          
        
      | m.MetricsService.ObserveDBQueryDuration("INSERT", "state_changes", duration) | ||
| m.MetricsService.ObserveStateChangePersistenceDuration(duration) | ||
| if err != nil { | ||
| m.MetricsService.IncStateChangePersistenceErrors("insert_error") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also remove this metric since we are already tracking it via the db error metrics:
m.MetricsService.IncDBQueryError("BatchInsert", "state_changes", utils.GetDBErrorType(err))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed in a831af9
Closes #342
What
adds metric collection for state change operations
Why
To support initial deployment and observability
Known limitations
N/A
#342
Checklist
PR Structure
allif the changes are broad or impact many packages.Thoroughness
Release