From c8e60d1357918f1349e510d92d38609d7d739dd1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 13 Nov 2023 08:40:40 -0800 Subject: [PATCH] Remove the deprecated view example (#4708) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove the deprecated view example * Update PR number in changelog * Update versions.yaml --------- Co-authored-by: Robert PajÄ…k --- CHANGELOG.md | 1 + example/view/doc.go | 18 -------- example/view/go.mod | 40 ------------------ example/view/go.sum | 37 ----------------- example/view/main.go | 98 -------------------------------------------- versions.yaml | 1 - 6 files changed, 1 insertion(+), 194 deletions(-) delete mode 100644 example/view/doc.go delete mode 100644 example/view/go.mod delete mode 100644 example/view/go.sum delete mode 100644 example/view/main.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 05e0d6564a9..af98ee9cf0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Removed - Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706) +- Remove the deprecated `go.opentelemetry.io/otel/example/view` module. (#4708) ## [1.20.0/0.43.0] 2023-11-10 diff --git a/example/view/doc.go b/example/view/doc.go deleted file mode 100644 index ccf2a205d98..00000000000 --- a/example/view/doc.go +++ /dev/null @@ -1,18 +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. - -// Package main provides a code sample of using metric views to customize instruments. -// -// Deprecated: See [go.opentelemetry.io/otel/example/prometheus] instead. -package main diff --git a/example/view/go.mod b/example/view/go.mod deleted file mode 100644 index 328dfc304a6..00000000000 --- a/example/view/go.mod +++ /dev/null @@ -1,40 +0,0 @@ -// Deprecated: see go.opentelemetry.io/otel/example/prometheus instead. -module go.opentelemetry.io/otel/example/view - -go 1.20 - -require ( - github.com/prometheus/client_golang v1.17.0 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/prometheus v0.43.0 - go.opentelemetry.io/otel/metric v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/sdk/metric v1.20.0 -) - -require ( - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/go-logr/logr v1.3.0 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.11.1 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect - golang.org/x/sys v0.14.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect -) - -replace go.opentelemetry.io/otel => ../.. - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/view/go.sum b/example/view/go.sum deleted file mode 100644 index 45bf221777f..00000000000 --- a/example/view/go.sum +++ /dev/null @@ -1,37 +0,0 @@ -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -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.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -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/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= -github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= -github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/view/main.go b/example/view/main.go deleted file mode 100644 index 876457052b9..00000000000 --- a/example/view/main.go +++ /dev/null @@ -1,98 +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. - -package main - -import ( - "context" - "fmt" - "log" - "net/http" - "os" - "os/signal" - - "github.com/prometheus/client_golang/prometheus/promhttp" - - "go.opentelemetry.io/otel/attribute" - otelprom "go.opentelemetry.io/otel/exporters/prometheus" - api "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric" -) - -const meterName = "github.com/open-telemetry/opentelemetry-go/example/view" - -func main() { - ctx := context.Background() - - // The exporter embeds a default OpenTelemetry Reader, allowing it to be used in WithReader. - exporter, err := otelprom.New() - if err != nil { - log.Fatal(err) - } - - provider := metric.NewMeterProvider( - metric.WithReader(exporter), - // View to customize histogram buckets and rename a single histogram instrument. - metric.WithView(metric.NewView( - metric.Instrument{ - Name: "custom_histogram", - Scope: instrumentation.Scope{Name: meterName}, - }, - metric.Stream{ - Name: "bar", - Aggregation: metric.AggregationExplicitBucketHistogram{ - Boundaries: []float64{64, 128, 256, 512, 1024, 2048, 4096}, - }, - }, - )), - ) - meter := provider.Meter(meterName) - - // Start the prometheus HTTP server and pass the exporter Collector to it - go serveMetrics() - - opt := api.WithAttributes( - attribute.Key("A").String("B"), - attribute.Key("C").String("D"), - ) - - counter, err := meter.Float64Counter("foo", api.WithDescription("a simple counter")) - if err != nil { - log.Fatal(err) - } - counter.Add(ctx, 5, opt) - - histogram, err := meter.Float64Histogram("custom_histogram", api.WithDescription("a histogram with custom buckets and rename")) - if err != nil { - log.Fatal(err) - } - histogram.Record(ctx, 136, opt) - histogram.Record(ctx, 64, opt) - histogram.Record(ctx, 701, opt) - histogram.Record(ctx, 830, opt) - - ctx, _ = signal.NotifyContext(ctx, os.Interrupt) - <-ctx.Done() -} - -func serveMetrics() { - log.Printf("serving metrics at localhost:2222/metrics") - http.Handle("/metrics", promhttp.Handler()) - err := http.ListenAndServe(":2222", nil) //nolint:gosec // Ignoring G114: Use of net/http serve function that has no support for setting timeouts. - if err != nil { - fmt.Printf("error serving http: %v", err) - return - } -} diff --git a/versions.yaml b/versions.yaml index 82366e79981..c8c4ad6e20a 100644 --- a/versions.yaml +++ b/versions.yaml @@ -41,7 +41,6 @@ module-sets: - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus - - go.opentelemetry.io/otel/example/view - go.opentelemetry.io/otel/exporters/otlp/otlpmetric - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp