[ 
https://issues.apache.org/jira/browse/HTRACE-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15606305#comment-15606305
 ] 

Colin P. McCabe commented on HTRACE-392:
----------------------------------------

Yeah, putting spans in a hash map as values is totally reasonable.  What I 
meant to say was that Spans as hash map _keys_ seemed a little weird to me.  It 
wasn't obvious to me what the hash function should be for that.  That's why we 
did implement equals and hashCode for the SpanId class, so that you could do 
{{HashMap<SpanId, Span>}}

bq. instead of implementing e/hc we could also make Span implement Comparable 
and order by SpanId? Implementing equality based on id seems fine though.

Maybe.  I'm not sure if this would help users or not, though... when you want 
to compare spans, writing a comparator is pretty simple.

I guess what it comes down to is that you can compare spans a lot of different 
ways (starting time, ending time, duration, etc).  I'm not sure that comparing 
by span id is more intuitive than those other ways.

> MilliSpan does not implement equals and hashcode
> ------------------------------------------------
>
>                 Key: HTRACE-392
>                 URL: https://issues.apache.org/jira/browse/HTRACE-392
>             Project: HTrace
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 4.2
>            Reporter: Mike Drob
>
> MilliSpan does not implement equal and hashcode, which can make test fixtures 
> unnecessarily brittle when doing comparisons.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to