Search code examples
postgresqlgodocker-composeopen-telemetryjaeger

jaeger-all-in-one docker-compose.yaml configurations to store traces to postgresql


Currently, I am using docker-compose.yaml file with a collector-gateway.yaml file as the otel collector for the traces to be sent up to jaeger. What i am trying to achieve is data persistence with postgresql and i am trying to make use of this github repo: text. However, i keep meeting this error upon starting up the docker container with docker-compose up.

Error Log:

jaeger-postgresql-jaeger-all-in-one-1  | {"level":"fatal","ts":1696996008.1216166,"caller":"./main.go:110","msg":"Failed to init storage factory","error":"grpc-plugin builder failed to create a store: error attempting to connect to plugin rpc client: fork/exec /etc/cmd/jaeger-pg-store: exec format error","stacktrace":"main.main.func1\n\t./main.go:110\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/[email protected]/command.go:940\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/[email protected]/command.go:1068\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/[email protected]/command.go:992\nmain.main\n\t./main.go:243\nruntime.main\n\truntime/proc.go:267"}

For more context about my code docker-compose.yaml:

version: "3"
services:
  # Jaeger
  jaeger-all-in-one:
    image: jaegertracing/all-in-one:latest
    ports:
      - "16686:16686"
      - "14268"
      - "14250"
    environment:
      - SPAN_STORAGE_TYPE=grpc-plugin
      - COLLECTOR_OTLP_ENABLED=true
    volumes:
      - ./jaeger-pg-store:/etc/cmd/jaeger-pg-store
      - ./collector-gateway.yaml:/etc/collector-gateway.yaml
    command: ["--grpc-storage-plugin.binary=/etc/cmd/jaeger-pg-store", "--grpc-storage-plugin.configuration-file=/etc/collector-gateway.yaml"]
    
  # Collector
  collector-gateway:
    image: otel/opentelemetry-collector-contrib:0.53.0
    volumes:
      - ./collector-gateway.yaml:/etc/collector-gateway.yaml
      - ./jaeger-pg-store:/etc/cmd
    command: [ "--config=/etc/collector-gateway.yaml"]
    ports:
      - "1888:1888"   # pprof extension
      - "13133:13133" # health_check extension
      - "4317:4317"        # OTLP gRPC receiver
      - "4318:4318"        # OTLP HTTP receiver
      - "55670:55679" # zpages extension
    depends_on:
      - jaeger-all-in-one
    links:
      - jaeger-all-in-one

I have tried building the jaeger-plugin-store with CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin since im on a mac system. Im still relatively new to go in general.

Weirdly enough, when i followed the normal instructions in their readme which was running jaeger-all-in-one as an executable from their binary and not through docker-compose it works but just cannot detect my postgres database. However, i preferably would want to run it with my docker-compose file instead.


Solution

  • The pertinent error is

    fork/exec /etc/cmd/jaeger-pg-store: exec format error
    

    This suggests incompatible binary format. When you're running from within a Docker container, your binary has a different view of the operating system than on your local machine, i.e. the Docker image you're using is built for Linux, but you're trying to point it to a plugin binary built for MacOS. You would need to build the plugin binary for Linux as well.