Skip to content

Commit

Permalink
Move all github.com instrumentation plugins down one level in directo…
Browse files Browse the repository at this point in the history
…ry hierarchy (#118)

* Moved all github.com instrumentation plugins below github.com

Fix up all example docker-compose/Dockerfile

* Add doc.go to labstack/echo for consistency with other plugins

* Fix up CHANGELOG
  • Loading branch information
evantorrie authored Jul 1, 2020
1 parent a24a7d5 commit 370078e
Show file tree
Hide file tree
Showing 31 changed files with 54 additions and 30 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Changed
### Additions

- Add `emicklei/go-restful/v3` trace instrumentation. (#115)

### Changed

- Move all github.com package instrumentation under a github.com directory. (#118)
- Update `CONTRIBUTING.md` to ask for updates to `CHANGELOG.md` with each pull request. (#114)
- Create this `CHANGELOG.md`. (#114)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
// instrumenting the routing of a received message (the Middleware
// function) and instrumenting the response generation through
// template evaluation (the HTML function).
package gin // import "go.opentelemetry.io/contrib/instrumentation/gin-gonic/gin"
package gin // import "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin"
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
FROM golang:alpine AS base
COPY . /src/
WORKDIR /src/instrumentation/gin-gonic/gin
WORKDIR /src/instrumentation/github.com/gin-gonic/gin

FROM base AS gin-server
RUN go install ./example/server.go
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
gin-server:
build:
dockerfile: $PWD/Dockerfile
context: ../../../..
context: ../../../../..
ports:
- "8080:80"
command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/gin-gonic/gin"

gintrace "go.opentelemetry.io/contrib/instrumentation/gin-gonic/gin"
gintrace "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin"
otelglobal "go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/kv"
oteltrace "go.opentelemetry.io/otel/api/trace"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (

const (
tracerKey = "otel-go-contrib-tracer"
tracerName = "go.opentelemetry.io/contrib/instrumentation/gin-gonic/gin"
tracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin"
)

// Middleware returns middleware that will trace incoming requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestChildSpanFromGlobalTracer(t *testing.T) {
spanTracer := span.Tracer()
mockTracer, ok := spanTracer.(*mocktrace.Tracer)
require.True(t, ok)
assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/gin-gonic/gin", mockTracer.Name)
assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin", mockTracer.Name)
})

r := httptest.NewRequest("GET", "/user/123", nil)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module go.opentelemetry.io/contrib/instrumentation/gin-gonic/gin
module go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin

go 1.14

replace go.opentelemetry.io/contrib => ../../..
replace go.opentelemetry.io/contrib => ../../../..

require (
github.com/gin-gonic/gin v1.6.3
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ type Option func(*Config)

// WithTracer specifies a tracer to use for creating spans. If none is
// specified, a tracer named
// "go.opentelemetry.io/contrib/instrumentation/gin-gonic/gin" from the global
// provider is used.
// "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin"
// from the global provider is used.
func WithTracer(tracer oteltrace.Tracer) Option {
return func(cfg *Config) {
cfg.Tracer = tracer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type Option func(*Config)

// WithTracer specifies a tracer to use for creating spans. If none is
// specified, a tracer named
// "go.opentelemetry.io/contrib/instrumentation/gorilla/mux" from the global
// provider is used.
// "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux"
// from the global provider is used.
func WithTracer(tracer oteltrace.Tracer) Option {
return func(cfg *Config) {
cfg.Tracer = tracer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
//
// Currently only the routing of a received message can be
// instrumented. To do it, use the Middleware function.
package mux // import "go.opentelemetry.io/contrib/instrumentation/gorilla/mux"
package mux // import "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux"
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
FROM golang:alpine AS base
COPY . /src/
WORKDIR /src/instrumentation/gorilla/mux
WORKDIR /src/instrumentation/github.com/gorilla/mux

FROM base AS mux-server
RUN go install ./example/server.go
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
mux-server:
build:
dockerfile: $PWD/Dockerfile
context: ../../../..
context: ../../../../..
ports:
- "8080:80"
command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/gorilla/mux"

muxtrace "go.opentelemetry.io/contrib/instrumentation/gorilla/mux"
muxtrace "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux"
otelglobal "go.opentelemetry.io/otel/api/global"
otelkv "go.opentelemetry.io/otel/api/kv"
oteltrace "go.opentelemetry.io/otel/api/trace"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module go.opentelemetry.io/contrib/instrumentation/gorilla/mux
module go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux

go 1.14

replace go.opentelemetry.io/contrib => ../../..
replace go.opentelemetry.io/contrib => ../../../..

require (
github.com/gorilla/mux v1.7.4
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
)

const (
tracerName = "go.opentelemetry.io/contrib/instrumentation/gorilla/mux"
tracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux"
)

// Middleware sets up a handler to start tracing the incoming
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestChildSpanFromGlobalTracer(t *testing.T) {
spanTracer := span.Tracer()
mockTracer, ok := spanTracer.(*mocktrace.Tracer)
require.True(t, ok)
assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/gorilla/mux", mockTracer.Name)
assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux", mockTracer.Name)
w.WriteHeader(http.StatusOK)
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type Option func(*Config)

// WithTracer specifies a tracer to use for creating spans. If none is
// specified, a tracer named
// "go.opentelemetry.io/contrib/instrumentation/labstack/echo" from the global
// provider is used.
// "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo"
// from the global provider is used.
func WithTracer(tracer oteltrace.Tracer) Option {
return func(cfg *Config) {
cfg.Tracer = tracer
Expand Down
20 changes: 20 additions & 0 deletions instrumentation/github.com/labstack/echo/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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 echo provides functions to trace the labstack/echo package
// (https://github.com/labstack/echo).
//
// Currently only the routing of a received message can be
// instrumented. To do so, use the Middleware function.
package echo // import "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo"
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

const (
tracerKey = "otel-go-contrib-tracer-labstack-echo"
tracerName = "go.opentelemetry.io/contrib/instrumentation/labstack/echo"
tracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo"
)

// Middleware returns echo middleware which will trace incoming requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestChildSpanFromGlobalTracer(t *testing.T) {
spanTracer := span.Tracer()
mockTracer, ok := spanTracer.(*mocktrace.Tracer)
require.True(t, ok)
assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/labstack/echo", mockTracer.Name)
assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo", mockTracer.Name)
return c.NoContent(200)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
FROM golang:alpine AS base
COPY . /src/
WORKDIR /src/instrumentation/labstack/echo
WORKDIR /src/instrumentation/github.com/labstack/echo

FROM base AS echo-server
RUN go install ./example/server.go
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
echo-server:
build:
dockerfile: $PWD/Dockerfile
context: ../../../..
context: ../../../../..
ports:
- "8080:80"
command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/labstack/echo/v4"

echotrace "go.opentelemetry.io/contrib/instrumentation/labstack/echo"
echotrace "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo"
otelglobal "go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/kv"
oteltrace "go.opentelemetry.io/otel/api/trace"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module go.opentelemetry.io/contrib/instrumentation/labstack/echo
module go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo

go 1.14

replace go.opentelemetry.io/contrib => ../../..
replace go.opentelemetry.io/contrib => ../../../..

require (
github.com/labstack/echo/v4 v4.1.16
Expand Down
File renamed without changes.

0 comments on commit 370078e

Please sign in to comment.