Skip to content

Instantly share code, notes, and snippets.

View r3code's full-sized avatar

Dmitriy S. Sinyavskiy r3code

View GitHub Profile
@r3code
r3code / log-trace-connector.go
Last active December 16, 2021 13:59
log-trace-connector demo
package main
// live https://goplay.space/#qUqusVmj8oV
import (
"context"
"fmt"
)
func NewService(l *Logger) *Service {
return &Service{
@r3code
r3code / go-kit-log-pairs.go
Created May 20, 2021 13:48
Predefined pairs for go-kit/log
// try https://goplay.space/#P8MtNeGIX69
import (
"os"
"github.com/go-kit/kit/log"
)
func Msg(s string) []interface{} {
return []interface{}{
"msg",
@r3code
r3code / distributed-monolith-vs-microservices-ru.md
Last active October 25, 2025 14:50
Распределенный монолит и микросервисы (чеклист)

Чеклист "Мои микросервисы - это распределенный монолит?"

Из статьи You're not actually building microservices

Проверка на симптомы

Итак, вы создаете микросервисы?
Взгляните на некоторые из этих симптомов и проставьте галочки, где вы согласны:

  • Изменение одного микросервиса часто требует изменений в других микросервисах (сильная связанность)

Russian version here

So, are you building microservices? Take a look at a few of these symptoms, and decide for yourself:

  • A change to one microservice often requires changes to other microservices
  • Deploying one microservice requires other microservices to be deployed at the same time
  • Your microservices are overly chatty
  • The same developers work across a large number of microservices
@r3code
r3code / README.md
Last active April 20, 2021 14:07 — forked from vporoshok/README.md
Snippet of README file for RDD (Readme driven development)
@r3code
r3code / version.go
Created April 16, 2021 11:15
Stub for runtime versioning for GoLang programs
package version
import (
"bytes"
"fmt"
"runtime"
"strings"
"github.com/prometheus/client_golang/prometheus"
)
@r3code
r3code / last-error-with-stack.go
Created April 12, 2021 15:03
Get last error with stack
// import gihub.com/pkg/errors
// Stack returns the last error in the error chain implementing StackTrace() or nil iа no errors with stack trace
func Stack(err error) errors.StackTrace {
type (
causer interface {
Cause() error
}
stackTracer interface {
StackTrace() errors.StackTrace
}
@r3code
r3code / protobuf-guidelines.md
Created April 2, 2021 12:17
Protobuf Guidelines

Используем protobuff версии 3 https://developers.google.com/protocol-buffers/docs/proto3

Придерживаемся стиля https://developers.google.com/protocol-buffers/docs/style

Если вы удалили поля message определенные ранее, то для сохранения совместимости, их номера должны быть помечены как reserved, чтобы их нельзя было использовать повторно после.

Поддержка версионирования API - см. https://google.aip.dev/215

Переиспользуем готовые определения часто используемых типов (время, деньги, дата и др.) см. https://google.aip.dev/213

@r3code
r3code / kubectl-exec-command.md
Last active April 2, 2021 10:27
Execute command in Kubernetis Pod
ENV_NAME=some_branch
POD_NAME=`kubectl get pods -n $ENV_NAME | grep pod_name_part- | head -n 1 | awk '{print $1}'`; print $POD_NAME

kubectl exec -n $ENV_NAME $POD_NAME -- /app/appctl arg1 arg2

<scheme name="Material Palenight (r3code)" version="142" parent_scheme="Darcula">
<option name="FONT_SCALE" value="1.0" />
<metaInfo>
<property name="created">2021-03-27T17:27:10</property>
<property name="ide">GoLand</property>
<property name="ideVersion">2020.3.4.0.0</property>
<property name="modified">2021-03-27T17:27:46</property>
<property name="originalScheme">Material Palenight (r3code)</property>
</metaInfo>
<option name="LINE_SPACING" value="1.1" />