From 115543e7605b48336bfe6379045acc66731126cf Mon Sep 17 00:00:00 2001 From: Anthony J Mirabella Date: Mon, 22 Mar 2021 17:54:10 -0400 Subject: [PATCH] Update demo app to build image and use otel-go v0.19.0 --- examples/demo/app/Dockerfile | 19 +++++++++++++++++++ examples/demo/app/main.go | 2 +- examples/demo/docker-compose.yaml | 10 ++++------ 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 examples/demo/app/Dockerfile diff --git a/examples/demo/app/Dockerfile b/examples/demo/app/Dockerfile new file mode 100644 index 00000000000..97c758351a7 --- /dev/null +++ b/examples/demo/app/Dockerfile @@ -0,0 +1,19 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FROM golang:1.14 +COPY . /usr/src/app/ +WORKDIR /usr/src/app/ +RUN go env -w GOPROXY=direct +RUN go install ./main.go +CMD ["/go/bin/main"] diff --git a/examples/demo/app/main.go b/examples/demo/app/main.go index 1fd86a0a07a..8131d0b838c 100644 --- a/examples/demo/app/main.go +++ b/examples/demo/app/main.go @@ -47,7 +47,7 @@ func initProvider() func() { otelAgentAddr, ok := os.LookupEnv("OTEL_AGENT_ENDPOINT") if !ok { - otelAgentAddr = "0.0.0.0:55680" + otelAgentAddr = "0.0.0.0:4317" } exp, err := otlp.NewExporter(ctx, otlpgrpc.NewDriver( diff --git a/examples/demo/docker-compose.yaml b/examples/demo/docker-compose.yaml index a5dacb65fe8..1dff693ea73 100644 --- a/examples/demo/docker-compose.yaml +++ b/examples/demo/docker-compose.yaml @@ -67,13 +67,11 @@ services: - otel-agent metrics-load-generator: - image: golang:1.12.7 - volumes: - - ./app/main.go:/usr/src/main.go + build: + dockerfile: $PWD/app/Dockerfile + context: ./app environment: - - GO111MODULE=on - - OTEL_AGENT_ENDPOINT=otel-agent:55678 - command: ["bash", "-c", "go run /usr/src/main.go"] + - OTEL_AGENT_ENDPOINT=otel-agent:4317 depends_on: - otel-agent