diff --git a/CHANGELOG.md b/CHANGELOG.md index 6849dbb1..1165dd6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ Starting from v2.2.5, all notable changes to this project will be documented in this file. +## v3.6.0 + +### Bug Fixes + +- Fixed incorrect coordinates when legacy mode enabled. + +### New Features + +- Support customizing helicorder image size, waveform scale and samples per span. + ## v3.5.0 ### New Features diff --git a/VERSION b/VERSION index c0c4025d..130165bc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.5.0 +v3.6.0 diff --git a/build/assets/config.json b/build/assets/config.json index 239c6ddd..eadf6c89 100644 --- a/build/assets/config.json +++ b/build/assets/config.json @@ -84,6 +84,9 @@ "helicorder": { "enable": true, "lifecycle": 10, + "scale": 2.0, + "size": 1000, + "samples": 10000, "path": "/home/user/helicorder" } } diff --git a/services/helicorder/default.go b/services/helicorder/default.go new file mode 100644 index 00000000..f8fc1783 --- /dev/null +++ b/services/helicorder/default.go @@ -0,0 +1,7 @@ +package helicorder + +func (s *HelicorderService) loadDefault() { + s.imageSize = HELICORDER_IMAGE_SIZE + s.spanSamples = HELICORDER_DOWNSAMPLE_FACTOR + s.scaleFactor = HELICORDER_SCALE_FACTOR +} diff --git a/services/helicorder/start.go b/services/helicorder/start.go index 90850b04..0894f46c 100644 --- a/services/helicorder/start.go +++ b/services/helicorder/start.go @@ -42,6 +42,18 @@ func (m *HelicorderService) Start(options *services.Options, waitGroup *sync.Wai m.stationCode = options.Config.Stream.Station m.networkCode = options.Config.Stream.Network m.locationCode = options.Config.Stream.Location + m.loadDefault() + + if imageSize, err := options.Config.Services.GetValue(m.GetServiceName(), "size", "int"); err == nil { + m.imageSize = imageSize.(int) + } + if spanSamples, err := options.Config.Services.GetValue(m.GetServiceName(), "samples", "int"); err == nil { + m.spanSamples = spanSamples.(int) + } + if scaleFactor, err := options.Config.Services.GetValue(m.GetServiceName(), "scale", "float"); err == nil { + m.scaleFactor = scaleFactor.(float64) + } + dataProvider := &provider{ database: options.Database, queryCache: cache.NewKv(HELICORDER_TIME_SPAN), @@ -117,14 +129,14 @@ func (m *HelicorderService) Start(options *services.Options, waitGroup *sync.Wai channelName := dataProvider.GetChannel() logger.GetLogger(m.GetServiceName()).Infof("start plotting helicorder for %s", channelName) - err = helicorderCtx.Plot(currentTime, HELICORDER_DOWNSAMPLE_FACTOR, HELICORDER_SCALE_FACTOR, HELICORDER_LINE_WIDTH) + err = helicorderCtx.Plot(currentTime, m.spanSamples, m.scaleFactor, HELICORDER_LINE_WIDTH) if err != nil { logger.GetLogger(m.GetServiceName()).Errorln(err) continue } filePath := m.getFilePath(channelName, currentTime) - err = helicorderCtx.Save(HELICORDER_IMAGE_SIZE, filePath) + err = helicorderCtx.Save(m.imageSize, filePath) if err != nil { logger.GetLogger(m.GetServiceName()).Errorln(err) continue diff --git a/services/helicorder/types.go b/services/helicorder/types.go index 23d1c6e6..d08ec51b 100644 --- a/services/helicorder/types.go +++ b/services/helicorder/types.go @@ -7,7 +7,7 @@ const ( HELICORDER_IMAGE_SIZE = 1000 HELICORDER_DOWNSAMPLE_FACTOR = 5000 HELICORDER_SCALE_FACTOR = 2.2 - HELICORDER_LINE_WIDTH = 0.8 + HELICORDER_LINE_WIDTH = 1 ) type HelicorderService struct { @@ -16,4 +16,8 @@ type HelicorderService struct { stationCode string networkCode string locationCode string + + imageSize int + spanSamples int + scaleFactor float64 }