The following lines might help. Place them somewhere in your code.
Once the simulation ends you can process the list and get the average line length you need.
def monitor(env, data, resource): while True:
item = (
resource._env.now, # The current simulation time
resource.count, # The number of users
len(resource.queue), # The number of queued processes
)
data.append(item)
yield env.timeout(1) #monitor every 1 time unit
data = [] #list with collected data
env.process(monitor(env, data, resource)) # define the resource to monitor