Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
feat: record _all_ attempts, not just one per protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Aug 29, 2023
1 parent 3136b90 commit 97897ce
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions metrics/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,27 +169,17 @@ func (m *Metrics) HandleAggregatedEvent(ctx context.Context,
protocolSucceeded string) {
m.totalRequestCount.Add(ctx, 1)
failureCount := 0
var recordedGraphSync, recordedBitswap, recordedHttp bool
var lowestTTFB time.Duration
var lowestTTFBProtocol string
for storageProviderID, attempt := range attempts {
protocolAttempted := protocolFromMulticodecString(attempt.Protocol)
switch protocolAttempted {
case ProtocolBitswap:
if !recordedBitswap {
recordedBitswap = true
m.requestWithBitswapAttempt.Add(ctx, 1, attribute.String("protocol", "bitswap"))
}
m.requestWithBitswapAttempt.Add(ctx, 1, attribute.String("protocol", "bitswap"))
case ProtocolGraphsync:
if !recordedGraphSync {
recordedGraphSync = true
m.requestWithGraphSyncAttempt.Add(ctx, 1, attribute.String("protocol", "graphsync"), attribute.String("sp_id", storageProviderID), attribute.String("fil_sp_id", attempt.FilSPID))
}
m.requestWithGraphSyncAttempt.Add(ctx, 1, attribute.String("protocol", "graphsync"), attribute.String("sp_id", storageProviderID), attribute.String("fil_sp_id", attempt.FilSPID))
case ProtocolHttp:
if !recordedHttp {
recordedHttp = true
m.requestWithHttpAttempt.Add(ctx, 1, attribute.String("protocol", "http"), attribute.String("sp_id", storageProviderID), attribute.String("fil_sp_id", attempt.FilSPID))
}
m.requestWithHttpAttempt.Add(ctx, 1, attribute.String("protocol", "http"), attribute.String("sp_id", storageProviderID), attribute.String("fil_sp_id", attempt.FilSPID))
}
if attempt.Error != "" {
switch protocolAttempted {
Expand Down

0 comments on commit 97897ce

Please sign in to comment.