Skip to content

Commit

Permalink
Merge pull request #45 from yuyiguo/countings
Browse files Browse the repository at this point in the history
fixed counting for tracer made.
  • Loading branch information
yuyiguo authored Sep 24, 2021
2 parents 06f3ab9 + 18e917d commit 759bd6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions stompserver/fwjrTracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ func FWJRtrace(msg *stomp.Message) ([]string, error) {
log.Println("\n", string(data))
log.Println("******** Done Rucio trace record *************")
}
// a good trace made
Traces.Inc()
// send data to Stomp endpoint
if Config.EndpointProducer != "" {
err := stompMgr.Send(data, stomp.SendOpt.Header("appversion", "fwjrAMQ"))
Expand Down
20 changes: 10 additions & 10 deletions stompserver/traceMaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,21 @@ func traceSender(msg *stomp.Message, topic string) ([]string, error) {
log.Printf("Unable to marshal back to JSON string, error: %v \n", err)
}
dids = append(dids, fmt.Sprintf("%v", trc.DID))
continue
}
if Config.Verbose > 2 {
log.Printf("********* Rucio trace record from %s ***************\n", topic)
log.Println("\n" + string(data))
log.Printf("\n******** Done Rucio trace record from %s *************\n", topic)
}
// a good trace made
if topic == "xrtd" {
Traces_xrtd.Inc()
} else if topic == "swpop" {
Traces_swpop.Inc()
} else {
log.Fatalf(" Topic %s is not supported. \n", topic)
}
// send data to Stomp endpoint
if Config.EndpointProducer != "" {
err := stompMgr.Send(data, stomp.SendOpt.Header("appversion", "xrootdAMQ"))
Expand Down Expand Up @@ -275,18 +284,9 @@ func traceServer(topic string) {
dids, err = traceSender(msg, topic)
}
if err == nil {
if topic == "fwjr" {
Traces.Inc()
} else if topic == "xrtd" {
Traces_xrtd.Inc()
} else if topic == "swpop" {
Traces_swpop.Inc()
} else {
log.Fatalf(" Topic %s is not supported. \n", topic)
}
atomic.AddUint64(&tc, 1)
if Config.Verbose > 1 {
log.Println("The number of traces processed in 1000 group: ", atomic.LoadUint64(&tc))
log.Println("The number of messages processed in 1000 group: ", atomic.LoadUint64(&tc))
}
}

Expand Down

0 comments on commit 759bd6f

Please sign in to comment.