Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ai/live: Send event when auth fails #3331

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

ai/live: Send event when auth fails #3331

wants to merge 3 commits into from

Conversation

j0sh
Copy link
Collaborator

@j0sh j0sh commented Dec 19, 2024

  • Send an event when auth fails. If auth is broken, we don't get any events, so it can be hard to determine from events what the state of things is.
  • Set the streamID = streamKey by default. This is helpful in dev mode without a webhook setup. If a webhook specifies streamID then that is still used.
  • Update some logging

@github-actions github-actions bot added go Pull requests that update Go code AI Issues and PR related to the AI-video branch. labels Dec 19, 2024
@@ -454,6 +455,10 @@ func (ls *LivepeerServer) StartLiveVideo() http.Handler {
clog.Errorf(ctx, "failed to kick input connection: %s", kickErr.Error())
}
clog.Errorf(ctx, "Live AI auth failed: %s", err.Error())
monitor.SendQueueEventAsync("ai_stream_events", map[string]string{
"type": "error",
"message": "Live AI auth failed: " + err.Error(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ecmulli @gioelecerati wanted to check this would not break anything downstream since we only have a limited set of fields here. Most of the rest are unknown at this point - they come as part of the auth webhook, but the auth webhook has failed here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping on this @ecmulli @gioelecerati

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@j0sh this shouldn't break anything, since the messages are sent to Kafka without any deserialization - worst case scenario they won't be collected anywhere

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@j0sh, @gioelecerati is correct here. the missing fields should be ignored.

is streamId, pipelineID, etc automatically included in this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is streamId, pipelineID, etc automatically included in this?

They are not included, because they don't exist at this point. We typically receive those via the auth webhook but this event is reporting that the auth webhook has failed.

If we wanted some form of identifier we could include the stream key as stream_key or something, although that is not part of other events IIRC. The key itself might also be a little strange from brute force connection attempts which has some risk to downstream consumers through eg, injection.

Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Please upload report for BASE (master@0bfd28b). Learn more about missing BASE report.

Files with missing lines Patch % Lines
server/ai_mediaserver.go 0.00000% 6 Missing ⚠️
media/rtmp2segment.go 0.00000% 1 Missing ⚠️
server/ai_live_video.go 0.00000% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master       #3331   +/-   ##
============================================
  Coverage          ?   33.75090%           
============================================
  Files             ?         141           
  Lines             ?       37359           
  Branches          ?           0           
============================================
  Hits              ?       12609           
  Misses            ?       24030           
  Partials          ?         720           
Files with missing lines Coverage Δ
media/rtmp2segment.go 0.00000% <0.00000%> (ø)
server/ai_live_video.go 0.00000% <0.00000%> (ø)
server/ai_mediaserver.go 7.78210% <0.00000%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0bfd28b...a669dae. Read the comment docs.

Files with missing lines Coverage Δ
media/rtmp2segment.go 0.00000% <0.00000%> (ø)
server/ai_live_video.go 0.00000% <0.00000%> (ø)
server/ai_mediaserver.go 7.78210% <0.00000%> (ø)

Copy link
Contributor

@leszko leszko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but let's wait for @ecmulli @gioelecerati before merging to confirm/answer your inline question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Issues and PR related to the AI-video branch. go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants