###
### Stress test for stress_zipkin2.trace_by_service_span table
###
### Stress testing is done using the `cassandra-stress` tool
###
### For example
###  cqlsh -f zipkin2-test-schema.cql
###  cassandra-stress  user profile=trace_by_service_span-stress.yaml ops\(insert=1\) no-warmup duration=1m  -rate threads=4 throttle=50/s
###
### after a benchmark has been run with only writes, a mixed read-write benchmark can be run with
###  cassandra-stress  user profile=trace_by_service_span-stress.yaml ops\(insert=1,select=1,by_duration=1\)  duration=1m  -rate threads=4 throttle=50/s

# Keyspace Name
keyspace: stress_zipkin2

# Table name
table: trace_by_service_span


### Column Distribution Specifications ###

columnspec:
  - name: service
    size: uniform(5..20)
    population: uniform(1..100)

  - name: span
    size: uniform(5..20)
    population: uniform(1..100)

  - name: bucket
    size: fixed(12)
    population: fixed(123456789012)

  - name: ts
    size: fixed(12)
    population: uniform(1..10k)

  - name: trace_id
    size: fixed(32)
    population: uniform(1..10k)

  - name: duration
    size: fixed(12)
    population: uniform(1..10k)



### Batch Ratio Distribution Specifications ###

insert:
  partitions: fixed(1)            # 1 partition key at a time inserts to model a message being generated
  select:  fixed(1)/1000
  batchtype: UNLOGGED             # Unlogged batches


#
# A set of basic queries
#
queries:
   select:
    cql: SELECT * FROM trace_by_service_span WHERE service = ? AND span = ? AND bucket = ? LIMIT 1
    fields: samerow
   by_duration:
    cql: SELECT * FROM trace_by_service_span WHERE service = ? AND span = ? AND bucket = ? AND duration < ? LIMIT 1
    fields: samerow

# TODO: adrian doesn't know how to make a timestamp range query from test data
# search by timestamp range,
# search by timestamp range and duration
