# frozen_string_literal: true

class TracesController < ApplicationController
  def index
    traces = Trace
      .includes(:spans)
      .includes(:application)
      .where(origin: nil)
      .order(start: :desc)
      .limit(200)

    render locals: {traces: traces}
  end

  def show
    trace = Trace.find params[:id]

    render locals: {trace: trace}
  end
end

# frozen_string_literal: true

class TracesController < ApplicationController
  def index
    traces = Trace
      .includes(:spans)
      .includes(:application)
      .where(origin: nil)
      .order(stop: :desc)
      .limit(500)

    render locals: {traces: traces}
  end

  def show
    trace = Trace.find params[:id]

    render locals: {trace: trace}
  end
end

Change trace sorting in UI
Change trace sorting in UI

Traces are not sorted by stop date instead of start date to avoid
having slow requests not being shown because start date is already
late by too many other traces.
