Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed zipkin-web to actually return values from servers #68

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions zipkin-web/app/controllers/traces_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,18 @@ def spans_json

def top_annotations
service_name = params[:service_name] || ""
top_annotations = ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
client.getTopAnnotations(service_name)
top_annotations = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
top_annotations = client.getTopAnnotations(service_name)
end
render :json => top_annotations || []
end

def top_kv_annotations
service_name = params[:service_name] || ""
top_annotations = ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
client.getTopKeyValueAnnotations(service_name)
top_annotations = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
top_annotations = client.getTopKeyValueAnnotations(service_name)
end
render :json => top_annotations || []
end
Expand Down
14 changes: 10 additions & 4 deletions zipkin-web/app/models/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,33 @@ def self.get_trace_ids_by_span_name(service_name, span_name, end_ts, limit, opts
end_ts = secondsToMicroseconds(end_ts)
order = opts[:order] || ORDER_DEFAULT

tmp = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
client.getTraceIdsBySpanName(service_name, span_name, end_ts, limit, order)
tmp = client.getTraceIdsBySpanName(service_name, span_name, end_ts, limit, order)
end
tmp
end

def self.get_trace_ids_by_service_name(service_name, end_ts, limit, opts = {})
end_ts = secondsToMicroseconds(end_ts)
order = opts[:order] || ORDER_DEFAULT

tmp = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
client.getTraceIdsByServiceName(service_name, end_ts, limit, order)
tmp = client.getTraceIdsByServiceName(service_name, end_ts, limit, order)
end
tmp
end

def self.get_trace_ids_by_annotation(service_name, annotation, value, end_ts, limit, opts = {})
end_ts = secondsToMicroseconds(end_ts)
order = opts[:order] || ORDER_DEFAULT

tmp = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
client.getTraceIdsByAnnotation(service_name, annotation, value, end_ts, limit, order)
tmp = client.getTraceIdsByAnnotation(service_name, annotation, value, end_ts, limit, order)
end
tmp
end

private
Expand All @@ -52,4 +58,4 @@ def self.secondsToMicroseconds(end_time)
return end_time.to_i * 1000 * 1000
end

end
end
10 changes: 7 additions & 3 deletions zipkin-web/app/models/names.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@
class Names

def self.get_service_names
tmp = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
client.getServiceNames().sort
tmp = client.getServiceNames().sort
end
tmp
end

def self.get_span_names(service_name)
tmp = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
client.getSpanNames(service_name).sort
tmp = client.getSpanNames(service_name).sort
end
tmp
end

end
end
6 changes: 4 additions & 2 deletions zipkin-web/app/models/trace_combo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ def initialize(trace, summary, timeline, span_depths)
end

def self.get_trace_combos_by_ids(trace_ids, adjusters, opts = {})
tmp = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
combos = client.getTraceCombosByIds(trace_ids.collect { |id| id.to_i }, adjusters)
combos.collect { |combo| TraceCombo.from_thrift(combo) }
tmp = combos.collect { |combo| TraceCombo.from_thrift(combo) }
end
tmp
end

end
end
6 changes: 4 additions & 2 deletions zipkin-web/app/models/trace_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ def initialize(trace_id, start_timestamp, end_timestamp, duration_micro, service
end

def self.get_trace_summaries_by_ids(trace_ids, adjusters, opts={})
tmp = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
ids = trace_ids.collect { |id| id.to_i }
summaries = client.getTraceSummariesByIds(ids, adjusters)
summaries.collect { |summary| TraceSummary.from_thrift(summary) }
tmp = summaries.collect { |summary| TraceSummary.from_thrift(summary) }
end
tmp
end

def start_timestamp_ms
Expand Down Expand Up @@ -108,4 +110,4 @@ def as_json(opts={})
}
end

end
end
6 changes: 4 additions & 2 deletions zipkin-web/app/models/trace_timeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ def initialize(trace_id, root_most_span_id, annotations, binary_annotations)
end

def self.get_trace_timelines_by_ids(trace_ids, opts = {})
tmp = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
adjusters = [] # [Zipkin::Adjust::TIME_SKEW] #TODO config
ids = trace_ids.collect { |id| id.to_i }
timelines = client.getTraceTimelinesByIds(ids, adjusters)
timelines.collect { |timeline| TraceTimeline.from_thrift(timeline) }
tmp = timelines.collect { |timeline| TraceTimeline.from_thrift(timeline) }
end
tmp
end

def start_timestamp
Expand Down Expand Up @@ -132,4 +134,4 @@ def as_json(opts={})
}
end
end
end
end
6 changes: 4 additions & 2 deletions zipkin-web/app/models/ztrace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@ def as_json(opts={})
end

def self.get_traces_by_ids(trace_ids, opts = {})
tmp = nil
ZipkinQuery::Client.with_transport(Rails.configuration.zookeeper) do |client|
adjusters = [] #[Zipkin::Adjust::TIME_SKEW] #TODO config
traces = client.getTracesByIds(trace_ids.collect { |id| id.to_i }, adjusters)
traces.collect { |trace| ZTrace.from_thrift(trace) }
tmp = traces.collect { |trace| ZTrace.from_thrift(trace) }
end
tmp
end

# what is the default ttl we set traces to?
Expand Down Expand Up @@ -156,4 +158,4 @@ def span_depth_rc(all_spans, depth, id)
end
rv
end
end
end