9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/tnw/internal/metric_samples_controller.rb', line 9
def create
raise_payload_too_large! if request.content_length.to_i > MAX_PAYLOAD_BYTES
raw_body = request.raw_post
raise_payload_too_large! if raw_body.bytesize > MAX_PAYLOAD_BYTES
verify_request!(raw_body)
sample = Tnw::MetricSamples::Ingest.new(
payload: JSON.parse(raw_body),
source_ip: request.remote_ip
).call
render json: { status: "accepted", sample_id: sample.id }, status: :created
end
|