Skip to content

Commit

Permalink
temp fix for frontend hanging
Browse files Browse the repository at this point in the history
when seeing trace detail page
  • Loading branch information
chris-ramon committed Feb 3, 2016
1 parent 40233de commit 38edc7b
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions influxdb_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ func (in *InfluxDBStore) Trace(id ID) (*Trace, error) {
if err != nil {
return nil, err
}
annotations, err := annotationsFromRow(&s)
if err != nil {
return trace, nil
}
span.Annotations = *annotations
if span.ID.IsRoot() && rootSpanSet {
return nil, errors.New("unexpected multiple root spans")
}
if span.ID.IsRoot() && !rootSpanSet {
isRootSpan = true
}
annotations, err := annotationsFromRow(&s, isRootSpan)
if err != nil {
return trace, nil
}
span.Annotations = *annotations
if isRootSpan { // root span.
trace.Span = *span
rootSpanSet = true
Expand Down Expand Up @@ -152,7 +152,7 @@ func (in *InfluxDBStore) Traces() ([]*Trace, error) {
if err != nil {
return nil, err
}
annotations, err := annotationsFromRow(&s)
annotations, err := annotationsFromRow(&s, true)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -192,7 +192,7 @@ func (in *InfluxDBStore) Traces() ([]*Trace, error) {
if err != nil {
return nil, err
}
annotations, err := annotationsFromRow(&s)
annotations, err := annotationsFromRow(&s, false)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -303,7 +303,7 @@ func (in *InfluxDBStore) init(server *influxDBServer.Server) error {
return nil
}

func annotationsFromRow(r *influxDBModels.Row) (*Annotations, error) {
func annotationsFromRow(r *influxDBModels.Row, isRootSpan bool) (*Annotations, error) {
// Actually an influxDBModels.Row represents a single InfluxDB serie.
// r.Values[n] is a slice containing span's annotation values.
var fields []interface{}
Expand Down Expand Up @@ -332,6 +332,9 @@ func annotationsFromRow(r *influxDBModels.Row) (*Annotations, error) {
default:
return nil, fmt.Errorf("unexpected field type: %v", reflect.TypeOf(field))
}
if isRootSpan && ignoreKey(key) {
continue
}
a := Annotation{
Key: key,
Value: value,
Expand All @@ -342,6 +345,16 @@ func annotationsFromRow(r *influxDBModels.Row) (*Annotations, error) {
return &annotations, nil
}

func ignoreKey(key string) bool {
keysToIgnore := []string{"_schema:HTTPClient"}
for _, k := range keysToIgnore {
if k == key {
return true
}
}
return false
}

func newSpanFromRow(r *influxDBModels.Row) (*Span, error) {
span := &Span{}
traceID, err := ParseID(r.Tags["trace_id"])
Expand Down

0 comments on commit 38edc7b

Please sign in to comment.