Skip to content

Commit

Permalink
Merge pull request #4788 from axw/backport/7.x/pr-4660
Browse files Browse the repository at this point in the history
[7.x] Vendor go.opentelemetry.io/collector (#4660)
  • Loading branch information
axw authored Feb 18, 2021
2 parents 905b906 + 04cd98f commit c1d6548
Show file tree
Hide file tree
Showing 1,038 changed files with 150,034 additions and 3 deletions.
1 change: 1 addition & 0 deletions .ci/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ test-golang-mage: prepare-test ## Run the tests for the specific app
cp -f ../../go.* golang-mage
mkdir -p golang-mage/approvaltest && cp -f ../../approvaltest/go.* golang-mage/approvaltest
mkdir -p golang-mage/systemtest && cp -f ../../systemtest/go.* golang-mage/systemtest
mkdir -p golang-mage/internal/otel_collector && cp -f ../../internal/otel_collector/go.* golang-mage/internal/otel_collector
@DOCKERFILE=golang-mage bats-core/bin/bats --tap tests | tee target/results.tap
@$(MAKE) -s convert-tests-results

Expand Down
2 changes: 2 additions & 0 deletions .ci/docker/golang-mage/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ WORKDIR $TOOLS
COPY go.mod go.sum ./
COPY approvaltest/go.mod approvaltest/go.sum ./approvaltest/
COPY systemtest/go.mod systemtest/go.sum ./systemtest/
COPY internal/otel_collector/go.mod internal/otel_collector/go.sum ./internal/otel_collector/

RUN go mod download
RUN cd approvaltest && go mod download
RUN cd systemtest && go mod download
RUN cd internal/otel_collector && go mod download

RUN apt-get update -y -qq \
&& apt-get install -y -qq python3 python3-pip python3-venv \
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/.ci/docker/golang-mage/go.*
/.ci/docker/golang-mage/approvaltest/
/.ci/docker/golang-mage/systemtest/
/.ci/docker/golang-mage/internal/otel_collector/
**/*.idea
/build
/data
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ NOTICE.txt: $(PYTHON) go.mod
.PHONY: add-headers
add-headers: $(GOLICENSER)
ifndef CHECK_HEADERS_DISABLED
@$(GOLICENSER) -exclude x-pack
@$(GOLICENSER) -exclude x-pack -exclude internal/otel_collector
@$(GOLICENSER) -license Elastic x-pack
endif

Expand Down Expand Up @@ -222,7 +222,7 @@ check-changelogs: $(PYTHON)
.PHONY: check-headers
check-headers: $(GOLICENSER)
ifndef CHECK_HEADERS_DISABLED
@$(GOLICENSER) -d -exclude build -exclude x-pack
@$(GOLICENSER) -d -exclude build -exclude x-pack -exclude internal/otel_collector
@$(GOLICENSER) -d -exclude build -license Elastic x-pack
endif

Expand Down
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4281,7 +4281,7 @@ Version: v0.17.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/[email protected]/LICENSE:
Contents of probable licence file LICENSE:


Apache License
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ require (
go.elastic.co/apm/module/apmhttp v1.7.2
go.elastic.co/ecszap v0.3.0 // indirect
go.elastic.co/fastjson v1.1.0
go.elastic.co/go-licence-detector v0.5.0
go.opentelemetry.io/collector v0.17.0
go.uber.org/atomic v1.7.0
go.uber.org/multierr v1.6.0 // indirect
Expand Down Expand Up @@ -89,3 +90,5 @@ replace (
k8s.io/apimachinery => k8s.io/apimachinery v0.19.4
k8s.io/client-go => k8s.io/client-go v0.19.4
)

replace go.opentelemetry.io/collector => ./internal/otel_collector
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,8 @@ go.elastic.co/fastjson v1.0.0/go.mod h1:PmeUOMMtLHQr9ZS9J9owrAVg0FkaZDRZJEFTTGHt
go.elastic.co/fastjson v1.1.0 h1:3MrGBWWVIxe/xvsbpghtkFoPciPhOCmjsR/HfwEeQR4=
go.elastic.co/fastjson v1.1.0/go.mod h1:boNGISWMjQsUPy/t6yqt2/1Wx4YNPSe+mZjlyw9vKKI=
go.elastic.co/go-licence-detector v0.4.0/go.mod h1:fSJQU8au4SAgDK+UQFbgUPsXKYNBDv4E/dwWevrMpXU=
go.elastic.co/go-licence-detector v0.5.0 h1:YXPCyt9faKMdJ8uMrkcI4patk8WZ0ME5oaIhYBUsRU4=
go.elastic.co/go-licence-detector v0.5.0/go.mod h1:fSJQU8au4SAgDK+UQFbgUPsXKYNBDv4E/dwWevrMpXU=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
Expand Down
67 changes: 67 additions & 0 deletions internal/.otel_collector_mixin/receiver/otlpreceiver/mixin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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 otlpreceiver

import (
"context"

gatewayruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
"google.golang.org/grpc"

collectorlog "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/collector/logs/v1"
collectormetrics "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/collector/metrics/v1"
collectortrace "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/collector/trace/v1"
"go.opentelemetry.io/collector/receiver/otlpreceiver/logs"
"go.opentelemetry.io/collector/receiver/otlpreceiver/metrics"
"go.opentelemetry.io/collector/receiver/otlpreceiver/trace"
)

// RegisterTraceReceiver registers the trace receiver with a gRPC server and/or grpc-gateway mux, if non-nil.
func RegisterTraceReceiver(ctx context.Context, receiver *trace.Receiver, serverGRPC *grpc.Server, gatewayMux *gatewayruntime.ServeMux) error {
if serverGRPC != nil {
collectortrace.RegisterTraceServiceServer(serverGRPC, receiver)
}
if gatewayMux != nil {
err := collectortrace.RegisterTraceServiceHandlerServer(ctx, gatewayMux, receiver)
if err != nil {
return err
}
// Also register an alias handler. This fixes bug https://github.com/open-telemetry/opentelemetry-collector/issues/1968
return collectortrace.RegisterTraceServiceHandlerServerAlias(ctx, gatewayMux, receiver)
}
return nil
}

// RegisterMetricsReceiver registers the metrics receiver with a gRPC server and/or grpc-gateway mux, if non-nil.
func RegisterMetricsReceiver(ctx context.Context, receiver *metrics.Receiver, serverGRPC *grpc.Server, gatewayMux *gatewayruntime.ServeMux) error {
if serverGRPC != nil {
collectormetrics.RegisterMetricsServiceServer(serverGRPC, receiver)
}
if gatewayMux != nil {
return collectormetrics.RegisterMetricsServiceHandlerServer(ctx, gatewayMux, receiver)
}
return nil
}

// RegisterLogsReceiver registers the logs receiver with a gRPC server and/or grpc-gateway mux, if non-nil.
func RegisterLogsReceiver(ctx context.Context, receiver *logs.Receiver, serverGRPC *grpc.Server, gatewayMux *gatewayruntime.ServeMux) error {
if serverGRPC != nil {
collectorlog.RegisterLogsServiceServer(serverGRPC, receiver)
}
if gatewayMux != nil {
return collectorlog.RegisterLogsServiceHandlerServer(ctx, gatewayMux, receiver)
}
return nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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 defaultcomponents composes the default set of components used by the otel service
package defaultcomponents

import (
"go.opentelemetry.io/collector/component"
)

// Components returns the default set of components used by the
// OpenTelemetry collector.
func Components() (component.Factories, error) {
return component.Factories{}, nil
}
Loading

0 comments on commit c1d6548

Please sign in to comment.