Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename plugins directory to instrumentation #47

Merged
merged 3 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@ merge**.

## Adding a new Contrib package

To add a new contrib package follow an existing one. An empty Sample plugin
To add a new contrib package follow an existing one. An empty Sample instrumentation
provides base structure with an example and a test. Each contrib package
should be its own module. A contrib package may contain more than one go package.

### Folder Structure
- plugins/\<plugin-package> (**Common**)
- plugins/\<plugin-package>/trace (**specific to trace**)
- plugins/\<plugin-package>/metrics (**specific to metrics**)
- instrumentation/\<instrumentation-package> (**Common**)
- instrumentation/\<instrumentation-package>/trace (**specific to trace**)
- instrumentation/\<instrumentation-package>/metrics (**specific to metrics**)

#### Example
- plugins/gorm/trace
- plugins/kafka/metrics
- instrumentation/gorm/trace
- instrumentation/kafka/metrics

## Approvers and Maintainers

Expand Down
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This package provides all of its functionality through its
// submodules. The submodules in the exporters directory provide
// implementations for trace and metric exporters for third-party
// collectors, and submodules in the plugins directory provide the
// collectors, and submodules in the instrumentation directory provide the
// instrumentation for the popular go libraries.
package contrib
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/plugins/gin-gonic/gin"
package gin // import "go.opentelemetry.io/contrib/instrumentation/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/plugins/gin-gonic/gin
WORKDIR /src/instrumentation/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 @@ -22,7 +22,7 @@ import (

"github.com/gin-gonic/gin"

gintrace "go.opentelemetry.io/contrib/plugins/gin-gonic/gin"
gintrace "go.opentelemetry.io/contrib/instrumentation/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/plugins/gin-gonic/gin"
tracerName = "go.opentelemetry.io/contrib/instrumentation/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/plugins/gin-gonic/gin", mockTracer.Name)
assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/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,4 +1,4 @@
module go.opentelemetry.io/contrib/plugins/gin-gonic/gin
module go.opentelemetry.io/contrib/instrumentation/gin-gonic/gin

go 1.14

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Option func(*Config)

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

const (
defaultTracerName = "go.opentelemetry.io/contrib/plugins/go.mongodb.org/mongo-driver"
defaultTracerName = "go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver"
)

// Config is used to configure the mongo tracer.
Expand All @@ -45,7 +45,7 @@ type Option func(*Config)

// WithTracer specifies a tracer to use for creating spans. If none is
// specified, a tracer named
// "go.opentelemetry.io/contrib/plugins/go.mongodb.org/mongo-driver"
// "go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver"
// from the global provider is used.
func WithTracer(tracer trace.Tracer) Option {
return func(cfg *Config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
// This code was originally based on the following:
// - https://github.com/DataDog/dd-trace-go/tree/02f0449efa3cb382d499fadc873957385dcb2192/contrib/go.mongodb.org/mongo-driver/mongo
// - https://github.com/DataDog/dd-trace-go/tree/v1.23.3/ddtrace/ext
package mongo // import "go.opentelemetry.io/contrib/plugins/go.mongodb.org/mongo-driver"
package mongo // import "go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver"
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"

mongotrace "go.opentelemetry.io/contrib/plugins/go.mongodb.org/mongo-driver"
mongotrace "go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver"
)

func Example() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module go.opentelemetry.io/contrib/plugins/go.mongodb.org/mongo-driver
module go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver

go 1.13

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

// WithTracer specifies a tracer to use for creating spans. If none is
// specified, a tracer named
// "go.opentelemetry.io/contrib/plugins/gorilla/mux" from the global
// "go.opentelemetry.io/contrib/instrumentation/gorilla/mux" from the global
// provider is used.
func WithTracer(tracer oteltrace.Tracer) Option {
return func(cfg *Config) {
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/plugins/gorilla/mux"
package mux // import "go.opentelemetry.io/contrib/instrumentation/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/plugins/gorilla/mux
WORKDIR /src/instrumentation/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 @@ -22,7 +22,7 @@ import (

"github.com/gorilla/mux"

muxtrace "go.opentelemetry.io/contrib/plugins/gorilla/mux"
muxtrace "go.opentelemetry.io/contrib/instrumentation/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,4 +1,4 @@
module go.opentelemetry.io/contrib/plugins/gorilla/mux
module go.opentelemetry.io/contrib/instrumentation/gorilla/mux

go 1.14

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/plugins/gorilla/mux"
tracerName = "go.opentelemetry.io/contrib/instrumentation/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/plugins/gorilla/mux", mockTracer.Name)
assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/gorilla/mux", mockTracer.Name)
w.WriteHeader(http.StatusOK)
}))

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

// WithTracer specifies a tracer to use for creating spans. If none is
// specified, a tracer named
// "go.opentelemetry.io/contrib/plugins/labstack/echo" from the global
// "go.opentelemetry.io/contrib/instrumentation/labstack/echo" from the global
// provider is used.
func WithTracer(tracer oteltrace.Tracer) Option {
return func(cfg *Config) {
Expand Down
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/plugins/labstack/echo"
tracerName = "go.opentelemetry.io/contrib/instrumentation/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/plugins/labstack/echo", mockTracer.Name)
assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/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/plugins/labstack/echo
WORKDIR /src/instrumentation/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 @@ -21,7 +21,7 @@ import (

"github.com/labstack/echo/v4"

echotrace "go.opentelemetry.io/contrib/plugins/labstack/echo"
echotrace "go.opentelemetry.io/contrib/instrumentation/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,4 +1,4 @@
module go.opentelemetry.io/contrib/plugins/labstack/echo
module go.opentelemetry.io/contrib/instrumentation/labstack/echo

go 1.14

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Option func(*Config)

// WithTracer specifies a tracer to use for creating spans. If none is
// specified, a tracer named
// "go.opentelemetry.io/contrib/plugins/macaron" from the global
// "go.opentelemetry.io/contrib/instrumentation/macaron" from the global
// provider is used.
func WithTracer(tracer trace.Tracer) Option {
return func(cfg *Config) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/macaron/doc.go → instrumentation/macaron/doc.go
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 macaron // import "go.opentelemetry.io/contrib/plugins/macaron"
package macaron // import "go.opentelemetry.io/contrib/instrumentation/macaron"
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/plugins/macaron
WORKDIR /src/instrumentation/macaron

FROM base AS macaron-server
RUN go install ./example/server.go
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"gopkg.in/macaron.v1"

macarontrace "go.opentelemetry.io/contrib/plugins/macaron"
macarontrace "go.opentelemetry.io/contrib/instrumentation/macaron"

otelglobal "go.opentelemetry.io/otel/api/global"
otelkv "go.opentelemetry.io/otel/api/kv"
Expand Down
2 changes: 1 addition & 1 deletion plugins/macaron/go.mod → instrumentation/macaron/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module go.opentelemetry.io/contrib/plugins/macaron
module go.opentelemetry.io/contrib/instrumentation/macaron

go 1.14

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

const (
tracerName = "go.opentelemetry.io/contrib/plugins/macaron"
tracerName = "go.opentelemetry.io/contrib/instrumentation/macaron"
)

// Middleware returns a macaron Handler to trace requests to the server.
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/plugins/macaron", mockTracer.Name)
assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/macaron", mockTracer.Name)
ctx.Resp.WriteHeader(http.StatusOK)
})

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
metricstdout "go.opentelemetry.io/otel/exporters/metric/stdout"
"go.opentelemetry.io/otel/sdk/metric/controller/push"

"go.opentelemetry.io/contrib/plugins/runtime"
"go.opentelemetry.io/contrib/instrumentation/runtime"
)

func initMeter() *push.Controller {
Expand Down
2 changes: 1 addition & 1 deletion plugins/runtime/go.mod → instrumentation/runtime/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module go.opentelemetry.io/contrib/plugins/runtime
module go.opentelemetry.io/contrib/instrumentation/runtime

go 1.14

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package runtime // import "go.opentelemetry.io/contrib/plugins/runtime"
package runtime // import "go.opentelemetry.io/contrib/instrumentation/runtime"

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/stretchr/testify/assert"

"go.opentelemetry.io/contrib/plugins/runtime"
"go.opentelemetry.io/contrib/instrumentation/runtime"

"go.opentelemetry.io/otel/api/global"
)
Expand Down