Skip to content

Commit

Permalink
mist-api-connector: Send stream.state event with active/inactive st…
Browse files Browse the repository at this point in the history
…ream info (#112)

* DEV-REVERT: Use local livepeer-data lib

* mistapiconnector: Send stream.state event to rbbt

* mistapiconnector: Only cancel mac ctx after deactivating streams

* mistapiconnector: Shutdown amqp producer as well

Now we make sure that all events should hopefully reach
RabbitMQ.

* mistapiconnector: Start deactivating streams ASAP

Sending events might take a while, so we better start it eagerly
while shutting down the server.

* mapic: Use MacOptions object for mac args

I have to create yet another arg and it felt it was already
getting out of hand so I think this helps keep things safer.

* mapic: Include region in stream state event

* mapic: Remove unused raw AMQP client code

* mapic: Include region field in metrics event as well

* Revert "DEV-REVERT: Use local livepeer-data lib"

This reverts commit 019abc7.

* go.mod: Update livepeer-data lib dependency

* DEV-REVERT: Build on the local branch

* cmd/mapic: Fix flag deprecation notice

* cmd/mapic: Keep each option parameters on a line

* mapic: Send node ID as field in stream state event

* Revert "DEV-REVERT: Build on the local branch"

This reverts commit fed6964.

* go.mod: Update to merged version of livepeer-data
  • Loading branch information
victorges authored Oct 27, 2021
1 parent 5142bf4 commit 5510ad6
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 156 deletions.
27 changes: 22 additions & 5 deletions cmd/mist-api-connector/mist-api-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func main() {
etcdCert := fs.String("etcd-cert", "", "ETCD client certificate file name")
etcdKey := fs.String("etcd-key", "", "ETCD client certificate key file name")
amqpUrl := fs.String("amqp-url", "", "RabbitMQ url")
ownRegion := fs.String("own-region", "", "Identifier of the region where the service is running, used for mapping external data back to current region")
_ = fs.String("config", "", "config file (optional)")

consulPrefix := fs.String("consul-prefix", "", "DEPRECATED - use --route-prefix")
Expand All @@ -70,7 +71,7 @@ func main() {
routePrefix = consulPrefix
}
if *mistURL == "" && *consulMistURL != "" {
glog.Warningln("--consul-mist-url is deprecated, use --mist-url instead")
glog.Warningln("--consul-mist-url is deprecated, use --route-mist-url instead")
mistURL = consulMistURL
}

Expand All @@ -90,10 +91,26 @@ func main() {
etcdEndpoints = strings.Split(*fEtcdEndpoints, ",")
}

var err error
mc, err := mistapiconnector.NewMac(hostName, *mistHost, mapi, lapi, *balancerHost, false, *routePrefix,
*playbackDomain, *mistURL, *sendAudio, *baseStreamName, etcdEndpoints, *etcdCaCert, *etcdCert, *etcdKey,
*amqpUrl)
opts := mistapiconnector.MacOptions{
NodeID: hostName,
MistHost: *mistHost,
MistAPI: mapi,
LivepeerAPI: lapi,
BalancerHost: *balancerHost,
RoutePrefix: *routePrefix,
PlaybackDomain: *playbackDomain,
MistURL: *mistURL,
BaseStreamName: *baseStreamName,
CheckBandwidth: false,
SendAudio: *sendAudio,
EtcdEndpoints: etcdEndpoints,
EtcdCaCert: *etcdCaCert,
EtcdCert: *etcdCert,
EtcdKey: *etcdKey,
AMQPUrl: *amqpUrl,
OwnRegion: *ownRegion,
}
mc, err := mistapiconnector.NewMac(opts)
if err != nil {
glog.Fatalf("Error creating mist-api-connector %v", err)
}
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,21 @@ require (
github.com/PagerDuty/go-pagerduty v1.3.0
github.com/bwmarrin/discordgo v0.20.2
github.com/golang/glog v0.0.0-20210429001901-424d2337a529
github.com/gorilla/websocket v1.4.2 // indirect
github.com/gosuri/uilive v0.0.3 // indirect
github.com/gosuri/uiprogress v0.0.1
github.com/livepeer/joy4 v0.1.2-0.20210601043311-c1b885884cc7
github.com/livepeer/leaderboard-serverless v1.0.0
github.com/livepeer/livepeer-data v0.3.0-beta.2
github.com/livepeer/livepeer-data v0.4.0
github.com/livepeer/m3u8 v0.11.1
github.com/mattn/go-isatty v0.0.8 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/peterbourgon/ff v1.7.0
github.com/peterbourgon/ff/v2 v2.0.0
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/common v0.15.0
github.com/rabbitmq/amqp091-go v0.0.0-20210714180937-de74e8a7d0e0
go.etcd.io/etcd/client/pkg/v3 v3.5.0-rc.0
github.com/rabbitmq/amqp091-go v1.1.0
go.etcd.io/etcd/client/pkg/v3 v3.5.0
go.etcd.io/etcd/client/v3 v3.5.0-rc.0
go.opencensus.io v0.23.0
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420
Expand Down
Loading

0 comments on commit 5510ad6

Please sign in to comment.