Commit Graph

5 Commits

Author SHA1 Message Date
Xander Moffatt 044a8cd8d9 change pandata events API call from job to thread
why
* queuing such a large number of jobs at once locked up the DB
* the reason to put it in a job was to move the HTTP request
out of the main request cycle
* threads can accomplish that without overwhelming the jobs infra

closes INTEROP-8331
flag=none

test plan:
* copy pandata_events blocks from config/dynamic_settings.yml.example
and vault_contents.yml.example to the real config files,
and remove comments
* change `enabled` to `true` in the YML file
* run a small server that can accept and log POST requests
* change the `url` in the YML file to point to that server
* restart your web container, make sure jobs are running
* in a rails console:
```ruby
PandataEvents.send_event('test', {foo: 'bar'}, for_user_id: 1)
```
* your server should have received a POST request with a body that looks
something like:
```
{"timestamp":"2023-11-28T18:31:31Z","eventType":"test",
  "appTag":"CANVAS","properties":{"foo":"bar"}}
```
* and has a JWT in the Authorization header

Change-Id: Ie44a98ab36ccd09558a3e21698c4e252bf95b643
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/344419
Reviewed-by: Keith Garner <kgarner@instructure.com>
Reviewed-by: Paul Gray <paul.gray@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Paul Gray <paul.gray@instructure.com>
Product-Review: Paul Gray <paul.gray@instructure.com>
2024-04-08 19:21:40 +00:00
Xander Moffatt 7c9fca8f13 fix: structure PandataEvents body correctly
why:
* PandataEvents expects an array of events, not just one

refs INTEROP-8391
flag=none

test plan:
* specs

Change-Id: Icf3aeb717429bcfe7f188f851745a5b87c53f4cc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/338505
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
QA-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2024-01-25 22:08:41 +00:00
Xander Moffatt 0e025e2f5f log PandataEvents errors to datadog
why:
* if the HTTP request to PandataEvents fails, we need
to know about it somehow
* with datadog we won't get specific exceptions, but can be alerted to
high numbers of errors (ie if PandataEvents goes down) and can check
the error manually

closes INTEROP-8396
flag=none

test plan:
* specs

Change-Id: I3d581f1c9ca5fac5e5d84d64da83b19b6eac5722
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/337414
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
QA-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2024-01-22 17:41:08 +00:00
Xander Moffatt c8f5378993 support sending PandataEvents from Canvas
why
* to allow any parts of Canvas to send arbitrary events
to the PandataEvents system, which allows us to query
that data from S3 later
* specifically, to facilitate logging LTI launches

closes INTEROP-8328
flag=none

test plan:
* copy the added blocks from the example YML files in the parent commit
(g/333844), add them to the real config files and remove comments
* change `enabled` to `true` in the YML file
* run a small server that can accept and log POST requests
* change the `url` in the YML file to point to that server
* restart your web container, make sure jobs are running
* in a rails console:
```ruby
PandataEvents.send_event('test', {foo: 'bar'}, for_user_id: 1)
```
* your server should have received a POST request with a body that looks
something like:
```
{"timestamp":"2023-11-28T18:31:31Z","eventType":"test",
  "appTag":"CANVAS","properties":{"foo":"bar"}}
```
* and has a JWT in the Authorization header

Change-Id: I72073258135f0008199766bd7a9449cbfd54dcfd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/333957
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2023-11-30 22:20:26 +00:00
Xander Moffatt 4cc3c0fa4a consolidate PandataEvents creds and config
why:
* for future usage by canvas for logging LTI launches

closes INTEROP-8327
flag=none

test plan:
* copy the added blocks from the example YML files in this
commit and add them to the real config files and remove comments
* change `enabled` to `true`
* restart your web container
* these should return real values:
```
PandataEvents.credentials
PandataEvents.endpoint
PandataEvents.enabled?
```

Change-Id: Idfcf2a2f660ac13bcfe8f8ab673229a739bf7a49
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/333844
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2023-11-30 22:18:38 +00:00