Repository: incubator-htrace
Updated Branches:
  refs/heads/master bbce6bfbf -> 0cfab134a


HTRACE-24. htraced: process id should be a string (cmccabe)


Project: http://git-wip-us.apache.org/repos/asf/incubator-htrace/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-htrace/commit/0cfab134
Tree: http://git-wip-us.apache.org/repos/asf/incubator-htrace/tree/0cfab134
Diff: http://git-wip-us.apache.org/repos/asf/incubator-htrace/diff/0cfab134

Branch: refs/heads/master
Commit: 0cfab134a49c1eed4be5444d261177528a813835
Parents: bbce6bf
Author: Colin P. Mccabe <[email protected]>
Authored: Wed Dec 24 06:51:22 2014 -0800
Committer: Colin P. Mccabe <[email protected]>
Committed: Sun Dec 28 14:40:28 2014 -0800

----------------------------------------------------------------------
 htrace-core/src/go/src/org/apache/htrace/common/span.go      | 2 +-
 htrace-core/src/go/src/org/apache/htrace/common/span_test.go | 8 ++++----
 .../src/go/src/org/apache/htrace/htraced/datastore_test.go   | 6 +++---
 htrace-core/src/go/src/org/apache/htrace/test/random.go      | 3 ++-
 4 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/0cfab134/htrace-core/src/go/src/org/apache/htrace/common/span.go
----------------------------------------------------------------------
diff --git a/htrace-core/src/go/src/org/apache/htrace/common/span.go 
b/htrace-core/src/go/src/org/apache/htrace/common/span.go
index 6f67ce6..e682201 100644
--- a/htrace-core/src/go/src/org/apache/htrace/common/span.go
+++ b/htrace-core/src/go/src/org/apache/htrace/common/span.go
@@ -57,7 +57,7 @@ type SpanData struct {
        TraceId             int64                `json:"tid,string"`
        ParentId            int64                `json:"prid,string"`
        Info                TraceInfoMap         `json:"info,omitempty"`
-       ProcessId           int32                `json:"pid"`
+       ProcessId           string               `json:"pid"`
        TimelineAnnotations []TimelineAnnotation `json:"ta,omitempty"`
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/0cfab134/htrace-core/src/go/src/org/apache/htrace/common/span_test.go
----------------------------------------------------------------------
diff --git a/htrace-core/src/go/src/org/apache/htrace/common/span_test.go 
b/htrace-core/src/go/src/org/apache/htrace/common/span_test.go
index f3b65fc..deef5bf 100644
--- a/htrace-core/src/go/src/org/apache/htrace/common/span_test.go
+++ b/htrace-core/src/go/src/org/apache/htrace/common/span_test.go
@@ -32,10 +32,10 @@ func TestSpanToJson(t *testing.T) {
                        Description: "getFileDescriptors",
                        TraceId:     999,
                        ParentId:    INVALID_SPAN_ID,
-                       ProcessId:   331,
+                       ProcessId:   "testProcessId",
                }}
        ExpectStrEqual(t,
-               
`{"sid":"2305843009213693952","start":"123","stop":"456","desc":"getFileDescriptors","tid":"999","prid":"0","pid":331}`,
+               
`{"sid":"2305843009213693952","start":"123","stop":"456","desc":"getFileDescriptors","tid":"999","prid":"0","pid":"testProcessId"}`,
                string(span.ToJson()))
 }
 
@@ -48,7 +48,7 @@ func TestAnnotatedSpanToJson(t *testing.T) {
                        Description: "getFileDescriptors2",
                        TraceId:     999,
                        ParentId:    INVALID_SPAN_ID,
-                       ProcessId:   331,
+                       ProcessId:   "testAnnotatedProcessId",
                        TimelineAnnotations: []TimelineAnnotation{
                                TimelineAnnotation{
                                        Time: 7777,
@@ -61,6 +61,6 @@ func TestAnnotatedSpanToJson(t *testing.T) {
                        },
                }}
        ExpectStrEqual(t,
-               
`{"sid":"1305813009213693952","start":"1234","stop":"4567","desc":"getFileDescriptors2","tid":"999","prid":"0","pid":331,"ta":[{"time":"7777","msg":"contactedServer"},{"time":"8888","msg":"passedFd"}]}`,
+               
`{"sid":"1305813009213693952","start":"1234","stop":"4567","desc":"getFileDescriptors2","tid":"999","prid":"0","pid":"testAnnotatedProcessId","ta":[{"time":"7777","msg":"contactedServer"},{"time":"8888","msg":"passedFd"}]}`,
                string(span.ToJson()))
 }

http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/0cfab134/htrace-core/src/go/src/org/apache/htrace/htraced/datastore_test.go
----------------------------------------------------------------------
diff --git a/htrace-core/src/go/src/org/apache/htrace/htraced/datastore_test.go 
b/htrace-core/src/go/src/org/apache/htrace/htraced/datastore_test.go
index c74b572..bbfd688 100644
--- a/htrace-core/src/go/src/org/apache/htrace/htraced/datastore_test.go
+++ b/htrace-core/src/go/src/org/apache/htrace/htraced/datastore_test.go
@@ -45,7 +45,7 @@ var SIMPLE_TEST_SPANS []common.Span = []common.Span{
                        Description: "getFileDescriptors",
                        TraceId:     999,
                        ParentId:    common.INVALID_SPAN_ID,
-                       ProcessId:   331,
+                       ProcessId:   "firstd",
                }},
        common.Span{SpanId: 2,
                SpanData: common.SpanData{
@@ -54,7 +54,7 @@ var SIMPLE_TEST_SPANS []common.Span = []common.Span{
                        Description: "openFd",
                        TraceId:     999,
                        ParentId:    1,
-                       ProcessId:   332,
+                       ProcessId:   "secondd",
                }},
        common.Span{SpanId: 3,
                SpanData: common.SpanData{
@@ -63,7 +63,7 @@ var SIMPLE_TEST_SPANS []common.Span = []common.Span{
                        Description: "passFd",
                        TraceId:     999,
                        ParentId:    1,
-                       ProcessId:   332,
+                       ProcessId:   "thirdd",
                }},
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/0cfab134/htrace-core/src/go/src/org/apache/htrace/test/random.go
----------------------------------------------------------------------
diff --git a/htrace-core/src/go/src/org/apache/htrace/test/random.go 
b/htrace-core/src/go/src/org/apache/htrace/test/random.go
index 1272515..8605b70 100644
--- a/htrace-core/src/go/src/org/apache/htrace/test/random.go
+++ b/htrace-core/src/go/src/org/apache/htrace/test/random.go
@@ -20,6 +20,7 @@
 package test
 
 import (
+       "fmt"
        "math/rand"
        "org/apache/htrace/common"
 )
@@ -66,6 +67,6 @@ func NewRandomSpan(rnd *rand.Rand, potentialParents 
[]*common.Span) *common.Span
                        Description: "getFileDescriptors",
                        TraceId:     NonZeroRand64(rnd),
                        ParentId:    parentId,
-                       ProcessId:   NonZeroRand32(rnd),
+                       ProcessId:   fmt.Sprintf("process%d", 
NonZeroRand32(rnd)),
                }}
 }

Reply via email to