@@ -27,7 +27,7 @@ func StartTracingMode() {
2727}
2828
2929func IsStream (ctx context.Context ) bool {
30- common .ReportScouterPanic ()
30+ defer common .ReportScouterPanic ()
3131 if ctx == nil {
3232 return false
3333 }
@@ -39,7 +39,7 @@ func IsStream(ctx context.Context) bool {
3939}
4040
4141func SetAsStream (ctx context.Context ) bool {
42- common .ReportScouterPanic ()
42+ defer common .ReportScouterPanic ()
4343 if ctx == nil {
4444 return false
4545 }
@@ -52,7 +52,7 @@ func SetAsStream(ctx context.Context) bool {
5252}
5353
5454func MarkAsError (ctx context.Context , errorMessage string ) {
55- common .ReportScouterPanic ()
55+ defer common .ReportScouterPanic ()
5656 if ctx == nil {
5757 return
5858 }
@@ -67,7 +67,7 @@ func MarkAsError(ctx context.Context, errorMessage string) {
6767}
6868
6969func MarkAsErrorForcibly (ctx context.Context , errorMessage string ) {
70- common .ReportScouterPanic ()
70+ defer common .ReportScouterPanic ()
7171 if ctx == nil {
7272 return
7373 }
@@ -79,7 +79,7 @@ func MarkAsErrorForcibly(ctx context.Context, errorMessage string) {
7979}
8080
8181func SetServiceNameForcibly (ctx context.Context , serviceName string ) {
82- common .ReportScouterPanic ()
82+ defer common .ReportScouterPanic ()
8383 if ctx == nil {
8484 return
8585 }
@@ -192,7 +192,7 @@ func normalizeIp(ip string) string {
192192}
193193
194194func EndHttpService (ctx context.Context , req * http.Request , res * http.Response ) {
195- common .ReportScouterPanic ()
195+ defer common .ReportScouterPanic ()
196196 //TODO body (of specific service) profile from req.body
197197
198198 if res != nil {
@@ -209,7 +209,7 @@ func EndHttpService(ctx context.Context, req *http.Request, res *http.Response)
209209}
210210
211211func StartService (ctx context.Context , serviceName , remoteIp string ) (newCtx context.Context ) {
212- common .ReportScouterPanic ()
212+ defer common .ReportScouterPanic ()
213213 if ctx == nil {
214214 ctx = context .Background ()
215215 }
@@ -223,13 +223,13 @@ func StartService(ctx context.Context, serviceName, remoteIp string) (newCtx con
223223}
224224
225225func EndService (ctx context.Context ) {
226- common .ReportScouterPanic ()
226+ defer common .ReportScouterPanic ()
227227 endAnyService (ctx )
228228}
229229
230230func StartNewInheritanceService (ctx context.Context , parentTctx * netio.TraceContext ) (newCtx context.Context , newTctx * netio.TraceContext ) {
231231 //TODO ctx를 전달받지 않아야 될 것 같긴한데...
232- common .ReportScouterPanic ()
232+ defer common .ReportScouterPanic ()
233233 if ctx == nil {
234234 ctx = context .Background ()
235235 }
@@ -287,7 +287,7 @@ func inheritTctx(newTctx *netio.TraceContext, parentTctx *netio.TraceContext) *n
287287// myFunc(cascadeGoCtx)
288288//})
289289func GoWithTrace (ctx context.Context , serviceName string , func4Goroutine func (cascadeGoCtx context.Context )) {
290- common .ReportScouterPanic ()
290+ defer common .ReportScouterPanic ()
291291 newCtx , childTctx := startChildGoroutineService (ctx , serviceName )
292292 go func () {
293293 if childTctx != nil {
@@ -326,7 +326,7 @@ func startChildGoroutineService(ctx context.Context, serviceName string) (ctx4Go
326326}
327327
328328func endChildGoroutineService (ctx context.Context ) {
329- common .ReportScouterPanic ()
329+ defer common .ReportScouterPanic ()
330330 endAnyService (ctx )
331331}
332332
0 commit comments