Skip to content

Commit

Permalink
integrate local version, skip certs for now until issue is solved
Browse files Browse the repository at this point in the history
  • Loading branch information
ldemailly committed Dec 30, 2022
1 parent 7b93f08 commit da6bc80
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#FROM alpine as certs
#RUN apk update && apk add ca-certificates
# ^ alpine doesn't seem to work (with goreleaser, works fine from docker build cmd line), trying with ubuntu
FROM ubuntu as certs
RUN apt-get update && apt-get install -y ca-certificates
#FROM ubuntu as certs
#RUN apt-get update && apt-get install -y ca-certificates
# ^ doesn't (yet) work either https://github.com/goreleaser/goreleaser/issues/3676
FROM scratch
COPY fortiotel /usr/bin/fortio
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
#COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/usr/bin/fortio"]
EXPOSE 8080
# Prom metrics exports/scrape
Expand Down
16 changes: 14 additions & 2 deletions fortio_with_otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import (
"context"
"flag"
"fmt"
"io"
"net/http/httptrace"
"time"

"fortio.org/fortio/cli"
"fortio.org/fortio/fhttp"
"fortio.org/fortio/log"
"fortio.org/fortio/periodic"
"fortio.org/fortio/version"
"go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
Expand Down Expand Up @@ -114,13 +116,23 @@ func hook(ho *fhttp.HTTPOptions, ro *periodic.RunnerOptions) {
if err != nil {
log.Fatalf("Error setting up export pipeline: %v", err)
}
log.Infof("OTEL export pipeline setup successfully")
log.Infof("Fortio OTEL variant %s - export pipeline setup successfully", fotelVersion())
}

func fotelVersion() string {
short, _, _ := version.FromBuildInfo()
return short
}

func usage(w io.Writer, msgs ...interface{}) {
fmt.Fprintf(w, "Fortio OTEL variant %s - ", fotelVersion())
cli.Usage(w, msgs...)
}

func main() {
// Change a bunch of defaults to better ones "2.0" afforded by this being a new binary.
changeDefaults([]string{"stdclient", "nocatchup", "uniform", "a"})
cli.FortioMain(hook)
cli.FortioMain(usage, hook)
if err := shutdown(context.Background()); err != nil {
log.Fatalf("Error shutting down up export pipeline: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module fortio.org/fortiotel
go 1.18

require (
fortio.org/fortio v1.39.0-pre8
fortio.org/fortio v1.39.0-pre9
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.37.0
go.opentelemetry.io/otel v1.11.2
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
fortio.org/assert v1.1.2 h1:t6WGDqPD5VFrUvx30U0+3mgXXcoPonrdKqt0vfJHn8E=
fortio.org/fortio v1.39.0-pre8 h1:aNqeLTMnVywDffa8nmPY1L1BoTiYis74EGicQIquaTQ=
fortio.org/fortio v1.39.0-pre8/go.mod h1:4DhI17BkI3sU0DR4Z2HwochdpphTae+8NgZwWy6epRk=
fortio.org/fortio v1.39.0-pre9 h1:REcy8PzDvXSbkCmodvwNc2qWxGRuwvkl2S9Zo/GneCQ=
fortio.org/fortio v1.39.0-pre9/go.mod h1:4DhI17BkI3sU0DR4Z2HwochdpphTae+8NgZwWy6epRk=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
Expand Down

0 comments on commit da6bc80

Please sign in to comment.