Skip to content

Commit 432d56e

Browse files
committed
fix: always add metrics interceptor
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
1 parent fbe1903 commit 432d56e

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

protoc_plugins/Dockerfile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
1-
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
1+
FROM golang:1.26-alpine AS builder
22

3-
ARG TARGETOS
4-
ARG TARGETARCH
5-
ARG TARGETVARIANT
3+
ARG TARGETPLATFORM
64

75
ENV CGO_ENABLED=0
86

97
WORKDIR /src
8+
# https://buf.build/docs/bsr/remote-plugins/custom-plugins/#build-a-docker-image
9+
RUN test "${TARGETPLATFORM}" = "linux/amd64" || (echo "buf plugin image must be built for linux/amd64" && exit 1)
10+
1011
COPY protoc_plugins/go.mod protoc_plugins/go.sum ./
1112
RUN go mod download
1213

1314
COPY protoc_plugins/ .
1415

15-
RUN set -eux; \
16-
goarm=""; \
17-
goamd64=""; \
18-
if [ "${TARGETARCH:-}" = "arm" ] && [ -n "${TARGETVARIANT:-}" ]; then goarm="${TARGETVARIANT#v}"; fi; \
19-
if [ "${TARGETARCH:-}" = "amd64" ] && [ -n "${TARGETVARIANT:-}" ]; then goamd64="${TARGETVARIANT#v}"; fi; \
20-
GOOS="${TARGETOS:-linux}" GOARCH="${TARGETARCH:-amd64}" GOARM="${goarm}" GOAMD64="${goamd64}" \
21-
go build -trimpath -ldflags "-s -w" -o /out/protoc-gen-php-grpc-plugin ./protoc-gen-php-grpc
16+
RUN go build -trimpath -ldflags "-s -w" -o /out/protoc-gen-php-grpc-plugin ./protoc-gen-php-grpc
2217

2318
FROM scratch
2419

server.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ func (p *Plugin) createGRPCserver(interceptors map[string]api.Interceptor) (*grp
4848
interceptors[name].UnaryServerInterceptor(),
4949
)
5050
}
51-
52-
opts = append(
53-
opts,
54-
grpc.ChainUnaryInterceptor(
55-
unaryInterceptors...,
56-
),
57-
)
5851
}
5952

53+
opts = append(
54+
opts,
55+
grpc.ChainUnaryInterceptor(
56+
unaryInterceptors...,
57+
),
58+
)
59+
6060
opts = append(opts, grpc.StatsHandler(otelgrpc.NewServerHandler(otelgrpc.WithTracerProvider(p.tracer), otelgrpc.WithPropagators(p.prop))))
6161
server := grpc.NewServer(opts...)
6262

0 commit comments

Comments
 (0)