Selaa lähdekoodia

Merge pull request #222 from emqx/develop

Binary log issue
jinfahua 5 vuotta sitten
vanhempi
commit
8ac9a1ef97
3 muutettua tiedostoa jossa 8 lisäystä ja 4 poistoa
  1. 1 1
      common/util.go
  2. 2 2
      fvt_scripts/edgex_sink_rule.jmx
  3. 5 1
      xstream/extensions/edgex_source.go

+ 1 - 1
common/util.go

@@ -64,7 +64,7 @@ func init() {
 	Log.SetFormatter(&logrus.TextFormatter{
 	Log.SetFormatter(&logrus.TextFormatter{
 		CallerPrettyfier: func(f *runtime.Frame) (string, string) {
 		CallerPrettyfier: func(f *runtime.Frame) (string, string) {
 			filename := path.Base(f.File)
 			filename := path.Base(f.File)
-			return fmt.Sprintf("%s()", f.Function), fmt.Sprintf("%s:%d", filename, f.Line)
+			return "", fmt.Sprintf("%s:%d", filename, f.Line)
 		},
 		},
 		DisableColors: true,
 		DisableColors: true,
 		FullTimestamp: true,
 		FullTimestamp: true,

+ 2 - 2
fvt_scripts/edgex_sink_rule.jmx

@@ -420,7 +420,7 @@
           <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="device Assertion" enabled="true">
           <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="device Assertion" enabled="true">
             <stringProp name="JSON_PATH">$.device</stringProp>
             <stringProp name="JSON_PATH">$.device</stringProp>
             <stringProp name="EXPECTED_VALUE">demo</stringProp>
             <stringProp name="EXPECTED_VALUE">demo</stringProp>
-            <boolProp name="JSONVALIDATION">true</boolProp>
+            <boolProp name="JSONVALIDATION">false</boolProp>
             <boolProp name="EXPECT_NULL">false</boolProp>
             <boolProp name="EXPECT_NULL">false</boolProp>
             <boolProp name="INVERT">false</boolProp>
             <boolProp name="INVERT">false</boolProp>
             <boolProp name="ISREGEX">false</boolProp>
             <boolProp name="ISREGEX">false</boolProp>
@@ -429,7 +429,7 @@
           <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="humidity Assertion" enabled="true">
           <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="humidity Assertion" enabled="true">
             <stringProp name="JSON_PATH">$.readings[0].value</stringProp>
             <stringProp name="JSON_PATH">$.readings[0].value</stringProp>
             <stringProp name="EXPECTED_VALUE">81</stringProp>
             <stringProp name="EXPECTED_VALUE">81</stringProp>
-            <boolProp name="JSONVALIDATION">true</boolProp>
+            <boolProp name="JSONVALIDATION">false</boolProp>
             <boolProp name="EXPECT_NULL">false</boolProp>
             <boolProp name="EXPECT_NULL">false</boolProp>
             <boolProp name="INVERT">false</boolProp>
             <boolProp name="INVERT">false</boolProp>
             <boolProp name="ISREGEX">false</boolProp>
             <boolProp name="ISREGEX">false</boolProp>

+ 5 - 1
xstream/extensions/edgex_source.go

@@ -111,7 +111,11 @@ func (es *EdgexSource) Open(ctx api.StreamContext, consumer chan<- api.SourceTup
 				if strings.ToLower(env.ContentType) == "application/json" {
 				if strings.ToLower(env.ContentType) == "application/json" {
 					e := models.Event{}
 					e := models.Event{}
 					if err := e.UnmarshalJSON(env.Payload); err != nil {
 					if err := e.UnmarshalJSON(env.Payload); err != nil {
-						log.Warnf("payload %s unmarshal fail: %v", env.Payload, err)
+						len := len(env.Payload)
+						if len > 200 {
+							len = 200
+						}
+						log.Warnf("payload %s unmarshal fail: %v", env.Payload[0:(len - 1)], err)
 					} else {
 					} else {
 						result := make(map[string]interface{})
 						result := make(map[string]interface{})
 						meta := make(map[string]interface{})
 						meta := make(map[string]interface{})