Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iter18 #36

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
0bba879
Added interfaces for storage and metrics. Added implementation of cou…
MlDenis Jul 13, 2023
1bfb972
Rename MemStorage and NewMemStorage to InMemoryStorage and NewInMemor…
io-2301 Jul 22, 2023
046719a
Added server run and update handler implementations.
io-2301 Jul 26, 2023
2678d16
Change go version fron 1.21rc2 to 1.20
io-2301 Jul 26, 2023
10848b1
Fixed cmd/server/main.go:22:3: printf-style function with dynamic for…
io-2301 Jul 26, 2023
9849009
Fixed Несоответствие статус кода ответа ожидаемому в хендлере POST ht…
io-2301 Jul 26, 2023
01b30f8
Rename package type_converter to converter.
io-2301 Jul 26, 2023
dee7912
Added agent config implementation.
io-2301 Jul 26, 2023
da38d09
Added: Implementation of agent, html renderer, metric providers (runt…
io-2301 Jul 27, 2023
bbeb3b1
Fixed: cmd/server/main_test.go:5:2: no required module provides packa…
io-2301 Jul 27, 2023
b5cc282
Fixed: cmd/server/main_test.go:5:2: no required module provides packa…
io-2301 Jul 27, 2023
ce3dfe6
Fixed: cmd/server/main.go:155:3: fmt.Println call has possible format…
io-2301 Jul 27, 2023
2949c46
Added empty agent test file.
io-2301 Jul 27, 2023
e7f1aaa
Change successResponce log message text.
io-2301 Jul 27, 2023
efda2c0
Added work with flags implementation for server and agent.
io-2301 Jul 28, 2023
92f4248
Fixed statictest: internal/agent/httpMetricsAgent_test.go:54:14: assi…
io-2301 Jul 28, 2023
7141e18
Fixed internal/agent/httpMetricsAgent_test.go:54:4: this value of err…
io-2301 Jul 28, 2023
3877e46
Fixed iteration2a_test.go:47: Не удалось дождаться пока на порт 8080…
io-2301 Jul 28, 2023
f31c1de
Change agent flag parameter names.
io-2301 Jul 28, 2023
c55279d
Change Changed the order of value elements when parsing agent flags.
io-2301 Jul 28, 2023
0f4275d
Added logger implementation.
io-2301 Jul 28, 2023
7fffcab
Added env variables implementations.
io-2301 Jul 28, 2023
7aa4ef6
Added logger calling in key methods.
io-2301 Jul 28, 2023
580660c
Added DB implementation
io-2301 Jul 28, 2023
bdc3be6
Added hash signer implementation.
io-2301 Jul 28, 2023
15216ea
Update metrics dirrectory structure and metrics implementation.
io-2301 Jul 28, 2023
53b9e0b
Global metrics refactoring.
io-2301 Jul 28, 2023
a9fc281
Update agent implementation.
io-2301 Jul 28, 2023
94b685b
Update server implementation.
io-2301 Jul 28, 2023
33765f3
Small change for debag gihub actions reaction.
io-2301 Jul 28, 2023
149f5af
Comment error sql code.
io-2301 Jul 28, 2023
8fa8d1a
Repair psql data.
io-2301 Jul 28, 2023
3a33bb0
Update autotests.
io-2301 Jul 28, 2023
539ad6c
Fix agent launch adress.
io-2301 Jul 28, 2023
3d62de5
Added faake test files.
io-2301 Jul 28, 2023
ce0240a
Disable incorrect test (dbStorage_test).
io-2301 Jul 30, 2023
d98a2a1
Debug github actions work.
io-2301 Jul 30, 2023
be27a3a
Simplify the solution to meet the requirements of an inadequate test.
io-2301 Jul 30, 2023
21b0fe3
Fix store interval varuable data type.
io-2301 Jul 30, 2023
451097e
Fix datatype in hardWorker_test params.
io-2301 Jul 30, 2023
8d2b144
Fix the order of time values in hardWorker_test variables.
io-2301 Jul 30, 2023
de51332
Undo last commit changes. Debug gethub actions error trace.
io-2301 Jul 30, 2023
3faf1b7
Update default workers limit.
io-2301 Jul 31, 2023
5aa1812
Fix PushMetricsTimeout state.
io-2301 Jul 31, 2023
88ab85c
Change log to logrus package.
io-2301 Jul 31, 2023
39bfa30
Delete fake test files.
io-2301 Jul 31, 2023
c881ce3
Changed the use of logrus to use zab.
MlDenis Nov 13, 2023
7f71468
Add log.Sync() before exiting the program to ensure that buffered rec…
MlDenis Nov 13, 2023
8505845
Fix stub database panic
MlDenis Dec 6, 2023
73a2f21
I moved the agent and server configs into a separate file. Removed co…
MlDenis Dec 6, 2023
68dec2b
Migration redesigned based on goose. I abandoned procedures in the co…
MlDenis Dec 6, 2023
23f6376
Add linter
MlDenis Dec 6, 2023
92ee926
Satisfied the linter's requirements.
MlDenis Dec 6, 2023
99baf0d
Satisfied the linter's requirements.
MlDenis Dec 6, 2023
16c00a9
Corrected comments after review.
MlDenis Dec 8, 2023
13c514c
Sorted the imports in the project.
MlDenis Dec 8, 2023
7c45fde
Rename JumpToTheOriginalState to ResetState.
MlDenis Dec 8, 2023
cd09a34
Delete StorageBackup.
MlDenis Dec 8, 2023
76e149a
Mixed the server config into server spaghetti O_o
MlDenis Jan 23, 2024
6a67ae1
Updated go.mod
MlDenis Jan 25, 2024
3ecaa2a
The profiler is connected to the server router.
MlDenis Jan 25, 2024
3d6e46b
Used a buffer pool to reduce the overhead of buffer creation and garb…
MlDenis Jan 25, 2024
b51eda0
Simplifying the сode for a aggregateMetricsProvider.
MlDenis Jan 25, 2024
5946b91
Optimization of GopsutilMetricsProvider.
MlDenis Jan 25, 2024
d5b434f
Improved logging and error handling in runtimeMetricsProviderConfig.
MlDenis Jan 25, 2024
7173d68
Added blocking to AddMetricValues when adding metrics. Added returnin…
MlDenis Jan 25, 2024
3353a08
Added file unlocking to fileStorage->updateMetrics when job is done.
MlDenis Jan 25, 2024
c3db760
Complete 16 increment.
MlDenis Jan 26, 2024
dcbb23a
Complete 16 increment.
MlDenis Jan 26, 2024
66789c2
Merge remote-tracking branch 'origin/iter16' into iter16
MlDenis Jan 26, 2024
be1ebe9
Downgrade go version to 1.21
MlDenis Jan 26, 2024
5550afd
Complete iter17.
MlDenis Jan 26, 2024
27a31d0
Complete iter18.
MlDenis Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,708 changes: 2,708 additions & 0 deletions .github/workflows/.golangci.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/mertricstest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
metricstest -test.v -test.run=^TestIteration1$ \
-binary-path=cmd/server/server

- name: Build agent binary
- name: Build config binary
run: |
cd cmd/agent
go build -buildvcs=false -o agent
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# cmd/agent

В данной директории будет содержаться код Агента, который скомпилируется в бинарное приложение
This directory contains the Agent code that is compiled into a binary application.
98 changes: 97 additions & 1 deletion cmd/agent/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,99 @@
package main

func main() {}
import (
"context"
"flag"
"fmt"

"github.com/MlDenis/prometheus_wannabe/internal/config"
"github.com/MlDenis/prometheus_wannabe/internal/hash"
"github.com/MlDenis/prometheus_wannabe/internal/logger"
"github.com/MlDenis/prometheus_wannabe/internal/metrics/model"
"github.com/MlDenis/prometheus_wannabe/internal/metrics/provider/agregate"
"github.com/MlDenis/prometheus_wannabe/internal/metrics/provider/custom"
"github.com/MlDenis/prometheus_wannabe/internal/metrics/provider/gopsutil"
"github.com/MlDenis/prometheus_wannabe/internal/metrics/provider/runtime"
"github.com/MlDenis/prometheus_wannabe/internal/metrics/sendler/http"
"github.com/MlDenis/prometheus_wannabe/internal/worker"

"github.com/caarlos0/env/v7"
)

func main() {

conf, err := createConfig()
if err != nil {
panic(logger.WrapError("initialize config", err))
}

logger.InitLogger(fmt.Sprint(conf.LogLevel))

signer := hash.NewSigner(conf)
converter := model.NewMetricsConverter(conf, signer)
metricPusher, err := http.NewMetricsPusher(conf, converter)
if err != nil {
panic(logger.WrapError("create new metrics pusher", err))
}

runtimeMetricsProvider := runtime.NewRuntimeMetricsProvider(conf)
customMetricsProvider := custom.NewCustomMetricsProvider()
gopsutilMetricsProvider := gopsutil.NewGopsutilMetricsProvider()
aggregateMetricsProvider := agregate.NewAggregateMetricsProvider(
runtimeMetricsProvider,
customMetricsProvider,
gopsutilMetricsProvider,
)
getMetricsWorker := worker.NewHardWorker(aggregateMetricsProvider.Update)
pushMetricsWorker := worker.NewHardWorker(func(workerContext context.Context) error {
return metricPusher.Push(workerContext, aggregateMetricsProvider.GetMetrics())
})

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

go getMetricsWorker.StartWork(ctx, conf.UpdateMetricsInterval)
pushMetricsWorker.StartWork(ctx, conf.SendMetricsInterval)
}

func createConfig() (*config.Config, error) {
conf := &config.Config{CollectMetricsList: []string{
"Alloc",
"BuckHashSys",
"Frees",
"GCCPUFraction",
"GCSys",
"HeapAlloc",
"HeapIdle",
"HeapInuse",
"HeapObjects",
"HeapReleased",
"HeapSys",
"LastGC",
"Lookups",
"MCacheInuse",
"MCacheSys",
"MSpanInuse",
"MSpanSys",
"Mallocs",
"NextGC",
"NumForcedGC",
"NumGC",
"OtherSys",
"PauseTotalNs",
"StackInuse",
"StackSys",
"Sys",
"TotalAlloc",
}}

flag.StringVar(&conf.Key, "k", "", "Signer secret key")
flag.StringVar(&conf.ServerURL, "a", "localhost:8080", "Metrics server URL")
flag.IntVar(&conf.PushRateLimit, "l", 20, "Push metrics parallel workers limit")
flag.IntVar(&conf.PushTimeout, "t", 10, "Push metrics timeout")
flag.IntVar(&conf.SendMetricsInterval, "r", 10, "Send metrics interval")
flag.IntVar(&conf.UpdateMetricsInterval, "p", 2, "Update metrics interval")
flag.Parse()

err := env.Parse(conf)
return conf, err
}
2 changes: 1 addition & 1 deletion cmd/server/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# cmd/agent

В данной директории будет содержаться код Сервера, который скомпилируется в бинарное приложение
This directory contains the Server code that is compiled into a binary application.
Loading
Loading