diff --git a/CHANGELOG.md b/CHANGELOG.md index e5dfa4319..f746db763 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,86 @@ * fix [edge#336 Startup Race Condition](https://github.com/openziti/edge/issues/336) * fix api-session and session deletes from ziti CLI * update ziti-fabric-test loop3 - * allow specifying policy semantic from CLI when creating policies - + * allow specifying policy semantic from CLI when creating policies + * new eventing features + +## Event Changes +### Event Configuration +Handlers can now be configured for events via the config file. Here is an example configuration: + + events: + jsonLogger: + subscriptions: + - type: metrics + sourceFilter: .* + metricFilter: .*egress.*m1_rate* + - type: fabric.sessions + include: + - created + - type: edge.sessions + include: + - created + - type: fabric.usage + handler: + type: file + format: json + path: /tmp/ziti-events.log + +Each section can include any number of event subscriptions and a single handler. The supported event types are: + +* metrics +* fabric.sessions +* fabric.usage +* edge.sessions + +### Event Handlers +There are two new handlers which can be used to output events. + +#### File Handler +Sends events to disk. Supported options: + +* type: file +* format: json|plain +* path: Path to the target file +* bufferSize: size of event queue. When this fills up, processes submitting events will block +* maxsizemb: max size of the file before it gets rolled. default is 10MB +* maxbackups: max number of rolling files to keep. default is 0 (keeps all) + +#### Stdout Handler +Sends events to stdout. Supported options: + +* type: stdout +* format: json|plain +* bufferSize: size of event queue. When this fills up, processes submitting events will block + +### Usage Events +There is a new Usage event type which has been derived from the metrics events. This allows handlers to see discrete usage events, rather than a collection of them. + +The Usage event looks like: + + type UsageEvent struct { + Namespace string `json:"namespace"` + EventType string `json:"event_type"` + SourceId string `json:"source_id"` + SessionId string `json:"session_id"` + Usage uint64 `json:"usage"` + IntervalStartUTC int64 `json:"interval_start_utc"` + IntervalLength uint64 `json:"interval_length"` + } + +### Metrics Events +Metrics events can now be filtered. Metrics events processed through the new event framework no longer sending metrics messages directly. Rather, a flattened (and more easily filterable) event type is provided. The new event type looks like: + + type MetricsEvent struct { + Namespace string + SourceId string + Timestamp *timestamp.Timestamp + Tags map[string]string + IntMetrics map[string]int64 + FloatMetrics map[string]float64 + MetricGroup map[string]string + } + # Release 0.16.4 ## Breaking CLI Change diff --git a/go.mod b/go.mod index ab94465ea..ba52388c5 100644 --- a/go.mod +++ b/go.mod @@ -27,10 +27,10 @@ require ( github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 github.com/michaelquigley/pfxlog v0.0.0-20190813191113-2be43bd0dccc - github.com/openziti/edge v0.16.38 - github.com/openziti/fabric v0.14.9-0.20201009024557-3768481c8198 - github.com/openziti/foundation v0.14.8 - github.com/openziti/sdk-golang v0.13.52 + github.com/openziti/edge v0.16.43 + github.com/openziti/fabric v0.14.10 + github.com/openziti/foundation v0.14.10 + github.com/openziti/sdk-golang v0.13.54 github.com/pborman/uuid v1.2.0 github.com/pkg/errors v0.9.1 github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 diff --git a/go.sum b/go.sum index 8559487a3..bb7c5abeb 100644 --- a/go.sum +++ b/go.sum @@ -298,8 +298,6 @@ github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uia github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= -github.com/kataras/go-events v0.0.3-0.20170604004442-17d67be645c3 h1:RGJQh17kB5HdupMRzKz89QzkYBnLRJJ+6SCurbvd0hw= -github.com/kataras/go-events v0.0.3-0.20170604004442-17d67be645c3/go.mod h1:6IxMW59VJdEIqj3bjFGJvGLRdb0WHtrlxPZy9qXctcg= github.com/kataras/go-events v0.0.3-0.20201007151548-c411dc70c0a6 h1:XXnySN8wVet8S4UlcXHjh8Oa7618Eu7z92HxU5cIfhA= github.com/kataras/go-events v0.0.3-0.20201007151548-c411dc70c0a6/go.mod h1:6IxMW59VJdEIqj3bjFGJvGLRdb0WHtrlxPZy9qXctcg= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= @@ -330,8 +328,8 @@ github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0 github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/lucas-clemente/quic-go v0.17.1 h1:ezsH76xpn6hKugfsXUy6voIJBFmAOwnM/Oy9F4b/n+M= github.com/lucas-clemente/quic-go v0.17.1/go.mod h1:I0+fcNTdb9eS1ZcjQZbDVPGchJ86chcIxPALn9lEJqE= -github.com/lucas-clemente/quic-go v0.18.0 h1:JhQDdqxdwdmGdKsKgXi1+coHRoGhvU6z0rNzOJqZ/4o= -github.com/lucas-clemente/quic-go v0.18.0/go.mod h1:yXttHsSNxQi8AWijC/vLP+OJczXqzHSOcJrM5ITUlCg= +github.com/lucas-clemente/quic-go v0.18.1 h1:DMR7guC0NtVS8zNZR3IO7NARZvZygkSC56GGtC6cyys= +github.com/lucas-clemente/quic-go v0.18.1/go.mod h1:yXttHsSNxQi8AWijC/vLP+OJczXqzHSOcJrM5ITUlCg= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= @@ -422,14 +420,14 @@ github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoT github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/openziti/edge v0.16.38 h1:zV7P4cK8LO8NyGEiJlJo8Bxf0TjgI+BwRxdrhUg2pqg= -github.com/openziti/edge v0.16.38/go.mod h1:zaRj81nISMQrkegOfJeOAwhOlDJRTTxJkQOEC5DVrZo= -github.com/openziti/fabric v0.14.8 h1:ATV0EZwISvhhMiNl1VkYZ6Ia/rAnqc+Rnahx5QbJXQc= -github.com/openziti/fabric v0.14.8/go.mod h1:fzxNGqL20fBWrvrMu+5UxjZVLaCrZmt/zcvgqD+zzjg= -github.com/openziti/foundation v0.14.8 h1:WgQMZxXrMZHvqF9vhq541Djm7UjXZr+WMiAaFDskm48= -github.com/openziti/foundation v0.14.8/go.mod h1:b8Ox/vvvdObz1JoEno0z7KN1cx0echQ7eP/tOmjbB+4= -github.com/openziti/sdk-golang v0.13.52 h1:DXsjYx8Sfv8crmyamHGq+7E5hhZIIwfpsojjj9lU9xk= -github.com/openziti/sdk-golang v0.13.52/go.mod h1:iYYT+vXQm4eMDsFcZ2ClKzEwT8eickOakV3FecVKMOw= +github.com/openziti/edge v0.16.43 h1:2PUHDAqoeVScPiuZvuveOtK6AfAA16AWaOeLJSfWCVI= +github.com/openziti/edge v0.16.43/go.mod h1:KWlREx/qsH0gGl8IFAwxnc4BS7aeuKE8R4T3DCq2d9E= +github.com/openziti/fabric v0.14.10 h1:H+5l0K9OrmpSA+N9mETmhxgG0vxmThQs6ho7W9d904c= +github.com/openziti/fabric v0.14.10/go.mod h1:v1eqj73dzfdBZJw48z8xMYqH4vgoWkpnhkg+qq1Nkb4= +github.com/openziti/foundation v0.14.10 h1:y5V1s/Iz2Ulsm06tMe9QhNr6YqAHFmznN7gYsI03j4Y= +github.com/openziti/foundation v0.14.10/go.mod h1:tmvDNdFW5EKKYZM4s3zyiwarvkLLpnDL+WBvtREtYbY= +github.com/openziti/sdk-golang v0.13.54 h1:HG5ODryEr910sbRkp2SBPhMTsnL4d7rsZLtJ4fBllgc= +github.com/openziti/sdk-golang v0.13.54/go.mod h1:SZo6goNAsvEu1kglZnC5fFRnr/C64eJl4G2OoU5JihA= github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6 h1:lNCW6THrCKBiJBpz8kbVGjC7MgdCGKwuvBgc7LoD6sw= github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= @@ -769,6 +767,7 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= diff --git a/ziti-controller/subcmd/run.go b/ziti-controller/subcmd/run.go index 021e76185..9ea61540d 100644 --- a/ziti-controller/subcmd/run.go +++ b/ziti-controller/subcmd/run.go @@ -18,10 +18,10 @@ package subcmd import ( "fmt" - "github.com/openziti/ziti/common/version" - "github.com/openziti/ziti/ziti/agent" "github.com/openziti/edge/controller/server" "github.com/openziti/fabric/controller" + "github.com/openziti/ziti/common/version" + "github.com/openziti/ziti/ziti/agent" "github.com/spf13/cobra" ) @@ -45,7 +45,7 @@ func run(cmd *cobra.Command, args []string) { } var c *controller.Controller - if c, err = controller.NewController(config, version.GetCmdBuildInfo()); err != nil { + if c, err = controller.NewController(config, version.GetCmdBuildInfo()); err != nil { fmt.Printf("unable to create fabric controller %+v\n", err) panic(err) } @@ -57,8 +57,9 @@ func run(cmd *cobra.Command, args []string) { } ec.SetHostController(c) + ec.Initialize() - go ec.InitAndRun() + go ec.RunAndWait() if err = c.Run(); err != nil { panic(err)