perfsonar / esmond

A measurement archive for collecting time series metrics from networks.
Other
10 stars 9 forks source link

Reject archives with null source/destination #95

Open candlerb opened 5 years ago

candlerb commented 5 years ago

Relates to https://github.com/perfsonar/pscheduler/issues/909

In unusual circumstances where pscheduler submits metadata with "source": null and "measurement-agent": null, an invalid archive is created with "event-types": [], but esmond still returns a 201 response as if everything was OK. Also, subsequent data posts to this archive return 201 responses, but don't store any data. This means that user-visible pscheduler logs say that everything is working fine.

I think both cases should give 4xx responses. To reproduce:

$ cat test.json
{
  "time-duration": 29.0,
  "pscheduler-reference-psconfig-created-by-user-agent": "psconfig-pscheduler-agent",
  "pscheduler-test-type": "throughput",
  "source": null,
  "measurement-agent": null,
  "input-destination": "2001:db8:123:456::45",
  "destination": "2001:db8:123:456::45",
  "event-types": [
    {
      "event-type": "failures"
    },
    {
      "summaries": [
        {
          "summary-type": "average",
          "summary-window": 86400,
          "event-type": "throughput"
        }
      ],
      "event-type": "throughput"
    },
    {
      "event-type": "throughput-subintervals"
    },
    {
      "event-type": "packet-retransmits"
    },
    {
      "event-type": "packet-retransmits-subintervals"
    },
    {
      "event-type": "pscheduler-run-href"
    }
  ],
  "subject-type": "point-to-point",
  "ip-transport-protocol": "tcp",
  "input-source": "ns1.example.com",
  "pscheduler-reference-psconfig-created-by-uuid": "b042dea5-40fd-4c63-9b0b-1e0f63bf59a6",
  "tool-name": "pscheduler/iperf3"
}

$ curl -sk -H "Content-Type: application/json" -H "Authorization: Token xxxx" \
    -X POST -d @test.json https://localhost/esmond/perfsonar/archive/
{"url":"https://localhost/esmond/perfsonar/archive/ff6a9054a2b344c59196c26fb3c0d662/"
"metadata-key":"ff6a9054a2b344c59196c26fb3c0d662",
"subject-type":"point-to-point",
"event-types":[],
"uri":"/esmond/perfsonar/archive/ff6a9054a2b344c59196c26fb3c0d662/"}

Notice the empty event-types member.

laeti-tia commented 4 years ago

I've experienced this behaviour too when looking at https://github.com/perfsonar/pscheduler/issues/958 which has measurement-agent: None being sent to Esmond.