Last active
August 29, 2015 14:18
-
-
Save rolandshoemaker/14c5b35bd622cb1853fb to your computer and use it in GitHub Desktop.
activity monitor performance logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deliveryTimings := make(map[string]time.Time) | |
// Run forever. | |
for d := range deliveries { | |
if d.ReplyTo != "" { | |
deliveryTimings[fmt.Sprintf("%s:%s", d.CorrelationId, d.ReplyTo)] = time.Now() | |
} else { | |
rpcSent := deliveryTimings[fmt.Sprintf("%s:%s", d.CorrelationId, d.RoutingKey)] | |
if rpcSent != nil { | |
respTime := time.Since(rpcSent) | |
delete(deliveryTimings, fmt.Sprintf("%s:%s", d.CorrelationId, d.RoutingKey)) | |
fmt.Printf("RPC call [%s] from [%s] took %s\n", d.Type, d.RoutingKey, respTime) | |
} | |
} | |
// Pass each message to the Analysis Engine | |
err = ae.ProcessMessage(d) | |
if err != nil { | |
logger.Alert(fmt.Sprintf("Could not process message: %s", err)) | |
} else { | |
// Only ack the delivery we actually handled (ackMultiple=false) | |
const ackMultiple = false | |
d.Ack(ackMultiple) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment