-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from holdno/feat/org
Feat/org
- Loading branch information
Showing
186 changed files
with
4,904 additions
and
1,493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ gopherCronClient | |
.idea | ||
_build | ||
.DS_Store | ||
/script/image.sh | ||
/script/image.sh | ||
debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
FROM alpine | ||
MAINTAINER label <[email protected]> | ||
FROM golang:1.20.8-alpine3.18 AS builder | ||
|
||
ENV GOPROXY=https://goproxy.cn,direct | ||
|
||
WORKDIR /gophercron | ||
COPY ./_build/config /gophercron/config | ||
COPY ./_build/view /gophercron/view | ||
COPY ./_build/gophercron /gophercron/gophercron | ||
COPY . . | ||
RUN mkdir -p _build | ||
RUN go build -a -ldflags '-extldflags "-static"' -o _build/gophercron ./cmd/ | ||
|
||
|
||
FROM alpine:3.18 | ||
LABEL MAINTAINER <[email protected]> | ||
|
||
RUN apk update && apk add tzdata diffutils curl && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | ||
|
||
WORKDIR /gophercron | ||
COPY --from=builder /gophercron/_build/config /gophercron/config | ||
COPY --from=builder /gophercron/_build/view /gophercron/view | ||
COPY --from=builder /gophercron/_build/gophercron /gophercron/gophercron | ||
|
||
CMD ["./gophercron", "service", "-c", "./config/service-config-default.toml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package agent | ||
|
||
import ( | ||
"github.com/holdno/gopherCron/pkg/metrics" | ||
|
||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
type Metrics struct { | ||
provider *metrics.Metrics | ||
jobs *prometheus.GaugeVec | ||
systemError *prometheus.CounterVec | ||
} | ||
|
||
func NewMonitor(instance string) *Metrics { | ||
m := &Metrics{ | ||
provider: metrics.NewMetrics("agent", instance), | ||
} | ||
|
||
m.jobs = m.provider.NewGaugeVec("job", nil) | ||
m.systemError = m.provider.NewCounterVec("system_error", []string{"reason"}) | ||
return m | ||
} | ||
|
||
func (s *Metrics) SetJobCount(count int) { | ||
s.jobs.WithLabelValues().Set(float64(count)) | ||
} | ||
|
||
func (s *Metrics) SystemErrInc(reason string) { | ||
s.systemError.WithLabelValues(reason).Inc() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.