Skip to content

Instantly share code, notes, and snippets.

View johnfercher's full-sized avatar
🏠
Working from home

John Fercher johnfercher

🏠
Working from home
View GitHub Profile
@johnfercher
johnfercher / artigo11-compose.yml
Last active July 13, 2023 14:19
artigo11-compose.yml
version: '3'
networks:
metrics:
driver: bridge
transactional:
driver: bridge
services:
@johnfercher
johnfercher / artigo10-scrap
Created July 9, 2023 16:28
artigo10-scrap
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
go_gc_duration_seconds{quantile="0.5"} 0
go_gc_duration_seconds{quantile="0.75"} 0
go_gc_duration_seconds{quantile="1"} 0
go_gc_duration_seconds_sum 0
go_gc_duration_seconds_count 0
# HELP go_goroutines Number of goroutines that currently exist.
@johnfercher
johnfercher / artigo10-httphandler.go
Created July 9, 2023 14:38
artigo10-httphandler.go
type HttpHandler interface {
Name() string
Pattern() string
Verb() string
Handle(r *http.Request) (response apiresponse.ApiResponse, err apierror.ApiError)
}
@johnfercher
johnfercher / artigo10-start.go
Last active July 9, 2023 14:10
artigo10-start.go
package endpointmetrics
import (
"fmt"
"github.com/prometheus/client_golang/prometheus/promhttp"
"medium/m/v2/internal/observability/metrics/countermetrics"
"medium/m/v2/internal/observability/metrics/histogrammetrics"
"net/http"
)
@johnfercher
johnfercher / artigo10-increment.go
Last active July 9, 2023 14:12
artigo10-increment.go
package countermetrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"medium/m/v2/internal/observability/metrics"
)
type Metric struct {
Name string
@johnfercher
johnfercher / artigo10-metrics.go
Created July 9, 2023 03:46
artigo10-metrics.go
package api
import (
"medium/m/v2/internal/api/apierror"
"medium/m/v2/internal/api/apiresponse"
"medium/m/v2/internal/encode"
"medium/m/v2/internal/observability/metrics/endpointmetrics"
"net/http"
"time"
)
@johnfercher
johnfercher / artigo10-createproduct.go
Last active July 9, 2023 14:38
artigo10-createproduct.go
package api
import (
"medium/m/v2/internal/api/apierror"
"medium/m/v2/internal/api/apiresponse"
"net/http"
)
type createProduct struct {
name string
@johnfercher
johnfercher / artigo10-main.go
Last active July 9, 2023 14:30
artigo10-main.go
package main
import (
// ...
)
func main() {
cfg, err := config.Load(os.Args)
if err != nil {
panic(err)
@johnfercher
johnfercher / artigo10-compose.yml
Last active July 10, 2023 16:03
artigo10-compose.yml
version: '3'
# ALTERAÇÃO 1 <<<<<<<<<<<<<<<<<<<<<<<<<
networks:
metrics:
driver: bridge
transactional:
driver: bridge
services:
@johnfercher
johnfercher / artigo9-lint-rules.yml
Created July 3, 2023 01:52
artigo9-lint-rules.yml
run:
timeout: 5m
modules-download-mode: readonly
linters-settings:
lll:
line-length: 140
gocritic:
enabled-checks:
- appendAssign