fix lost trace when multi middleware handlerFunc (#167)

diff --git a/CHANGES.md b/CHANGES.md
index 88dc93a..9cf0395 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -22,6 +22,7 @@
 * Fix enhance method error when unknown parameter type.
 * Fix wrong tracing context when trace have been sampled.
 * Fix enhance param error when there are multiple params.
+* Fix lost trace when multi middleware `handlerFunc` in `gin` plugin.
 
 #### Issues and PR
 - All issues are [here](https://github.com/apache/skywalking/milestone/197?closed=1)
diff --git a/plugins/gin/intercepter.go b/plugins/gin/intercepter.go
index 653f305..af07621 100644
--- a/plugins/gin/intercepter.go
+++ b/plugins/gin/intercepter.go
@@ -30,6 +30,9 @@
 }
 
 func (h *ContextInterceptor) BeforeInvoke(invocation operator.Invocation) error {
+	if !isFirstHandle(invocation.CallerInstance()) {
+		return nil
+	}
 	context := invocation.CallerInstance().(*gin.Context)
 	s, err := tracing.CreateEntrySpan(
 		fmt.Sprintf("%s:%s", context.Request.Method, context.FullPath()), func(headerKey string) (string, error) {
@@ -59,3 +62,11 @@
 	span.End()
 	return nil
 }
+
+func isFirstHandle(c interface{}) bool {
+	// index of HandlersChain, incremented in #Next(), -1 indicates that no handler has been executed
+	if context, ok := c.(*nativeContext); ok {
+		return context.index < 0
+	}
+	return true
+}
diff --git a/plugins/gin/structures.go b/plugins/gin/structures.go
new file mode 100644
index 0000000..1477725
--- /dev/null
+++ b/plugins/gin/structures.go
@@ -0,0 +1,23 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package gin
+
+//skywalking:native github.com/gin-gonic/gin Context
+type nativeContext struct {
+	index int8
+}