-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
- Loading branch information
1 parent
2b73fe9
commit dcdba0e
Showing
20 changed files
with
1,697 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// Copyright (c) 2017 The Jaeger Authors. | ||
// | ||
// Licensed 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 zipkin | ||
|
||
import ( | ||
"github.com/uber/jaeger/model" | ||
"github.com/uber/jaeger/swagger-gen/models" | ||
"github.com/uber/jaeger/thrift-gen/zipkincore" | ||
) | ||
|
||
func spansV2ToThrift(spans *models.ListOfSpans) ([]*zipkincore.Span, error) { | ||
var tSpans []*zipkincore.Span | ||
for _, span := range *spans { | ||
tSpan, err := spanV2ToThrift(*span) | ||
if err != nil { | ||
return nil, err | ||
} | ||
tSpans = append(tSpans, tSpan) | ||
} | ||
return tSpans, nil | ||
|
||
return nil, nil | ||
} | ||
|
||
func spanV2ToThrift(s models.Span) (*zipkincore.Span, error) { | ||
id, err := model.SpanIDFromString(cutLongID(*s.ID)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
traceID, err := model.TraceIDFromString(*s.TraceID) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
tSpan := &zipkincore.Span{ | ||
ID: int64(id), | ||
TraceID: int64(traceID.Low), | ||
Name: s.Name, | ||
Debug: s.Debug, | ||
Timestamp: &s.Timestamp, | ||
Duration: &s.Duration, | ||
} | ||
|
||
if len(s.ParentID) > 0 { | ||
parentID, err := model.SpanIDFromString(cutLongID(s.ParentID)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
signed := int64(parentID) | ||
tSpan.ParentID = &signed | ||
} | ||
|
||
for _, a := range s.Annotations { | ||
tA, err := annToThrift(a) | ||
if err != nil { | ||
return nil, err | ||
} | ||
tSpan.Annotations = append(tSpan.Annotations, tA) | ||
} | ||
|
||
for k, v := range s.Tags { | ||
ba := &zipkincore.BinaryAnnotation{ | ||
Key: k, | ||
Value: []byte(v), | ||
AnnotationType: zipkincore.AnnotationType_STRING, | ||
// TODO endpoint | ||
} | ||
tSpan.BinaryAnnotations = append(tSpan.BinaryAnnotations, ba) | ||
} | ||
|
||
// TODO | ||
//s.Kind | ||
//s.LocalEndpoint | ||
//s.RemoteEndpoint | ||
|
||
return tSpan, nil | ||
} | ||
|
||
func annToThrift(a *models.Annotation) (*zipkincore.Annotation, error) { | ||
ta := &zipkincore.Annotation{ | ||
Value: a.Value, | ||
Timestamp: a.Timestamp, | ||
// TODO host - endpoint | ||
} | ||
|
||
return ta, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.