Skip to content

Instantly share code, notes, and snippets.

View r3code's full-sized avatar

Dmitriy S. Sinyavskiy r3code

View GitHub Profile
@r3code
r3code / golang-learning-readmap.md
Last active April 16, 2021 15:18
Что учить по GoLang?
@r3code
r3code / microservices-error-propagation.md
Last active March 27, 2021 09:43
Передача ошибок между микросервисами

Передача ошибок между микросервисами

В вызывающем сервисе ошибки от запрашиваемого сервиса должны оборачиваться в местные подходящие ошибки (https://softwareengineering.stackexchange.com/questions/351047/upstreaming-microservices-errors)

Предлагаю использовать https://tools.ietf.org/html/rfc7807

{
Status: 400|500|401|403
Path: /api/v1/merchants

Errors: [

<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" />
@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

@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 / 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 / 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 / README.md
Last active April 20, 2021 14:07 — forked from vporoshok/README.md
Snippet of README file for RDD (Readme driven development)

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 / distributed-monolith-vs-microservices-ru.md
Last active October 2, 2025 09:59
Распределенный монолит и микросервисы (чеклист)

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

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

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

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

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