From 1a2b47bc9ac4e8f7e6f64a6cf6fe79e4c9261c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 8 Aug 2023 15:27:19 +0200 Subject: [PATCH] Delete jaeger example --- example/jaeger/go.mod | 27 ----------- example/jaeger/go.sum | 13 ------ example/jaeger/main.go | 101 ----------------------------------------- 3 files changed, 141 deletions(-) delete mode 100644 example/jaeger/go.mod delete mode 100644 example/jaeger/go.sum delete mode 100644 example/jaeger/main.go diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod deleted file mode 100644 index ce0267c891e..00000000000 --- a/example/jaeger/go.mod +++ /dev/null @@ -1,27 +0,0 @@ -module go.opentelemetry.io/otel/example/jaeger - -go 1.19 - -replace ( - go.opentelemetry.io/otel => ../.. - go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - go.opentelemetry.io/otel/sdk => ../../sdk -) - -require ( - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/jaeger v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 -) - -require ( - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.11.0 // indirect -) - -replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum deleted file mode 100644 index 8089b278d80..00000000000 --- a/example/jaeger/go.sum +++ /dev/null @@ -1,13 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/main.go b/example/jaeger/main.go deleted file mode 100644 index 58b7e8b510e..00000000000 --- a/example/jaeger/main.go +++ /dev/null @@ -1,101 +0,0 @@ -// 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. - -// Command jaeger is an example program that creates spans -// and uploads to Jaeger. -package main - -import ( - "context" - "log" - "time" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/jaeger" - "go.opentelemetry.io/otel/sdk/resource" - tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" -) - -const ( - service = "trace-demo" - environment = "production" - id = 1 -) - -// tracerProvider returns an OpenTelemetry TracerProvider configured to use -// the Jaeger exporter that will send spans to the provided url. The returned -// TracerProvider will also use a Resource configured with all the information -// about the application. -func tracerProvider(url string) (*tracesdk.TracerProvider, error) { - // Create the Jaeger exporter - exp, err := jaeger.New(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint(url))) - if err != nil { - return nil, err - } - tp := tracesdk.NewTracerProvider( - // Always be sure to batch in production. - tracesdk.WithBatcher(exp), - // Record information about this application in a Resource. - tracesdk.WithResource(resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceName(service), - attribute.String("environment", environment), - attribute.Int64("ID", id), - )), - ) - return tp, nil -} - -func main() { - tp, err := tracerProvider("http://localhost:14268/api/traces") - if err != nil { - log.Fatal(err) - } - - // Register our TracerProvider as the global so any imported - // instrumentation in the future will default to using it. - otel.SetTracerProvider(tp) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Cleanly shutdown and flush telemetry when the application exits. - defer func(ctx context.Context) { - // Do not make the application hang when it is shutdown. - ctx, cancel = context.WithTimeout(ctx, time.Second*5) - defer cancel() - if err := tp.Shutdown(ctx); err != nil { - log.Fatal(err) - } - }(ctx) - - tr := tp.Tracer("component-main") - - ctx, span := tr.Start(ctx, "foo") - defer span.End() - - bar(ctx) -} - -func bar(ctx context.Context) { - // Use the global TracerProvider. - tr := otel.Tracer("component-bar") - _, span := tr.Start(ctx, "bar") - span.SetAttributes(attribute.Key("testset").String("value")) - defer span.End() - - // Do bar... -}