Skip to content

Commit

Permalink
Merge pull request #25 from aldor007/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
aldor007 authored Oct 2, 2018
2 parents d69027d + 81f5ffc commit 38458e9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ FROM ubuntu:16.04 as builder

ENV LIBVIPS_VERSION 8.6.2
ENV DEP_VERSION v0.4.1
ENV GOLANG_VERSION 1.10

ENV GOLANG_VERSION 1.11

# Installs libvips + required libraries
RUN \
Expand All @@ -15,7 +14,7 @@ RUN \
swig libmagickwand-dev libpango1.0-dev libmatio-dev libopenslide-dev libcfitsio-dev \
libgsf-1-dev fftw3-dev liborc-0.4-dev librsvg2-dev && \
cd /tmp && \
curl -OL https://github.com/jcupitt/libvips/releases/download/v${LIBVIPS_VERSION}/vips-${LIBVIPS_VERSION}.tar.gz && \
curl -OL https://github.com/libvips/libvips/releases/download/v${LIBVIPS_VERSION}/vips-${LIBVIPS_VERSION}.tar.gz && \
tar zvxf vips-${LIBVIPS_VERSION}.tar.gz && \
cd /tmp/vips-${LIBVIPS_VERSION} && \
./configure --enable-debug=no --without-python $1 && \
Expand Down
18 changes: 16 additions & 2 deletions cmd/mort/mort.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/aldor007/mort/pkg/throttler"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.uber.org/zap/zapcore"
"net"
"os"
"os/signal"
Expand Down Expand Up @@ -91,8 +92,21 @@ func handleSignals(servers []*http.Server, socketPaths []string, wg *sync.WaitGr
}

func configureMonitoring(mortConfig *config.Config) {
logger, _ := zap.NewProduction()
//logger, _ := zap.NewDevelopment()
logCfg := zap.NewProductionConfig()
logCfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
logger, _ := logCfg.Build()

host, err := os.Hostname()
if err != nil {
host = "unknown"
}

pid := os.Getpid()
logger = logger.With(
zap.String("hostname", host),
zap.Int("pid", pid),
)

zap.ReplaceGlobals(logger)
monitoring.RegisterLogger(logger)
if mortConfig.Server.Monitoring == "prometheus" {
Expand Down
7 changes: 4 additions & 3 deletions pkg/lock/memory.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package lock

import (
"github.com/aldor007/mort/pkg/monitoring"
"github.com/aldor007/mort/pkg/response"
"go.uber.org/zap"
"sync"
"go.uber.org/zap"
"github.com/aldor007/mort/pkg/monitoring"
)

// MemoryLock is in memory lock for single mort instance
Expand Down Expand Up @@ -33,10 +33,11 @@ func (m *MemoryLock) NotifyAndRelease(key string, res *response.Response) {
m.lock.Unlock()

if len(result.notifyQueue) == 0 {
monitoring.Log().Warn("Empty notify queue", zap.String("key", key))
return
}

monitoring.Log().Warn("Notify queue", zap.String("key", key), zap.Int("len", len(result.notifyQueue)))

if res.IsBuffered() {
resCopy, err := res.Copy()
if err != nil {
Expand Down

0 comments on commit 38458e9

Please sign in to comment.