Worked out crazy proto scheme
Signed-off-by: Joe Elliott <number101010@gmail.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[submodule "opentelemetry-proto"]
|
||||
path = opentelemetry-proto
|
||||
url = https://github.com/open-telemetry/opentelemetry-proto
|
||||
@@ -76,14 +76,24 @@ endif
|
||||
|
||||
.PHONY: gen-proto
|
||||
gen-proto:
|
||||
vend -package
|
||||
protoc -I vendor/github.com/open-telemetry/opentelemetry-proto -I pkg/tempopb/ pkg/tempopb/tempo.proto --go_out=plugins=grpc:pkg/tempopb
|
||||
$(MAKE) vendor-dependencies
|
||||
git submodule init
|
||||
rm -rf ./vendor/github.com/open-telemetry/opentelemetry-proto
|
||||
protoc -I opentelemetry-proto/ opentelemetry-proto/opentelemetry/proto/common/v1/common.proto --gogofast_out=plugins=grpc:./vendor
|
||||
protoc -I opentelemetry-proto/ opentelemetry-proto/opentelemetry/proto/resource/v1/resource.proto --gogofast_out=plugins=grpc:./vendor
|
||||
protoc -I opentelemetry-proto/ opentelemetry-proto/opentelemetry/proto/logs/v1/logs.proto --gogofast_out=plugins=grpc:./vendor
|
||||
protoc -I opentelemetry-proto/ opentelemetry-proto/opentelemetry/proto/metrics/v1/metrics.proto --gogofast_out=plugins=grpc:./vendor
|
||||
protoc -I opentelemetry-proto/ opentelemetry-proto/opentelemetry/proto/trace/v1/trace.proto --gogofast_out=plugins=grpc:./vendor
|
||||
protoc -I opentelemetry-proto/ opentelemetry-proto/opentelemetry/proto/collector/logs/v1/logs_service.proto --gogofast_out=plugins=grpc:./vendor
|
||||
protoc -I opentelemetry-proto/ opentelemetry-proto/opentelemetry/proto/collector/metrics/v1/metrics_service.proto --gogofast_out=plugins=grpc:./vendor
|
||||
protoc -I opentelemetry-proto/ opentelemetry-proto/opentelemetry/proto/collector/trace/v1/trace_service.proto --gogofast_out=plugins=grpc:./vendor
|
||||
protoc -I opentelemetry-proto/ -I pkg/tempopb/ pkg/tempopb/tempo.proto --gogofast_out=plugins=grpc:pkg/tempopb
|
||||
|
||||
.PHONY: vendor-dependencies
|
||||
vendor-dependencies:
|
||||
go mod tidy
|
||||
go mod vendor
|
||||
find | grep 'vendor/go.opentelemetry.io.*go$\' | xargs -L 1 sed -i 's+go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/+github.com/open-telemetry/opentelemetry-proto/gen/go/+g'
|
||||
|
||||
|
||||
.PHONY: install-tools
|
||||
install-tools:
|
||||
|
||||
@@ -4,7 +4,6 @@ go 1.15
|
||||
|
||||
require (
|
||||
cloud.google.com/go/storage v1.6.0
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect
|
||||
github.com/cortexproject/cortex v0.7.0
|
||||
github.com/go-kit/kit v0.10.0
|
||||
github.com/gogo/protobuf v1.3.1
|
||||
@@ -33,7 +32,6 @@ require (
|
||||
go.uber.org/atomic v1.6.0
|
||||
go.uber.org/ratelimit v0.1.0
|
||||
go.uber.org/zap v1.15.0
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344
|
||||
google.golang.org/api v0.29.0
|
||||
google.golang.org/grpc v1.29.1
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
|
||||
Submodule
+1
Submodule opentelemetry-proto added at 7964dd8ea4
@@ -1 +0,0 @@
|
||||
package receiver
|
||||
@@ -1,3 +0,0 @@
|
||||
package tempopb
|
||||
|
||||
import _ "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1" // force vend to pull in the entire package and copy protos over
|
||||
+1011
-79
File diff suppressed because it is too large
Load Diff
-201
@@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
Generated
Vendored
+576
@@ -0,0 +1,576 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: opentelemetry/proto/collector/logs/v1/logs_service.proto
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/logs/v1"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type ExportLogsServiceRequest struct {
|
||||
// An array of ResourceLogs.
|
||||
// For data coming from a single resource this array will typically contain one
|
||||
// element. Intermediary nodes (such as OpenTelemetry Collector) that receive
|
||||
// data from multiple origins typically batch the data before forwarding further and
|
||||
// in that case this array will contain multiple elements.
|
||||
ResourceLogs []*v1.ResourceLogs `protobuf:"bytes,1,rep,name=resource_logs,json=resourceLogs,proto3" json:"resource_logs,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ExportLogsServiceRequest) Reset() { *m = ExportLogsServiceRequest{} }
|
||||
func (m *ExportLogsServiceRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ExportLogsServiceRequest) ProtoMessage() {}
|
||||
func (*ExportLogsServiceRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8e3bf87aaa43acd4, []int{0}
|
||||
}
|
||||
func (m *ExportLogsServiceRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ExportLogsServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ExportLogsServiceRequest.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *ExportLogsServiceRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ExportLogsServiceRequest.Merge(m, src)
|
||||
}
|
||||
func (m *ExportLogsServiceRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ExportLogsServiceRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ExportLogsServiceRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ExportLogsServiceRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ExportLogsServiceRequest) GetResourceLogs() []*v1.ResourceLogs {
|
||||
if m != nil {
|
||||
return m.ResourceLogs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ExportLogsServiceResponse struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ExportLogsServiceResponse) Reset() { *m = ExportLogsServiceResponse{} }
|
||||
func (m *ExportLogsServiceResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ExportLogsServiceResponse) ProtoMessage() {}
|
||||
func (*ExportLogsServiceResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8e3bf87aaa43acd4, []int{1}
|
||||
}
|
||||
func (m *ExportLogsServiceResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ExportLogsServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ExportLogsServiceResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *ExportLogsServiceResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ExportLogsServiceResponse.Merge(m, src)
|
||||
}
|
||||
func (m *ExportLogsServiceResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ExportLogsServiceResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ExportLogsServiceResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ExportLogsServiceResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ExportLogsServiceRequest)(nil), "opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest")
|
||||
proto.RegisterType((*ExportLogsServiceResponse)(nil), "opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("opentelemetry/proto/collector/logs/v1/logs_service.proto", fileDescriptor_8e3bf87aaa43acd4)
|
||||
}
|
||||
|
||||
var fileDescriptor_8e3bf87aaa43acd4 = []byte{
|
||||
// 276 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xc8, 0x2f, 0x48, 0xcd,
|
||||
0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7,
|
||||
0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0xcf, 0xc9, 0x4f, 0x2f, 0xd6, 0x2f,
|
||||
0x33, 0x04, 0xd3, 0xf1, 0xc5, 0xa9, 0x45, 0x65, 0x99, 0xc9, 0xa9, 0x7a, 0x60, 0x45, 0x42, 0xaa,
|
||||
0x28, 0x3a, 0x21, 0x82, 0x7a, 0x70, 0x9d, 0x7a, 0x20, 0x1d, 0x7a, 0x65, 0x86, 0x52, 0x6a, 0xd8,
|
||||
0x2c, 0x40, 0x36, 0x16, 0xa2, 0x53, 0x29, 0x8b, 0x4b, 0xc2, 0xb5, 0xa2, 0x20, 0xbf, 0xa8, 0xc4,
|
||||
0x27, 0x3f, 0xbd, 0x38, 0x18, 0x62, 0x53, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x90, 0x1f,
|
||||
0x17, 0x6f, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x51, 0x72, 0x6a, 0x3c, 0x48, 0x8b, 0x04, 0xa3, 0x02,
|
||||
0xb3, 0x06, 0xb7, 0x91, 0xa6, 0x1e, 0x36, 0x27, 0x40, 0x2d, 0xd6, 0x0b, 0x82, 0xea, 0x00, 0x99,
|
||||
0x17, 0xc4, 0x53, 0x84, 0xc4, 0x53, 0x92, 0xe6, 0x92, 0xc4, 0x62, 0x57, 0x71, 0x41, 0x7e, 0x5e,
|
||||
0x71, 0xaa, 0xd1, 0x5c, 0x46, 0x2e, 0x6e, 0x24, 0x71, 0xa1, 0x5e, 0x46, 0x2e, 0x36, 0x88, 0x6a,
|
||||
0x21, 0x7b, 0x3d, 0xa2, 0xfc, 0xac, 0x87, 0xcb, 0x23, 0x52, 0x0e, 0xe4, 0x1b, 0x00, 0x71, 0x9d,
|
||||
0x12, 0x83, 0xd3, 0x24, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48,
|
||||
0x8e, 0x91, 0x4b, 0x23, 0x33, 0x9f, 0x38, 0x43, 0x9d, 0x04, 0x90, 0xcc, 0x0b, 0x00, 0xa9, 0x09,
|
||||
0x60, 0x8c, 0x72, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x99,
|
||||
0xa2, 0x8b, 0x88, 0x29, 0x14, 0x43, 0x75, 0x21, 0xf1, 0x96, 0x9e, 0x9a, 0xa7, 0x9f, 0x8e, 0x25,
|
||||
0x7d, 0x24, 0xb1, 0x81, 0xe5, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xca, 0x59, 0x77, 0x80,
|
||||
0x4f, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// LogsServiceClient is the client API for LogsService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type LogsServiceClient interface {
|
||||
// For performance reasons, it is recommended to keep this RPC
|
||||
// alive for the entire life of the application.
|
||||
Export(ctx context.Context, in *ExportLogsServiceRequest, opts ...grpc.CallOption) (*ExportLogsServiceResponse, error)
|
||||
}
|
||||
|
||||
type logsServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewLogsServiceClient(cc *grpc.ClientConn) LogsServiceClient {
|
||||
return &logsServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *logsServiceClient) Export(ctx context.Context, in *ExportLogsServiceRequest, opts ...grpc.CallOption) (*ExportLogsServiceResponse, error) {
|
||||
out := new(ExportLogsServiceResponse)
|
||||
err := c.cc.Invoke(ctx, "/opentelemetry.proto.collector.logs.v1.LogsService/Export", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// LogsServiceServer is the server API for LogsService service.
|
||||
type LogsServiceServer interface {
|
||||
// For performance reasons, it is recommended to keep this RPC
|
||||
// alive for the entire life of the application.
|
||||
Export(context.Context, *ExportLogsServiceRequest) (*ExportLogsServiceResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedLogsServiceServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedLogsServiceServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedLogsServiceServer) Export(ctx context.Context, req *ExportLogsServiceRequest) (*ExportLogsServiceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Export not implemented")
|
||||
}
|
||||
|
||||
func RegisterLogsServiceServer(s *grpc.Server, srv LogsServiceServer) {
|
||||
s.RegisterService(&_LogsService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _LogsService_Export_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExportLogsServiceRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LogsServiceServer).Export(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/opentelemetry.proto.collector.logs.v1.LogsService/Export",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LogsServiceServer).Export(ctx, req.(*ExportLogsServiceRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _LogsService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "opentelemetry.proto.collector.logs.v1.LogsService",
|
||||
HandlerType: (*LogsServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Export",
|
||||
Handler: _LogsService_Export_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "opentelemetry/proto/collector/logs/v1/logs_service.proto",
|
||||
}
|
||||
|
||||
func (m *ExportLogsServiceRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *ExportLogsServiceRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ExportLogsServiceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i -= len(m.XXX_unrecognized)
|
||||
copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
if len(m.ResourceLogs) > 0 {
|
||||
for iNdEx := len(m.ResourceLogs) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.ResourceLogs[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintLogsService(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *ExportLogsServiceResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *ExportLogsServiceResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ExportLogsServiceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i -= len(m.XXX_unrecognized)
|
||||
copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintLogsService(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovLogsService(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *ExportLogsServiceRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.ResourceLogs) > 0 {
|
||||
for _, e := range m.ResourceLogs {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovLogsService(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ExportLogsServiceResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovLogsService(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozLogsService(x uint64) (n int) {
|
||||
return sovLogsService(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *ExportLogsServiceRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowLogsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: ExportLogsServiceRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ExportLogsServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ResourceLogs", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowLogsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthLogsService
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthLogsService
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ResourceLogs = append(m.ResourceLogs, &v1.ResourceLogs{})
|
||||
if err := m.ResourceLogs[len(m.ResourceLogs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipLogsService(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthLogsService
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthLogsService
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ExportLogsServiceResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowLogsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: ExportLogsServiceResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ExportLogsServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipLogsService(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthLogsService
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthLogsService
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipLogsService(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowLogsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowLogsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowLogsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthLogsService
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupLogsService
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthLogsService
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthLogsService = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowLogsService = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupLogsService = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
Generated
Vendored
+576
@@ -0,0 +1,576 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: opentelemetry/proto/collector/metrics/v1/metrics_service.proto
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type ExportMetricsServiceRequest struct {
|
||||
// An array of ResourceMetrics.
|
||||
// For data coming from a single resource this array will typically contain one
|
||||
// element. Intermediary nodes (such as OpenTelemetry Collector) that receive
|
||||
// data from multiple origins typically batch the data before forwarding further and
|
||||
// in that case this array will contain multiple elements.
|
||||
ResourceMetrics []*v1.ResourceMetrics `protobuf:"bytes,1,rep,name=resource_metrics,json=resourceMetrics,proto3" json:"resource_metrics,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ExportMetricsServiceRequest) Reset() { *m = ExportMetricsServiceRequest{} }
|
||||
func (m *ExportMetricsServiceRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ExportMetricsServiceRequest) ProtoMessage() {}
|
||||
func (*ExportMetricsServiceRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_75fb6015e6e64798, []int{0}
|
||||
}
|
||||
func (m *ExportMetricsServiceRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ExportMetricsServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ExportMetricsServiceRequest.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *ExportMetricsServiceRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ExportMetricsServiceRequest.Merge(m, src)
|
||||
}
|
||||
func (m *ExportMetricsServiceRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ExportMetricsServiceRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ExportMetricsServiceRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ExportMetricsServiceRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ExportMetricsServiceRequest) GetResourceMetrics() []*v1.ResourceMetrics {
|
||||
if m != nil {
|
||||
return m.ResourceMetrics
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ExportMetricsServiceResponse struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ExportMetricsServiceResponse) Reset() { *m = ExportMetricsServiceResponse{} }
|
||||
func (m *ExportMetricsServiceResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ExportMetricsServiceResponse) ProtoMessage() {}
|
||||
func (*ExportMetricsServiceResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_75fb6015e6e64798, []int{1}
|
||||
}
|
||||
func (m *ExportMetricsServiceResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ExportMetricsServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ExportMetricsServiceResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *ExportMetricsServiceResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ExportMetricsServiceResponse.Merge(m, src)
|
||||
}
|
||||
func (m *ExportMetricsServiceResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ExportMetricsServiceResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ExportMetricsServiceResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ExportMetricsServiceResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ExportMetricsServiceRequest)(nil), "opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest")
|
||||
proto.RegisterType((*ExportMetricsServiceResponse)(nil), "opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("opentelemetry/proto/collector/metrics/v1/metrics_service.proto", fileDescriptor_75fb6015e6e64798)
|
||||
}
|
||||
|
||||
var fileDescriptor_75fb6015e6e64798 = []byte{
|
||||
// 276 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xcb, 0x2f, 0x48, 0xcd,
|
||||
0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7,
|
||||
0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0x07, 0x89, 0x66, 0x26, 0x17, 0xeb,
|
||||
0x97, 0x19, 0xc2, 0x98, 0xf1, 0xc5, 0xa9, 0x45, 0x65, 0x99, 0xc9, 0xa9, 0x7a, 0x60, 0xa5, 0x42,
|
||||
0x1a, 0x28, 0xfa, 0x21, 0x82, 0x7a, 0x70, 0xfd, 0x7a, 0x50, 0x4d, 0x7a, 0x65, 0x86, 0x52, 0x3a,
|
||||
0xd8, 0x6c, 0xc2, 0x34, 0x1f, 0x62, 0x84, 0x52, 0x25, 0x97, 0xb4, 0x6b, 0x45, 0x41, 0x7e, 0x51,
|
||||
0x89, 0x2f, 0x44, 0x38, 0x18, 0x62, 0x6b, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x50, 0x14,
|
||||
0x97, 0x40, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x51, 0x72, 0x6a, 0x3c, 0x54, 0xa3, 0x04, 0xa3, 0x02,
|
||||
0xb3, 0x06, 0xb7, 0x91, 0xbe, 0x1e, 0x36, 0x17, 0x21, 0xdc, 0xa1, 0x17, 0x04, 0xd5, 0x07, 0x35,
|
||||
0x38, 0x88, 0xbf, 0x08, 0x55, 0x40, 0x49, 0x8e, 0x4b, 0x06, 0xbb, 0xd5, 0xc5, 0x05, 0xf9, 0x79,
|
||||
0xc5, 0xa9, 0x46, 0x6b, 0x18, 0xb9, 0xf8, 0x50, 0xa5, 0x84, 0x66, 0x32, 0x72, 0xb1, 0x41, 0xf4,
|
||||
0x08, 0xb9, 0xea, 0x11, 0x1b, 0x22, 0x7a, 0x78, 0x3c, 0x28, 0xe5, 0x46, 0xa9, 0x31, 0x10, 0xc7,
|
||||
0x2a, 0x31, 0x38, 0xcd, 0x66, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f,
|
||||
0xe4, 0x18, 0xb9, 0xb4, 0x33, 0xf3, 0x89, 0x36, 0xda, 0x49, 0x18, 0xd5, 0xd4, 0x00, 0x90, 0xca,
|
||||
0x00, 0xc6, 0x28, 0xcf, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x90,
|
||||
0x59, 0xba, 0x88, 0x68, 0x45, 0x31, 0x5a, 0x17, 0x12, 0xc9, 0xe9, 0xa9, 0x79, 0xfa, 0xe9, 0xd8,
|
||||
0x53, 0x55, 0x12, 0x1b, 0x58, 0x89, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x82, 0xd8, 0x6a, 0xe6,
|
||||
0x88, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// MetricsServiceClient is the client API for MetricsService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type MetricsServiceClient interface {
|
||||
// For performance reasons, it is recommended to keep this RPC
|
||||
// alive for the entire life of the application.
|
||||
Export(ctx context.Context, in *ExportMetricsServiceRequest, opts ...grpc.CallOption) (*ExportMetricsServiceResponse, error)
|
||||
}
|
||||
|
||||
type metricsServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewMetricsServiceClient(cc *grpc.ClientConn) MetricsServiceClient {
|
||||
return &metricsServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *metricsServiceClient) Export(ctx context.Context, in *ExportMetricsServiceRequest, opts ...grpc.CallOption) (*ExportMetricsServiceResponse, error) {
|
||||
out := new(ExportMetricsServiceResponse)
|
||||
err := c.cc.Invoke(ctx, "/opentelemetry.proto.collector.metrics.v1.MetricsService/Export", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MetricsServiceServer is the server API for MetricsService service.
|
||||
type MetricsServiceServer interface {
|
||||
// For performance reasons, it is recommended to keep this RPC
|
||||
// alive for the entire life of the application.
|
||||
Export(context.Context, *ExportMetricsServiceRequest) (*ExportMetricsServiceResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedMetricsServiceServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedMetricsServiceServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedMetricsServiceServer) Export(ctx context.Context, req *ExportMetricsServiceRequest) (*ExportMetricsServiceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Export not implemented")
|
||||
}
|
||||
|
||||
func RegisterMetricsServiceServer(s *grpc.Server, srv MetricsServiceServer) {
|
||||
s.RegisterService(&_MetricsService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _MetricsService_Export_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExportMetricsServiceRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetricsServiceServer).Export(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/opentelemetry.proto.collector.metrics.v1.MetricsService/Export",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetricsServiceServer).Export(ctx, req.(*ExportMetricsServiceRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _MetricsService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "opentelemetry.proto.collector.metrics.v1.MetricsService",
|
||||
HandlerType: (*MetricsServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Export",
|
||||
Handler: _MetricsService_Export_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "opentelemetry/proto/collector/metrics/v1/metrics_service.proto",
|
||||
}
|
||||
|
||||
func (m *ExportMetricsServiceRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *ExportMetricsServiceRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ExportMetricsServiceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i -= len(m.XXX_unrecognized)
|
||||
copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
if len(m.ResourceMetrics) > 0 {
|
||||
for iNdEx := len(m.ResourceMetrics) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.ResourceMetrics[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintMetricsService(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *ExportMetricsServiceResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *ExportMetricsServiceResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ExportMetricsServiceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i -= len(m.XXX_unrecognized)
|
||||
copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintMetricsService(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovMetricsService(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *ExportMetricsServiceRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.ResourceMetrics) > 0 {
|
||||
for _, e := range m.ResourceMetrics {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovMetricsService(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ExportMetricsServiceResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovMetricsService(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozMetricsService(x uint64) (n int) {
|
||||
return sovMetricsService(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *ExportMetricsServiceRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMetricsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: ExportMetricsServiceRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ExportMetricsServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ResourceMetrics", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMetricsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthMetricsService
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthMetricsService
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ResourceMetrics = append(m.ResourceMetrics, &v1.ResourceMetrics{})
|
||||
if err := m.ResourceMetrics[len(m.ResourceMetrics)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipMetricsService(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthMetricsService
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthMetricsService
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ExportMetricsServiceResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMetricsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: ExportMetricsServiceResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ExportMetricsServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipMetricsService(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthMetricsService
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthMetricsService
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipMetricsService(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowMetricsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowMetricsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowMetricsService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthMetricsService
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupMetricsService
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthMetricsService
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthMetricsService = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowMetricsService = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupMetricsService = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
Generated
Vendored
+576
@@ -0,0 +1,576 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: opentelemetry/proto/collector/trace/v1/trace_service.proto
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type ExportTraceServiceRequest struct {
|
||||
// An array of ResourceSpans.
|
||||
// For data coming from a single resource this array will typically contain one
|
||||
// element. Intermediary nodes (such as OpenTelemetry Collector) that receive
|
||||
// data from multiple origins typically batch the data before forwarding further and
|
||||
// in that case this array will contain multiple elements.
|
||||
ResourceSpans []*v1.ResourceSpans `protobuf:"bytes,1,rep,name=resource_spans,json=resourceSpans,proto3" json:"resource_spans,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ExportTraceServiceRequest) Reset() { *m = ExportTraceServiceRequest{} }
|
||||
func (m *ExportTraceServiceRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ExportTraceServiceRequest) ProtoMessage() {}
|
||||
func (*ExportTraceServiceRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_192a962890318cf4, []int{0}
|
||||
}
|
||||
func (m *ExportTraceServiceRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ExportTraceServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ExportTraceServiceRequest.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *ExportTraceServiceRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ExportTraceServiceRequest.Merge(m, src)
|
||||
}
|
||||
func (m *ExportTraceServiceRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ExportTraceServiceRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ExportTraceServiceRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ExportTraceServiceRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ExportTraceServiceRequest) GetResourceSpans() []*v1.ResourceSpans {
|
||||
if m != nil {
|
||||
return m.ResourceSpans
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ExportTraceServiceResponse struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ExportTraceServiceResponse) Reset() { *m = ExportTraceServiceResponse{} }
|
||||
func (m *ExportTraceServiceResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ExportTraceServiceResponse) ProtoMessage() {}
|
||||
func (*ExportTraceServiceResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_192a962890318cf4, []int{1}
|
||||
}
|
||||
func (m *ExportTraceServiceResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ExportTraceServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ExportTraceServiceResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *ExportTraceServiceResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ExportTraceServiceResponse.Merge(m, src)
|
||||
}
|
||||
func (m *ExportTraceServiceResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ExportTraceServiceResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ExportTraceServiceResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ExportTraceServiceResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ExportTraceServiceRequest)(nil), "opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest")
|
||||
proto.RegisterType((*ExportTraceServiceResponse)(nil), "opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("opentelemetry/proto/collector/trace/v1/trace_service.proto", fileDescriptor_192a962890318cf4)
|
||||
}
|
||||
|
||||
var fileDescriptor_192a962890318cf4 = []byte{
|
||||
// 278 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xca, 0x2f, 0x48, 0xcd,
|
||||
0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7,
|
||||
0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0x2f, 0x29, 0x4a, 0x4c, 0x4e, 0xd5,
|
||||
0x2f, 0x33, 0x84, 0x30, 0xe2, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0xc0, 0xca, 0x84,
|
||||
0xd4, 0x50, 0xf4, 0x42, 0x04, 0xf5, 0xe0, 0x7a, 0xf5, 0xc0, 0x5a, 0xf4, 0xca, 0x0c, 0xa5, 0x34,
|
||||
0xb0, 0xd9, 0x81, 0x6a, 0x32, 0x44, 0xb3, 0x52, 0x3e, 0x97, 0xa4, 0x6b, 0x45, 0x41, 0x7e, 0x51,
|
||||
0x49, 0x08, 0x48, 0x30, 0x18, 0x62, 0x5b, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x50, 0x10,
|
||||
0x17, 0x5f, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x11, 0xc8, 0x21, 0x05, 0x89, 0x79, 0xc5, 0x12, 0x8c,
|
||||
0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0xda, 0x7a, 0xd8, 0xdc, 0x01, 0xb3, 0x5d, 0x2f, 0x08, 0xaa, 0x27,
|
||||
0x18, 0xa4, 0x25, 0x88, 0xb7, 0x08, 0x99, 0xab, 0x24, 0xc3, 0x25, 0x85, 0xcd, 0xc2, 0xe2, 0x82,
|
||||
0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x45, 0x8c, 0x5c, 0x3c, 0xc8, 0x12, 0x42, 0x13, 0x19, 0xb9, 0xd8,
|
||||
0x20, 0xea, 0x85, 0x1c, 0xf5, 0x88, 0xf3, 0xbd, 0x1e, 0x4e, 0x0f, 0x49, 0x39, 0x51, 0x62, 0x04,
|
||||
0xc4, 0x89, 0x4a, 0x0c, 0x4e, 0x53, 0x19, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1,
|
||||
0xc1, 0x23, 0x39, 0x46, 0x2e, 0xcd, 0xcc, 0x7c, 0x22, 0x8d, 0x75, 0x12, 0x44, 0x36, 0x31, 0x00,
|
||||
0xa4, 0x2a, 0x80, 0x31, 0xca, 0x3d, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57,
|
||||
0x1f, 0x64, 0x8e, 0x2e, 0x22, 0xe2, 0x50, 0x8c, 0xd5, 0x85, 0x44, 0x63, 0x7a, 0x6a, 0x9e, 0x7e,
|
||||
0x3a, 0xb6, 0x14, 0x93, 0xc4, 0x06, 0x56, 0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x63, 0x25,
|
||||
0x6d, 0xa1, 0x62, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// TraceServiceClient is the client API for TraceService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type TraceServiceClient interface {
|
||||
// For performance reasons, it is recommended to keep this RPC
|
||||
// alive for the entire life of the application.
|
||||
Export(ctx context.Context, in *ExportTraceServiceRequest, opts ...grpc.CallOption) (*ExportTraceServiceResponse, error)
|
||||
}
|
||||
|
||||
type traceServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewTraceServiceClient(cc *grpc.ClientConn) TraceServiceClient {
|
||||
return &traceServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *traceServiceClient) Export(ctx context.Context, in *ExportTraceServiceRequest, opts ...grpc.CallOption) (*ExportTraceServiceResponse, error) {
|
||||
out := new(ExportTraceServiceResponse)
|
||||
err := c.cc.Invoke(ctx, "/opentelemetry.proto.collector.trace.v1.TraceService/Export", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// TraceServiceServer is the server API for TraceService service.
|
||||
type TraceServiceServer interface {
|
||||
// For performance reasons, it is recommended to keep this RPC
|
||||
// alive for the entire life of the application.
|
||||
Export(context.Context, *ExportTraceServiceRequest) (*ExportTraceServiceResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedTraceServiceServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedTraceServiceServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedTraceServiceServer) Export(ctx context.Context, req *ExportTraceServiceRequest) (*ExportTraceServiceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Export not implemented")
|
||||
}
|
||||
|
||||
func RegisterTraceServiceServer(s *grpc.Server, srv TraceServiceServer) {
|
||||
s.RegisterService(&_TraceService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _TraceService_Export_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExportTraceServiceRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TraceServiceServer).Export(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/opentelemetry.proto.collector.trace.v1.TraceService/Export",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TraceServiceServer).Export(ctx, req.(*ExportTraceServiceRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _TraceService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "opentelemetry.proto.collector.trace.v1.TraceService",
|
||||
HandlerType: (*TraceServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Export",
|
||||
Handler: _TraceService_Export_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "opentelemetry/proto/collector/trace/v1/trace_service.proto",
|
||||
}
|
||||
|
||||
func (m *ExportTraceServiceRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *ExportTraceServiceRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ExportTraceServiceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i -= len(m.XXX_unrecognized)
|
||||
copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
if len(m.ResourceSpans) > 0 {
|
||||
for iNdEx := len(m.ResourceSpans) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.ResourceSpans[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTraceService(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *ExportTraceServiceResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *ExportTraceServiceResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ExportTraceServiceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i -= len(m.XXX_unrecognized)
|
||||
copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintTraceService(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovTraceService(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *ExportTraceServiceRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.ResourceSpans) > 0 {
|
||||
for _, e := range m.ResourceSpans {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovTraceService(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ExportTraceServiceResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovTraceService(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozTraceService(x uint64) (n int) {
|
||||
return sovTraceService(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *ExportTraceServiceRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTraceService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: ExportTraceServiceRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ExportTraceServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ResourceSpans", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTraceService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTraceService
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTraceService
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ResourceSpans = append(m.ResourceSpans, &v1.ResourceSpans{})
|
||||
if err := m.ResourceSpans[len(m.ResourceSpans)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTraceService(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthTraceService
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthTraceService
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ExportTraceServiceResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTraceService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: ExportTraceServiceResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ExportTraceServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTraceService(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthTraceService
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthTraceService
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipTraceService(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowTraceService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowTraceService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowTraceService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthTraceService
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupTraceService
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthTraceService
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthTraceService = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowTraceService = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupTraceService = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
Generated
Vendored
+1477
-73
File diff suppressed because it is too large
Load Diff
+1446
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+4276
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+300
-13
@@ -1,13 +1,15 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: opentelemetry/proto/resource/v1/resource.proto
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -19,7 +21,7 @@ var _ = math.Inf
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// Resource information.
|
||||
type Resource struct {
|
||||
@@ -39,18 +41,26 @@ func (*Resource) ProtoMessage() {}
|
||||
func (*Resource) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_446f73eacf88f3f5, []int{0}
|
||||
}
|
||||
|
||||
func (m *Resource) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Resource.Unmarshal(m, b)
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Resource.Marshal(b, m, deterministic)
|
||||
if deterministic {
|
||||
return xxx_messageInfo_Resource.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *Resource) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Resource.Merge(m, src)
|
||||
}
|
||||
func (m *Resource) XXX_Size() int {
|
||||
return xxx_messageInfo_Resource.Size(m)
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Resource) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Resource.DiscardUnknown(m)
|
||||
@@ -81,7 +91,7 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_446f73eacf88f3f5 = []byte{
|
||||
// 227 bytes of a gzipped FileDescriptorProto
|
||||
// 241 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcb, 0x2f, 0x48, 0xcd,
|
||||
0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7,
|
||||
0x2f, 0x4a, 0x2d, 0xce, 0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x2f, 0x33, 0x84, 0xb3, 0xf5, 0xc0, 0x52,
|
||||
@@ -92,9 +102,286 @@ var fileDescriptor_446f73eacf88f3f5 = []byte{
|
||||
0xa1, 0x9e, 0x77, 0x6a, 0x65, 0x58, 0x62, 0x4e, 0x69, 0x6a, 0x10, 0x92, 0x56, 0x21, 0x0b, 0x2e,
|
||||
0x89, 0x94, 0xa2, 0xfc, 0x82, 0x82, 0xd4, 0x94, 0x78, 0x84, 0x68, 0x7c, 0x72, 0x7e, 0x69, 0x5e,
|
||||
0x89, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6f, 0x90, 0x18, 0x54, 0xde, 0x11, 0x2e, 0xed, 0x0c, 0x92,
|
||||
0x75, 0x2a, 0xe7, 0x52, 0xca, 0xcc, 0xd7, 0x23, 0xe0, 0x43, 0x27, 0x5e, 0x98, 0x93, 0x03, 0x40,
|
||||
0x52, 0x01, 0x8c, 0x51, 0x0e, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x20, 0x77, 0xe9, 0x83, 0x34,
|
||||
0xeb, 0x22, 0xbc, 0x8f, 0x62, 0x96, 0x2e, 0x24, 0x30, 0xd2, 0x53, 0xf3, 0xf4, 0xd3, 0x51, 0x02,
|
||||
0x39, 0x89, 0x0d, 0x2c, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xba, 0x7f, 0x2f, 0x93, 0x8e,
|
||||
0x01, 0x00, 0x00,
|
||||
0x75, 0x6a, 0x66, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18,
|
||||
0xb9, 0x94, 0x32, 0xf3, 0xf5, 0x08, 0x78, 0xd7, 0x89, 0x17, 0xe6, 0xfe, 0x00, 0x90, 0x54, 0x00,
|
||||
0x63, 0x94, 0x43, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x12, 0xc8, 0x91, 0xfa, 0x20, 0xcd, 0xba, 0x88,
|
||||
0xb0, 0x40, 0x31, 0x4b, 0x17, 0x12, 0x32, 0xe9, 0xa9, 0x79, 0xfa, 0xe9, 0x28, 0x21, 0x9e, 0xc4,
|
||||
0x06, 0x96, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x84, 0x21, 0xfb, 0x7a, 0x9b, 0x01, 0x00,
|
||||
0x00,
|
||||
}
|
||||
|
||||
func (m *Resource) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Resource) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Resource) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i -= len(m.XXX_unrecognized)
|
||||
copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
if m.DroppedAttributesCount != 0 {
|
||||
i = encodeVarintResource(dAtA, i, uint64(m.DroppedAttributesCount))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
if len(m.Attributes) > 0 {
|
||||
for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintResource(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintResource(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovResource(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *Resource) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Attributes) > 0 {
|
||||
for _, e := range m.Attributes {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovResource(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.DroppedAttributesCount != 0 {
|
||||
n += 1 + sovResource(uint64(m.DroppedAttributesCount))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovResource(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozResource(x uint64) (n int) {
|
||||
return sovResource(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *Resource) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowResource
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Resource: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Resource: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowResource
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthResource
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthResource
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Attributes = append(m.Attributes, &v1.KeyValue{})
|
||||
if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field DroppedAttributesCount", wireType)
|
||||
}
|
||||
m.DroppedAttributesCount = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowResource
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.DroppedAttributesCount |= uint32(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipResource(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthResource
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthResource
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipResource(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowResource
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowResource
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowResource
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthResource
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupResource
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthResource
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthResource = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowResource = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupResource = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
|
||||
+2094
-158
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -21,7 +21,7 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
otlpcommon "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1"
|
||||
otlpcommon "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1"
|
||||
)
|
||||
|
||||
// TimestampUnixNano is a time specified as UNIX Epoch time in nanoseconds since
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
package pdata
|
||||
|
||||
import (
|
||||
otlpcommon "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1"
|
||||
otlpcommon "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1"
|
||||
)
|
||||
|
||||
// InstrumentationLibrary is a message representing the instrumentation library information.
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
package pdata
|
||||
|
||||
import (
|
||||
logsproto "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/logs/v1"
|
||||
logsproto "github.com/open-telemetry/opentelemetry-proto/gen/go/logs/v1"
|
||||
)
|
||||
|
||||
// ResourceLogsSlice logically represents a slice of ResourceLogs.
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
package pdata
|
||||
|
||||
import (
|
||||
otlpmetrics "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/metrics/v1"
|
||||
otlpmetrics "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1"
|
||||
)
|
||||
|
||||
// ResourceMetricsSlice logically represents a slice of ResourceMetrics.
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
package pdata
|
||||
|
||||
import (
|
||||
otlpresource "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1"
|
||||
otlpresource "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1"
|
||||
)
|
||||
|
||||
// Resource information.
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
package pdata
|
||||
|
||||
import (
|
||||
otlptrace "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/trace/v1"
|
||||
otlptrace "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1"
|
||||
)
|
||||
|
||||
// ResourceSpansSlice logically represents a slice of ResourceSpans.
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
package pdata
|
||||
|
||||
import logsproto "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/logs/v1"
|
||||
import logsproto "github.com/open-telemetry/opentelemetry-proto/gen/go/logs/v1"
|
||||
|
||||
// NewResourceLogsSliceFromOrig creates ResourceLogsSlice from logsproto.ResourceLogs.
|
||||
// This function simply makes generated newResourceLogsSlice() function publicly
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
package pdata
|
||||
|
||||
import (
|
||||
otlpmetrics "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/metrics/v1"
|
||||
otlpmetrics "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1"
|
||||
)
|
||||
|
||||
type MetricType otlpmetrics.MetricDescriptor_Type
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import (
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
|
||||
otlptrace "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/trace/v1"
|
||||
otlptrace "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1"
|
||||
)
|
||||
|
||||
// This file defines in-memory data structures to represent traces (spans).
|
||||
|
||||
Generated
Vendored
-140
@@ -1,140 +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 telemetry
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/procfs"
|
||||
"go.opencensus.io/stats"
|
||||
"go.opencensus.io/stats/view"
|
||||
)
|
||||
|
||||
// ProcessMetricsViews is a struct that contains views related to process metrics (cpu, mem, etc)
|
||||
type ProcessMetricsViews struct {
|
||||
ballastSizeBytes uint64
|
||||
views []*view.View
|
||||
done chan struct{}
|
||||
}
|
||||
|
||||
var mRuntimeAllocMem = stats.Int64(
|
||||
"process/runtime/heap_alloc_bytes",
|
||||
"Bytes of allocated heap objects (see 'go doc runtime.MemStats.HeapAlloc')",
|
||||
stats.UnitBytes)
|
||||
var viewAllocMem = &view.View{
|
||||
Name: mRuntimeAllocMem.Name(),
|
||||
Description: mRuntimeAllocMem.Description(),
|
||||
Measure: mRuntimeAllocMem,
|
||||
Aggregation: view.LastValue(),
|
||||
TagKeys: nil,
|
||||
}
|
||||
|
||||
var mRuntimeTotalAllocMem = stats.Int64(
|
||||
"process/runtime/total_alloc_bytes",
|
||||
"Cumulative bytes allocated for heap objects (see 'go doc runtime.MemStats.TotalAlloc')",
|
||||
stats.UnitBytes)
|
||||
var viewTotalAllocMem = &view.View{
|
||||
Name: mRuntimeTotalAllocMem.Name(),
|
||||
Description: mRuntimeTotalAllocMem.Description(),
|
||||
Measure: mRuntimeTotalAllocMem,
|
||||
Aggregation: view.LastValue(),
|
||||
TagKeys: nil,
|
||||
}
|
||||
|
||||
var mRuntimeSysMem = stats.Int64(
|
||||
"process/runtime/total_sys_memory_bytes",
|
||||
"Total bytes of memory obtained from the OS (see 'go doc runtime.MemStats.Sys')",
|
||||
stats.UnitBytes)
|
||||
var viewSysMem = &view.View{
|
||||
Name: mRuntimeSysMem.Name(),
|
||||
Description: mRuntimeSysMem.Description(),
|
||||
Measure: mRuntimeSysMem,
|
||||
Aggregation: view.LastValue(),
|
||||
TagKeys: nil,
|
||||
}
|
||||
|
||||
var mCPUSeconds = stats.Int64(
|
||||
"process/cpu_seconds",
|
||||
"Total CPU user and system time in seconds",
|
||||
stats.UnitDimensionless)
|
||||
var viewCPUSeconds = &view.View{
|
||||
Name: mCPUSeconds.Name(),
|
||||
Description: mCPUSeconds.Description(),
|
||||
Measure: mCPUSeconds,
|
||||
Aggregation: view.LastValue(),
|
||||
TagKeys: nil,
|
||||
}
|
||||
|
||||
// NewProcessMetricsViews creates a new set of ProcessMetrics (mem, cpu) that can be used to measure
|
||||
// basic information about this process.
|
||||
func NewProcessMetricsViews(ballastSizeBytes uint64) *ProcessMetricsViews {
|
||||
return &ProcessMetricsViews{
|
||||
ballastSizeBytes: ballastSizeBytes,
|
||||
views: []*view.View{viewAllocMem, viewTotalAllocMem, viewSysMem, viewCPUSeconds},
|
||||
done: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
// StartCollection starts a ticker'd goroutine that will update the PMV measurements every 5 seconds
|
||||
func (pmv *ProcessMetricsViews) StartCollection() {
|
||||
ticker := time.NewTicker(5 * time.Second)
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
pmv.updateViews()
|
||||
case <-pmv.done:
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Views returns the views internal to the PMV
|
||||
func (pmv *ProcessMetricsViews) Views() []*view.View {
|
||||
return pmv.views
|
||||
}
|
||||
|
||||
// StopCollection stops the collection of the process metric information
|
||||
func (pmv *ProcessMetricsViews) StopCollection() {
|
||||
close(pmv.done)
|
||||
}
|
||||
|
||||
func (pmv *ProcessMetricsViews) updateViews() {
|
||||
ms := &runtime.MemStats{}
|
||||
pmv.readMemStats(ms)
|
||||
stats.Record(context.Background(), mRuntimeAllocMem.M(int64(ms.Alloc)))
|
||||
stats.Record(context.Background(), mRuntimeTotalAllocMem.M(int64(ms.TotalAlloc)))
|
||||
stats.Record(context.Background(), mRuntimeSysMem.M(int64(ms.Sys)))
|
||||
|
||||
pid := os.Getpid()
|
||||
proc, err := procfs.NewProc(pid)
|
||||
if err == nil {
|
||||
if procStat, err := proc.Stat(); err == nil {
|
||||
stats.Record(context.Background(), mCPUSeconds.M(int64(procStat.CPUTime())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (pmv *ProcessMetricsViews) readMemStats(ms *runtime.MemStats) {
|
||||
runtime.ReadMemStats(ms)
|
||||
ms.Alloc -= pmv.ballastSizeBytes
|
||||
ms.HeapAlloc -= pmv.ballastSizeBytes
|
||||
ms.HeapSys -= pmv.ballastSizeBytes
|
||||
ms.HeapInuse -= pmv.ballastSizeBytes
|
||||
}
|
||||
-147
@@ -1,147 +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 telemetry controls the telemetry settings to be used in the collector.
|
||||
package telemetry
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"go.opentelemetry.io/collector/internal/version"
|
||||
)
|
||||
|
||||
const (
|
||||
metricsAddrCfg = "metrics-addr"
|
||||
metricsLevelCfg = "metrics-level"
|
||||
metricsPrefixCfg = "metrics-prefix"
|
||||
|
||||
// Telemetry levels
|
||||
//
|
||||
// None indicates that no telemetry data should be collected.
|
||||
None Level = iota - 1
|
||||
// Basic is the default and covers the basics of the service telemetry.
|
||||
Basic
|
||||
// Normal adds some other indicators on top of basic.
|
||||
Normal
|
||||
// Detailed adds dimensions and views to the previous levels.
|
||||
Detailed
|
||||
)
|
||||
|
||||
var (
|
||||
// Command-line flags that control publication of telemetry data.
|
||||
metricsLevelPtr *string
|
||||
metricsAddrPtr *string
|
||||
metricsPrefixPtr *string
|
||||
|
||||
useLegacyMetricsPtr *bool
|
||||
useNewMetricsPtr *bool
|
||||
addInstanceIDPtr *bool
|
||||
)
|
||||
|
||||
func Flags(flags *flag.FlagSet) {
|
||||
metricsLevelPtr = flags.String(
|
||||
metricsLevelCfg,
|
||||
"BASIC",
|
||||
"Output level of telemetry metrics (NONE, BASIC, NORMAL, DETAILED)")
|
||||
|
||||
// At least until we can use a generic, i.e.: OpenCensus, metrics exporter
|
||||
// we default to Prometheus at port 8888, if not otherwise specified.
|
||||
metricsAddrPtr = flags.String(
|
||||
metricsAddrCfg,
|
||||
GetMetricsAddrDefault(),
|
||||
"[address]:port for exposing collector telemetry.")
|
||||
|
||||
metricsPrefixPtr = flags.String(
|
||||
metricsPrefixCfg,
|
||||
"otelcol",
|
||||
"Prefix to the metrics generated by the collector.")
|
||||
|
||||
useLegacyMetricsPtr = flags.Bool(
|
||||
"legacy-metrics",
|
||||
false,
|
||||
"Flag to control usage of legacy metrics",
|
||||
)
|
||||
|
||||
useNewMetricsPtr = flags.Bool(
|
||||
"new-metrics",
|
||||
true,
|
||||
"Flag to control usage of new metrics",
|
||||
)
|
||||
|
||||
addInstanceIDPtr = flags.Bool(
|
||||
"add-instance-id",
|
||||
true,
|
||||
"Flag to control the addition of 'service.instance.id' to the collector metrics.")
|
||||
}
|
||||
|
||||
// GetMetricsAddrDefault returns the default metrics bind address and port depending on
|
||||
// the current build type.
|
||||
func GetMetricsAddrDefault() string {
|
||||
if version.IsDevBuild() {
|
||||
// Listen on localhost by default for dev builds to avoid security prompts.
|
||||
return "localhost:8888"
|
||||
}
|
||||
return ":8888"
|
||||
}
|
||||
|
||||
// Level of telemetry data to be generated.
|
||||
type Level int8
|
||||
|
||||
func GetAddInstanceID() bool {
|
||||
return *addInstanceIDPtr
|
||||
}
|
||||
|
||||
// GetLevel returns the Level represented by the string. The parsing is case-insensitive
|
||||
// and it returns error if the string value is unknown.
|
||||
func GetLevel() (Level, error) {
|
||||
var level Level
|
||||
var str string
|
||||
|
||||
if metricsLevelPtr != nil {
|
||||
str = strings.ToLower(*metricsLevelPtr)
|
||||
}
|
||||
|
||||
switch str {
|
||||
case "none":
|
||||
level = None
|
||||
case "", "basic":
|
||||
level = Basic
|
||||
case "normal":
|
||||
level = Normal
|
||||
case "detailed":
|
||||
level = Detailed
|
||||
default:
|
||||
return level, fmt.Errorf("unknown metrics level %q", str)
|
||||
}
|
||||
|
||||
return level, nil
|
||||
}
|
||||
|
||||
func GetMetricsAddr() string {
|
||||
return *metricsAddrPtr
|
||||
}
|
||||
|
||||
func GetMetricsPrefix() string {
|
||||
return *metricsPrefixPtr
|
||||
}
|
||||
|
||||
func UseLegacyMetrics() bool {
|
||||
return *useLegacyMetricsPtr
|
||||
}
|
||||
|
||||
func UseNewMetrics() bool {
|
||||
return *useNewMetricsPtr
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/gogo/protobuf/proto"
|
||||
|
||||
"go.opentelemetry.io/collector/consumer/pdata"
|
||||
logsproto "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/logs/v1"
|
||||
logsproto "github.com/open-telemetry/opentelemetry-proto/gen/go/logs/v1"
|
||||
)
|
||||
|
||||
// This file defines in-memory data structures to represent logs.
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import (
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"go.opentelemetry.io/collector/consumer/pdata"
|
||||
otlpmetrics "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/metrics/v1"
|
||||
otlpmetrics "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1"
|
||||
)
|
||||
|
||||
// This file defines in-memory data structures to represent metrics.
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/metrics/v1"
|
||||
v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/trace/v1"
|
||||
v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -8,8 +8,8 @@ import (
|
||||
encoding_binary "encoding/binary"
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
v11 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1"
|
||||
v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1"
|
||||
v11 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1"
|
||||
v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -7,8 +7,8 @@ import (
|
||||
encoding_binary "encoding/binary"
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
v11 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1"
|
||||
v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1"
|
||||
v11 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1"
|
||||
v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -6,7 +6,7 @@ package v1
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1"
|
||||
v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -7,8 +7,8 @@ import (
|
||||
encoding_binary "encoding/binary"
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
v11 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1"
|
||||
v1 "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1"
|
||||
v11 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1"
|
||||
v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
|
||||
-77
@@ -1,77 +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 version
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
buildDev = "dev"
|
||||
buildRelease = "release"
|
||||
)
|
||||
|
||||
// Version variable will be replaced at link time after `make` has been run.
|
||||
var Version = "latest"
|
||||
|
||||
// GitHash variable will be replaced at link time after `make` has been run.
|
||||
var GitHash = "<NOT PROPERLY GENERATED>"
|
||||
|
||||
// BuildType should be one of (dev, release).
|
||||
var BuildType = buildDev
|
||||
|
||||
// IsDevBuild returns true if this is a development (local) build.
|
||||
func IsDevBuild() bool {
|
||||
return BuildType == buildDev
|
||||
}
|
||||
|
||||
// IsReleaseBuild returns true if this is a release build.
|
||||
func IsReleaseBuild() bool {
|
||||
return BuildType == buildRelease
|
||||
}
|
||||
|
||||
// InfoVar is a singleton instance of the Info struct.
|
||||
var InfoVar = Info([][2]string{
|
||||
{"Version", Version},
|
||||
{"GitHash", GitHash},
|
||||
{"BuildType", BuildType},
|
||||
{"Goversion", runtime.Version()},
|
||||
{"OS", runtime.GOOS},
|
||||
{"Architecture", runtime.GOARCH},
|
||||
// Add other valuable build-time information here.
|
||||
})
|
||||
|
||||
// Info has properties about the build and runtime.
|
||||
type Info [][2]string
|
||||
|
||||
// String returns a formatted string, with linebreaks, intended to be displayed
|
||||
// on stdout.
|
||||
func (i Info) String() string {
|
||||
buf := new(bytes.Buffer)
|
||||
maxRow1Alignment := 0
|
||||
for _, prop := range i {
|
||||
if cl0 := len(prop[0]); cl0 > maxRow1Alignment {
|
||||
maxRow1Alignment = cl0
|
||||
}
|
||||
}
|
||||
|
||||
for _, prop := range i {
|
||||
// Then finally print them with left alignment
|
||||
fmt.Fprintf(buf, "%*s %s\n", -maxRow1Alignment, prop[0], prop[1])
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
-234
@@ -1,234 +0,0 @@
|
||||
# General Information
|
||||
Processors are used at various stages of a [pipeline](../docs/pipelines.md).
|
||||
Generally, a processor pre-processes data before it is exported (e.g.
|
||||
modify attributes or sample) or helps ensure that data makes it through a
|
||||
pipeline successfully (e.g. batch/retry).
|
||||
|
||||
Some important aspects of pipelines and processors to be aware of:
|
||||
- [Recommended Processors](#recommended-processors)
|
||||
- [Data Ownership](#data-ownership)
|
||||
- [Exclusive Ownership](#exclusive-ownership)
|
||||
- [Shared Ownership](#shared-ownership)
|
||||
- [Ordering Processors](#ordering-processors)
|
||||
|
||||
Supported processors (sorted alphabetically):
|
||||
- [Attributes Processor](attributesprocessor/README.md)
|
||||
- [Batch Processor](batchprocessor/README.md)
|
||||
- [Filter Processor](filterprocessor/README.md)
|
||||
- [Memory Limiter Processor](memorylimiter/README.md)
|
||||
- [Queued Retry Processor](queuedprocessor/README.md)
|
||||
- [Resource Processor](resourceprocessor/README.md)
|
||||
- Sampling Processors
|
||||
- [Probabilistic Sampling Processor](samplingprocessor/probabilisticsamplerprocessor/README.md)
|
||||
- [Tail Sampling Processor](samplingprocessor/tailsamplingprocessor/README.md)
|
||||
- [Span Processor](spanprocessor/README.md)
|
||||
|
||||
The [contributors repository](https://github.com/open-telemetry/opentelemetry-collector-contrib)
|
||||
has more processors that can be added to custom builds of the Collector.
|
||||
|
||||
## <a name="recommended-processors"></a>Recommended Processors
|
||||
|
||||
No processors are enabled by default, however multiple processors are
|
||||
recommended to be enabled depending on the data source. Processors must be
|
||||
enabled for every data source and not all processors support all data sources.
|
||||
In addition, it is important to note that the order of processors matters. The
|
||||
order in each section below is the best practice. Refer to the individual
|
||||
processor documentation for more information.
|
||||
|
||||
### Traces
|
||||
|
||||
1. [memory_limiter](memorylimiter/README.md)
|
||||
2. *any sampling processors*
|
||||
3. [batch](batchprocessor/README.md)
|
||||
4. *any other processors*
|
||||
5. [queued_retry](queuedprocessor/README.md)
|
||||
|
||||
### Metrics
|
||||
|
||||
1. [memory_limiter](memorylimiter/README.md)
|
||||
2. [batch](batchprocessor/README.md)
|
||||
|
||||
## <a name="data-ownership"></a>Data Ownership
|
||||
|
||||
The ownership of the `TraceData` and `MetricsData` in a pipeline is passed as the data travels
|
||||
through the pipeline. The data is created by the receiver and then the ownership is passed
|
||||
to the first processor when `ConsumeTraceData`/`ConsumeMetricsData` function is called.
|
||||
|
||||
Note: the receiver may be attached to multiple pipelines, in which case the same data
|
||||
will be passed to all attached pipelines via a data fan-out connector.
|
||||
|
||||
From data ownership perspective pipelines can work in 2 modes:
|
||||
* Exclusive data ownership
|
||||
* Shared data ownership
|
||||
|
||||
The mode is defined during startup based on data modification intent reported by the
|
||||
processors. The intent is reported by each processor via `MutatesConsumedData` field of
|
||||
the struct returned by `GetCapabilities` function. If any processor in the pipeline
|
||||
declares an intent to modify the data then that pipeline will work in exclusive ownership
|
||||
mode. In addition, any other pipeline that receives data from a receiver that is attached
|
||||
to a pipeline with exclusive ownership mode will be also operating in exclusive ownership
|
||||
mode.
|
||||
|
||||
### <a name="exclusive-ownership"></a>Exclusive Ownership
|
||||
|
||||
In exclusive ownership mode the data is owned exclusively by a particular processor at a
|
||||
given moment of time and the processor is free to modify the data it owns.
|
||||
|
||||
Exclusive ownership mode is only applicable for pipelines that receive data from the
|
||||
same receiver. If a pipeline is marked to be in exclusive ownership mode then any data
|
||||
received from a shared receiver will be cloned at the fan-out connector before passing
|
||||
further to each pipeline. This ensures that each pipeline has its own exclusive copy of
|
||||
data and the data can be safely modified in the pipeline.
|
||||
|
||||
The exclusive ownership of data allows processors to freely modify the data while
|
||||
they own it (e.g. see `attributesprocessor`). The duration of ownership of the data
|
||||
by processor is from the beginning of `ConsumeTraceData`/`ConsumeMetricsData` call
|
||||
until the processor calls the next processor's `ConsumeTraceData`/`ConsumeMetricsData`
|
||||
function, which passes the ownership to the next processor. After that the processor
|
||||
must no longer read or write the data since it may be concurrently modified by the
|
||||
new owner.
|
||||
|
||||
Exclusive Ownership mode allows to easily implement processors that need to modify
|
||||
the data by simply declaring such intent.
|
||||
|
||||
### <a name="shared-ownership"></a>Shared Ownership
|
||||
|
||||
In shared ownership mode no particular processor owns the data and no processor is
|
||||
allowed the modify the shared data.
|
||||
|
||||
In this mode no cloning is performed at the fan-out connector of receivers that
|
||||
are attached to multiple pipelines. In this case all such pipelines will see
|
||||
the same single shared copy of the data. Processors in pipelines operating in shared
|
||||
ownership mode are prohibited from modifying the original data that they receive
|
||||
via `ConsumeTraceData`/`ConsumeMetricsData` call. Processors may only read the data but
|
||||
must not modify the data.
|
||||
|
||||
If the processor needs to modify the data while performing the processing but
|
||||
does not want to incur the cost of data cloning that Exclusive mode brings then
|
||||
the processor can declare that it does not modify the data and use any
|
||||
different technique that ensures original data is not modified. For example,
|
||||
the processor can implement copy-on-write approach for individual sub-parts of
|
||||
`TraceData`/`MetricsData` argument. Any approach that does not mutate the
|
||||
original `TraceData`/`MetricsData` argument (including referenced data, such as
|
||||
`Node`, `Resource`, `Spans`, etc) is allowed.
|
||||
|
||||
If the processor uses such technique it should declare that it does not intend
|
||||
to modify the original data by setting `MutatesConsumedData=false` in its capabilities
|
||||
to avoid marking the pipeline for Exclusive ownership and to avoid the cost of
|
||||
data cloning described in Exclusive Ownership section.
|
||||
|
||||
## <a name="ordering-processors"></a>Ordering Processors
|
||||
|
||||
The order processors are specified in a pipeline is important as this is the
|
||||
order in which each processor is applied to traces and metrics.
|
||||
|
||||
### Include/Exclude Metrics
|
||||
|
||||
The [filter processor](filterprocessor/README.md) exposes the option to provide a set of
|
||||
metric names to match against to determine if the metric should be
|
||||
included or excluded from the processor. To configure this option, under
|
||||
`include` and/or `exclude` both `match_type` and `metrics_names` are required.
|
||||
|
||||
Note: If both `include` and `exclude` are specified, the `include` properties
|
||||
are checked before the `exclude` properties.
|
||||
|
||||
```yaml
|
||||
filter:
|
||||
# include and/or exclude can be specified. However, the include properties
|
||||
# are always checked before the exclude properties.
|
||||
{include, exclude}:
|
||||
# match_type controls how items matching is done.
|
||||
# Possible values are "regexp" or "strict".
|
||||
# This is a required field.
|
||||
match_type: {strict, regexp}
|
||||
|
||||
# regexp is an optional configuration section for match_type regexp.
|
||||
regexp:
|
||||
# < see "Match Configuration" below >
|
||||
|
||||
# metric_names specify an array of items to match the metric name against.
|
||||
# This is a required field.
|
||||
metric_name: [<item1>, ..., <itemN>]
|
||||
```
|
||||
|
||||
#### Match Configuration
|
||||
|
||||
Some `match_type` values have additional configuration options that can be
|
||||
specified. The `match_type` value is the name of the configuration section.
|
||||
These sections are optional.
|
||||
|
||||
```yaml
|
||||
# regexp is an optional configuration section for match_type regexp.
|
||||
regexp:
|
||||
# cacheenabled determines whether match results are LRU cached to make subsequent matches faster.
|
||||
# Cache size is unlimited unless cachemaxnumentries is also specified.
|
||||
cacheenabled: <bool>
|
||||
# cachemaxnumentries is the max number of entries of the LRU cache; ignored if cacheenabled is false.
|
||||
cachemaxnumentries: <int>
|
||||
```
|
||||
|
||||
### Include/Exclude Spans
|
||||
|
||||
The [attribute processor](attributesprocessor/README.md) and the [span processor](spanprocessor/README.md) expose
|
||||
the option to provide a set of properties of a span to match against to determine
|
||||
if the span should be included or excluded from the processor. To configure
|
||||
this option, under `include` and/or `exclude` at least `match_type` and one of
|
||||
`services`, `span_names` or `attributes` is required.
|
||||
|
||||
Note: If both `include` and `exclude` are specified, the `include` properties
|
||||
are checked before the `exclude` properties.
|
||||
|
||||
```yaml
|
||||
{span, attributes}:
|
||||
# include and/or exclude can be specified. However, the include properties
|
||||
# are always checked before the exclude properties.
|
||||
{include, exclude}:
|
||||
# At least one of services, span_names or attributes must be specified.
|
||||
# It is supported to have more than one specified, but all of the specified
|
||||
# conditions must evaluate to true for a match to occur.
|
||||
|
||||
# match_type controls how items in "services" and "span_names" arrays are
|
||||
# interpreted. Possible values are "regexp" or "strict".
|
||||
# This is a required field.
|
||||
match_type: {strict, regexp}
|
||||
|
||||
# regexp is an optional configuration section for match_type regexp.
|
||||
regexp:
|
||||
# < see "Match Configuration" below >
|
||||
|
||||
# services specify an array of items to match the service name against.
|
||||
# A match occurs if the span service name matches at least of the items.
|
||||
# This is an optional field.
|
||||
services: [<item1>, ..., <itemN>]
|
||||
|
||||
# The span name must match at least one of the items.
|
||||
# This is an optional field.
|
||||
span_names: [<item1>, ..., <itemN>]
|
||||
|
||||
# Attributes specifies the list of attributes to match against.
|
||||
# All of these attributes must match exactly for a match to occur.
|
||||
# Only match_type=strict is allowed if "attributes" are specified.
|
||||
# This is an optional field.
|
||||
attributes:
|
||||
# Key specifies the attribute to match against.
|
||||
- key: <key>
|
||||
# Value specifies the exact value to match against.
|
||||
# If not specified, a match occurs if the key is present in the attributes.
|
||||
value: {value}
|
||||
```
|
||||
|
||||
#### Match Configuration
|
||||
|
||||
Some `match_type` values have additional configuration options that can be
|
||||
specified. The `match_type` value is the name of the configuration section.
|
||||
These sections are optional.
|
||||
|
||||
```yaml
|
||||
# regexp is an optional configuration section for match_type regexp.
|
||||
regexp:
|
||||
# cacheenabled determines whether match results are LRU cached to make subsequent matches faster.
|
||||
# Cache size is unlimited unless cachemaxnumentries is also specified.
|
||||
cacheenabled: <bool>
|
||||
# cachemaxnumentries is the max number of entries of the LRU cache; ignored if cacheenabled is false.
|
||||
cachemaxnumentries: <int>
|
||||
```
|
||||
-269
@@ -1,269 +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 processor
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
commonpb "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1"
|
||||
resourcepb "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1"
|
||||
tracepb "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1"
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"go.opentelemetry.io/collector/component/componenterror"
|
||||
"go.opentelemetry.io/collector/consumer"
|
||||
"go.opentelemetry.io/collector/consumer/consumerdata"
|
||||
"go.opentelemetry.io/collector/consumer/converter"
|
||||
"go.opentelemetry.io/collector/consumer/pdata"
|
||||
"go.opentelemetry.io/collector/consumer/pdatautil"
|
||||
"go.opentelemetry.io/collector/internal/data"
|
||||
)
|
||||
|
||||
// This file contains implementations of cloning Trace/Metrics connectors
|
||||
// that fan out the data to multiple other consumers. Cloning connectors create
|
||||
// clones of data before fanning out, which ensures each consumer gets their
|
||||
// own copy of data and is free to modify it.
|
||||
|
||||
// CreateMetricsCloningFanOutConnector is a placeholder function for now.
|
||||
// It supposed to create an old type connector or a new type connector based on type of provided metrics consumer.
|
||||
func CreateMetricsCloningFanOutConnector(mcs []consumer.MetricsConsumerBase) consumer.MetricsConsumerBase {
|
||||
if len(mcs) == 1 {
|
||||
// Don't wrap if no need to do it.
|
||||
return mcs[0]
|
||||
}
|
||||
metricsConsumersOld := make([]consumer.MetricsConsumerOld, 0, len(mcs))
|
||||
metricsConsumers := make([]consumer.MetricsConsumer, 0, len(mcs))
|
||||
allMetricsConsumersOld := true
|
||||
for _, mc := range mcs {
|
||||
if metricsConsumer, ok := mc.(consumer.MetricsConsumer); ok {
|
||||
allMetricsConsumersOld = false
|
||||
metricsConsumers = append(metricsConsumers, metricsConsumer)
|
||||
} else {
|
||||
metricsConsumerOld := mc.(consumer.MetricsConsumerOld)
|
||||
metricsConsumersOld = append(metricsConsumersOld, metricsConsumerOld)
|
||||
metricsConsumers = append(metricsConsumers, converter.NewInternalToOCMetricsConverter(metricsConsumerOld))
|
||||
}
|
||||
}
|
||||
|
||||
if allMetricsConsumersOld {
|
||||
return newMetricsCloningFanOutConnectorOld(metricsConsumersOld)
|
||||
}
|
||||
return newMetricsCloningFanOutConnector(metricsConsumers)
|
||||
}
|
||||
|
||||
func newMetricsCloningFanOutConnectorOld(mcs []consumer.MetricsConsumerOld) consumer.MetricsConsumerOld {
|
||||
return metricsCloningFanOutConnectorOld(mcs)
|
||||
}
|
||||
|
||||
type metricsCloningFanOutConnectorOld []consumer.MetricsConsumerOld
|
||||
|
||||
var _ consumer.MetricsConsumerOld = (*metricsCloningFanOutConnectorOld)(nil)
|
||||
|
||||
// ConsumeMetricsData exports the MetricsData to all consumers wrapped by the current one.
|
||||
func (mfc metricsCloningFanOutConnectorOld) ConsumeMetricsData(ctx context.Context, md consumerdata.MetricsData) error {
|
||||
var errs []error
|
||||
|
||||
// Fan out to first len-1 consumers.
|
||||
for i := 0; i < len(mfc)-1; i++ {
|
||||
// Create a clone of data. We need to clone because consumers may modify the data.
|
||||
if err := mfc[i].ConsumeMetricsData(ctx, pdatautil.CloneMetricsDataOld(md)); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(mfc) > 0 {
|
||||
// Give the original data to the last consumer.
|
||||
lastTc := mfc[len(mfc)-1]
|
||||
if err := lastTc.ConsumeMetricsData(ctx, md); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
|
||||
func newMetricsCloningFanOutConnector(mcs []consumer.MetricsConsumer) consumer.MetricsConsumer {
|
||||
return metricsCloningFanOutConnector(mcs)
|
||||
}
|
||||
|
||||
type metricsCloningFanOutConnector []consumer.MetricsConsumer
|
||||
|
||||
var _ consumer.MetricsConsumer = (*metricsCloningFanOutConnector)(nil)
|
||||
|
||||
// ConsumeMetrics exports the MetricsData to all consumers wrapped by the current one.
|
||||
func (mfc metricsCloningFanOutConnector) ConsumeMetrics(ctx context.Context, md pdata.Metrics) error {
|
||||
var errs []error
|
||||
|
||||
// Fan out to first len-1 consumers.
|
||||
for i := 0; i < len(mfc)-1; i++ {
|
||||
// Create a clone of data. We need to clone because consumers may modify the data.
|
||||
clone := pdatautil.CloneMetrics(md)
|
||||
if err := mfc[i].ConsumeMetrics(ctx, clone); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(mfc) > 0 {
|
||||
// Give the original data to the last consumer.
|
||||
lastTc := mfc[len(mfc)-1]
|
||||
if err := lastTc.ConsumeMetrics(ctx, md); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
|
||||
// CreateTraceCloningFanOutConnector is a placeholder function for now.
|
||||
// It supposed to create an old type connector or a new type connector based on type of provided trace consumer.
|
||||
func CreateTraceCloningFanOutConnector(tcs []consumer.TraceConsumerBase) consumer.TraceConsumerBase {
|
||||
if len(tcs) == 1 {
|
||||
// Don't wrap if no need to do it.
|
||||
return tcs[0]
|
||||
}
|
||||
traceConsumersOld := make([]consumer.TraceConsumerOld, 0, len(tcs))
|
||||
traceConsumers := make([]consumer.TraceConsumer, 0, len(tcs))
|
||||
allTraceConsumersOld := true
|
||||
for _, tc := range tcs {
|
||||
if traceConsumer, ok := tc.(consumer.TraceConsumer); ok {
|
||||
allTraceConsumersOld = false
|
||||
traceConsumers = append(traceConsumers, traceConsumer)
|
||||
} else {
|
||||
traceConsumerOld := tc.(consumer.TraceConsumerOld)
|
||||
traceConsumersOld = append(traceConsumersOld, traceConsumerOld)
|
||||
traceConsumers = append(traceConsumers, converter.NewInternalToOCTraceConverter(traceConsumerOld))
|
||||
}
|
||||
}
|
||||
|
||||
if allTraceConsumersOld {
|
||||
return newTraceCloningFanOutConnectorOld(traceConsumersOld)
|
||||
}
|
||||
return newTraceCloningFanOutConnector(traceConsumers)
|
||||
}
|
||||
|
||||
func newTraceCloningFanOutConnectorOld(tcs []consumer.TraceConsumerOld) consumer.TraceConsumerOld {
|
||||
return traceCloningFanOutConnectorOld(tcs)
|
||||
}
|
||||
|
||||
type traceCloningFanOutConnectorOld []consumer.TraceConsumerOld
|
||||
|
||||
var _ consumer.TraceConsumerOld = (*traceCloningFanOutConnectorOld)(nil)
|
||||
|
||||
// ConsumeTraceData exports the span data to all trace consumers wrapped by the current one.
|
||||
func (tfc traceCloningFanOutConnectorOld) ConsumeTraceData(ctx context.Context, td consumerdata.TraceData) error {
|
||||
var errs []error
|
||||
|
||||
// Fan out to first len-1 consumers.
|
||||
for i := 0; i < len(tfc)-1; i++ {
|
||||
// Create a clone of data. We need to clone because consumers may modify the data.
|
||||
if err := tfc[i].ConsumeTraceData(ctx, cloneTraceDataOld(td)); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(tfc) > 0 {
|
||||
// Give the original data to the last consumer.
|
||||
lastTc := tfc[len(tfc)-1]
|
||||
if err := lastTc.ConsumeTraceData(ctx, td); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
|
||||
func newTraceCloningFanOutConnector(tcs []consumer.TraceConsumer) consumer.TraceConsumer {
|
||||
return traceCloningFanOutConnector(tcs)
|
||||
}
|
||||
|
||||
type traceCloningFanOutConnector []consumer.TraceConsumer
|
||||
|
||||
var _ consumer.TraceConsumer = (*traceCloningFanOutConnector)(nil)
|
||||
|
||||
// ConsumeTraceData exports the span data to all trace consumers wrapped by the current one.
|
||||
func (tfc traceCloningFanOutConnector) ConsumeTraces(ctx context.Context, td pdata.Traces) error {
|
||||
var errs []error
|
||||
|
||||
// Fan out to first len-1 consumers.
|
||||
for i := 0; i < len(tfc)-1; i++ {
|
||||
// Create a clone of data. We need to clone because consumers may modify the data.
|
||||
clone := td.Clone()
|
||||
if err := tfc[i].ConsumeTraces(ctx, clone); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(tfc) > 0 {
|
||||
// Give the original data to the last consumer.
|
||||
lastTc := tfc[len(tfc)-1]
|
||||
if err := lastTc.ConsumeTraces(ctx, td); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
|
||||
// NewLogCloningFanOutConnector wraps multiple trace consumers in a single one.
|
||||
func NewLogCloningFanOutConnector(lcs []consumer.LogConsumer) consumer.LogConsumer {
|
||||
return LogCloningFanOutConnector(lcs)
|
||||
}
|
||||
|
||||
type LogCloningFanOutConnector []consumer.LogConsumer
|
||||
|
||||
var _ consumer.LogConsumer = (*LogCloningFanOutConnector)(nil)
|
||||
|
||||
// ConsumeLogs exports the span data to all consumers wrapped by the current one.
|
||||
func (lfc LogCloningFanOutConnector) ConsumeLogs(ctx context.Context, ld data.Logs) error {
|
||||
var errs []error
|
||||
|
||||
// Fan out to first len-1 consumers.
|
||||
for i := 0; i < len(lfc)-1; i++ {
|
||||
// Create a clone of data. We need to clone because consumers may modify the data.
|
||||
clone := ld.Clone()
|
||||
if err := lfc[i].ConsumeLogs(ctx, clone); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(lfc) > 0 {
|
||||
// Give the original data to the last consumer.
|
||||
lastTc := lfc[len(lfc)-1]
|
||||
if err := lastTc.ConsumeLogs(ctx, ld); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
|
||||
func cloneTraceDataOld(td consumerdata.TraceData) consumerdata.TraceData {
|
||||
clone := consumerdata.TraceData{
|
||||
SourceFormat: td.SourceFormat,
|
||||
Node: proto.Clone(td.Node).(*commonpb.Node),
|
||||
Resource: proto.Clone(td.Resource).(*resourcepb.Resource),
|
||||
}
|
||||
|
||||
if td.Spans != nil {
|
||||
clone.Spans = make([]*tracepb.Span, 0, len(td.Spans))
|
||||
|
||||
for _, span := range td.Spans {
|
||||
spanClone := proto.Clone(span).(*tracepb.Span)
|
||||
clone.Spans = append(clone.Spans, spanClone)
|
||||
}
|
||||
}
|
||||
|
||||
return clone
|
||||
}
|
||||
-177
@@ -1,177 +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 processor
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/collector/component/componenterror"
|
||||
"go.opentelemetry.io/collector/consumer"
|
||||
"go.opentelemetry.io/collector/consumer/consumerdata"
|
||||
"go.opentelemetry.io/collector/consumer/converter"
|
||||
"go.opentelemetry.io/collector/consumer/pdata"
|
||||
"go.opentelemetry.io/collector/internal/data"
|
||||
)
|
||||
|
||||
// This file contains implementations of Trace/Metrics connectors
|
||||
// that fan out the data to multiple other consumers.
|
||||
|
||||
// CreateMetricsFanOutConnector creates a connector based on provided type of trace consumer.
|
||||
// If any of the wrapped metrics consumers are of the new type, use metricsFanOutConnector,
|
||||
// otherwise use the old type connector.
|
||||
func CreateMetricsFanOutConnector(mcs []consumer.MetricsConsumerBase) consumer.MetricsConsumerBase {
|
||||
metricsConsumersOld := make([]consumer.MetricsConsumerOld, 0, len(mcs))
|
||||
metricsConsumers := make([]consumer.MetricsConsumer, 0, len(mcs))
|
||||
allMetricsConsumersOld := true
|
||||
for _, mc := range mcs {
|
||||
if metricsConsumer, ok := mc.(consumer.MetricsConsumer); ok {
|
||||
allMetricsConsumersOld = false
|
||||
metricsConsumers = append(metricsConsumers, metricsConsumer)
|
||||
} else {
|
||||
metricsConsumerOld := mc.(consumer.MetricsConsumerOld)
|
||||
metricsConsumersOld = append(metricsConsumersOld, metricsConsumerOld)
|
||||
metricsConsumers = append(metricsConsumers, converter.NewInternalToOCMetricsConverter(metricsConsumerOld))
|
||||
}
|
||||
}
|
||||
|
||||
if allMetricsConsumersOld {
|
||||
return NewMetricsFanOutConnectorOld(metricsConsumersOld)
|
||||
}
|
||||
return NewMetricsFanOutConnector(metricsConsumers)
|
||||
}
|
||||
|
||||
// NewMetricsFanOutConnectorOld wraps multiple metrics consumers in a single one.
|
||||
func NewMetricsFanOutConnectorOld(mcs []consumer.MetricsConsumerOld) consumer.MetricsConsumerOld {
|
||||
return metricsFanOutConnectorOld(mcs)
|
||||
}
|
||||
|
||||
type metricsFanOutConnectorOld []consumer.MetricsConsumerOld
|
||||
|
||||
var _ consumer.MetricsConsumerOld = (*metricsFanOutConnectorOld)(nil)
|
||||
|
||||
// ConsumeMetricsData exports the MetricsData to all consumers wrapped by the current one.
|
||||
func (mfc metricsFanOutConnectorOld) ConsumeMetricsData(ctx context.Context, md consumerdata.MetricsData) error {
|
||||
var errs []error
|
||||
for _, mc := range mfc {
|
||||
if err := mc.ConsumeMetricsData(ctx, md); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
|
||||
// NewMetricsFanOutConnector wraps multiple new type metrics consumers in a single one.
|
||||
func NewMetricsFanOutConnector(mcs []consumer.MetricsConsumer) consumer.MetricsConsumer {
|
||||
return metricsFanOutConnector(mcs)
|
||||
}
|
||||
|
||||
type metricsFanOutConnector []consumer.MetricsConsumer
|
||||
|
||||
var _ consumer.MetricsConsumer = (*metricsFanOutConnector)(nil)
|
||||
|
||||
// ConsumeMetricsData exports the MetricsData to all consumers wrapped by the current one.
|
||||
func (mfc metricsFanOutConnector) ConsumeMetrics(ctx context.Context, md pdata.Metrics) error {
|
||||
var errs []error
|
||||
for _, mc := range mfc {
|
||||
if err := mc.ConsumeMetrics(ctx, md); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
|
||||
// CreateTraceFanOutConnector wraps multiple trace consumers in a single one.
|
||||
// If any of the wrapped trace consumers are of the new type, use traceFanOutConnector,
|
||||
// otherwise use the old type connector
|
||||
func CreateTraceFanOutConnector(tcs []consumer.TraceConsumerBase) consumer.TraceConsumerBase {
|
||||
traceConsumersOld := make([]consumer.TraceConsumerOld, 0, len(tcs))
|
||||
traceConsumers := make([]consumer.TraceConsumer, 0, len(tcs))
|
||||
allTraceConsumersOld := true
|
||||
for _, tc := range tcs {
|
||||
if traceConsumer, ok := tc.(consumer.TraceConsumer); ok {
|
||||
allTraceConsumersOld = false
|
||||
traceConsumers = append(traceConsumers, traceConsumer)
|
||||
} else {
|
||||
traceConsumerOld := tc.(consumer.TraceConsumerOld)
|
||||
traceConsumersOld = append(traceConsumersOld, traceConsumerOld)
|
||||
traceConsumers = append(traceConsumers, converter.NewInternalToOCTraceConverter(traceConsumerOld))
|
||||
}
|
||||
}
|
||||
|
||||
if allTraceConsumersOld {
|
||||
return NewTraceFanOutConnectorOld(traceConsumersOld)
|
||||
}
|
||||
return NewTraceFanOutConnector(traceConsumers)
|
||||
}
|
||||
|
||||
// NewTraceFanOutConnectorOld wraps multiple trace consumers in a single one.
|
||||
func NewTraceFanOutConnectorOld(tcs []consumer.TraceConsumerOld) consumer.TraceConsumerOld {
|
||||
return traceFanOutConnectorOld(tcs)
|
||||
}
|
||||
|
||||
type traceFanOutConnectorOld []consumer.TraceConsumerOld
|
||||
|
||||
var _ consumer.TraceConsumerOld = (*traceFanOutConnectorOld)(nil)
|
||||
|
||||
// ConsumeTraceData exports the span data to all trace consumers wrapped by the current one.
|
||||
func (tfc traceFanOutConnectorOld) ConsumeTraceData(ctx context.Context, td consumerdata.TraceData) error {
|
||||
var errs []error
|
||||
for _, tc := range tfc {
|
||||
if err := tc.ConsumeTraceData(ctx, td); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
|
||||
// NewTraceFanOutConnector wraps multiple new type trace consumers in a single one.
|
||||
func NewTraceFanOutConnector(tcs []consumer.TraceConsumer) consumer.TraceConsumer {
|
||||
return traceFanOutConnector(tcs)
|
||||
}
|
||||
|
||||
type traceFanOutConnector []consumer.TraceConsumer
|
||||
|
||||
var _ consumer.TraceConsumer = (*traceFanOutConnector)(nil)
|
||||
|
||||
// ConsumeTraces exports the span data to all trace consumers wrapped by the current one.
|
||||
func (tfc traceFanOutConnector) ConsumeTraces(ctx context.Context, td pdata.Traces) error {
|
||||
var errs []error
|
||||
for _, tc := range tfc {
|
||||
if err := tc.ConsumeTraces(ctx, td); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
|
||||
// NewLogFanOutConnector wraps multiple new type consumers in a single one.
|
||||
func NewLogFanOutConnector(lcs []consumer.LogConsumer) consumer.LogConsumer {
|
||||
return LogFanOutConnector(lcs)
|
||||
}
|
||||
|
||||
type LogFanOutConnector []consumer.LogConsumer
|
||||
|
||||
var _ consumer.LogConsumer = (*LogFanOutConnector)(nil)
|
||||
|
||||
// Consume exports the span data to all consumers wrapped by the current one.
|
||||
func (fc LogFanOutConnector) ConsumeLogs(ctx context.Context, ld data.Logs) error {
|
||||
var errs []error
|
||||
for _, tc := range fc {
|
||||
if err := tc.ConsumeLogs(ctx, ld); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
-210
@@ -1,210 +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 processor
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
commonpb "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1"
|
||||
"go.opencensus.io/stats"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/tag"
|
||||
|
||||
"go.opentelemetry.io/collector/consumer/pdata"
|
||||
"go.opentelemetry.io/collector/internal/collector/telemetry"
|
||||
"go.opentelemetry.io/collector/obsreport"
|
||||
"go.opentelemetry.io/collector/translator/conventions"
|
||||
)
|
||||
|
||||
// Keys and stats for telemetry.
|
||||
var (
|
||||
TagServiceNameKey, _ = tag.NewKey("service")
|
||||
TagProcessorNameKey, _ = tag.NewKey(obsreport.ProcessorKey)
|
||||
|
||||
StatReceivedSpanCount = stats.Int64(
|
||||
"spans_received",
|
||||
"counts the number of spans received",
|
||||
stats.UnitDimensionless)
|
||||
StatDroppedSpanCount = stats.Int64(
|
||||
"spans_dropped",
|
||||
"counts the number of spans dropped",
|
||||
stats.UnitDimensionless)
|
||||
|
||||
StatTraceBatchesDroppedCount = stats.Int64(
|
||||
"trace_batches_dropped",
|
||||
"counts the number of trace batches dropped",
|
||||
stats.UnitDimensionless)
|
||||
)
|
||||
|
||||
// SpanCountStats represents span count stats grouped by service if DETAILED telemetry level is set,
|
||||
// otherwise only overall span count is stored in serviceSpansCounts.
|
||||
type SpanCountStats struct {
|
||||
serviceSpansCounts map[string]int
|
||||
allSpansCount int
|
||||
isDetailed bool
|
||||
}
|
||||
|
||||
func NewSpanCountStats(td pdata.Traces) *SpanCountStats {
|
||||
scm := &SpanCountStats{
|
||||
allSpansCount: td.SpanCount(),
|
||||
}
|
||||
if serviceTagsEnabled() {
|
||||
scm.serviceSpansCounts = spanCountByResourceStringAttribute(td, conventions.AttributeServiceName)
|
||||
scm.isDetailed = true
|
||||
}
|
||||
return scm
|
||||
}
|
||||
|
||||
func (scm *SpanCountStats) GetAllSpansCount() int {
|
||||
return scm.allSpansCount
|
||||
}
|
||||
|
||||
// MetricTagKeys returns the metric tag keys according to the given telemetry level.
|
||||
func MetricTagKeys(level telemetry.Level) []tag.Key {
|
||||
var tagKeys []tag.Key
|
||||
switch level {
|
||||
case telemetry.Detailed:
|
||||
tagKeys = append(tagKeys, TagServiceNameKey)
|
||||
fallthrough
|
||||
case telemetry.Normal, telemetry.Basic:
|
||||
tagKeys = append(tagKeys, TagProcessorNameKey)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
return tagKeys
|
||||
}
|
||||
|
||||
// MetricViews return the metrics views according to given telemetry level.
|
||||
func MetricViews(level telemetry.Level) []*view.View {
|
||||
tagKeys := MetricTagKeys(level)
|
||||
if tagKeys == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// There are some metrics enabled, return the views.
|
||||
receivedBatchesView := &view.View{
|
||||
Name: "batches_received",
|
||||
Measure: StatReceivedSpanCount,
|
||||
Description: "The number of span batches received.",
|
||||
TagKeys: tagKeys,
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
droppedBatchesView := &view.View{
|
||||
Measure: StatTraceBatchesDroppedCount,
|
||||
Description: "The number of span batches dropped.",
|
||||
TagKeys: tagKeys,
|
||||
Aggregation: view.Sum(),
|
||||
}
|
||||
receivedSpansView := &view.View{
|
||||
Name: StatReceivedSpanCount.Name(),
|
||||
Measure: StatReceivedSpanCount,
|
||||
Description: "The number of spans received.",
|
||||
TagKeys: tagKeys,
|
||||
Aggregation: view.Sum(),
|
||||
}
|
||||
droppedSpansView := &view.View{
|
||||
Name: StatDroppedSpanCount.Name(),
|
||||
Measure: StatDroppedSpanCount,
|
||||
Description: "The number of spans dropped.",
|
||||
TagKeys: tagKeys,
|
||||
Aggregation: view.Sum(),
|
||||
}
|
||||
|
||||
legacyViews := []*view.View{
|
||||
receivedBatchesView,
|
||||
droppedBatchesView,
|
||||
receivedSpansView,
|
||||
droppedSpansView,
|
||||
}
|
||||
|
||||
return obsreport.ProcessorMetricViews("", legacyViews)
|
||||
}
|
||||
|
||||
// ServiceNameForNode gets the service name for a specified node.
|
||||
func ServiceNameForNode(node *commonpb.Node) string {
|
||||
var serviceName string
|
||||
if node == nil {
|
||||
serviceName = "<nil-batch-node>"
|
||||
} else if node.ServiceInfo == nil {
|
||||
serviceName = "<nil-service-info>"
|
||||
} else if node.ServiceInfo.Name == "" {
|
||||
serviceName = "<empty-service-info-name>"
|
||||
} else {
|
||||
serviceName = node.ServiceInfo.Name
|
||||
}
|
||||
return serviceName
|
||||
}
|
||||
|
||||
// ServiceNameForResource gets the service name for a specified Resource.
|
||||
// TODO: Find a better package for this function.
|
||||
func ServiceNameForResource(resource pdata.Resource) string {
|
||||
if resource.IsNil() {
|
||||
return "<nil-resource>"
|
||||
}
|
||||
|
||||
service, found := resource.Attributes().Get(conventions.AttributeServiceName)
|
||||
if !found {
|
||||
return "<nil-service-name>"
|
||||
}
|
||||
|
||||
return service.StringVal()
|
||||
}
|
||||
|
||||
// RecordsSpanCountMetrics reports span count metrics for specified measure.
|
||||
func RecordsSpanCountMetrics(ctx context.Context, scm *SpanCountStats, measure *stats.Int64Measure) {
|
||||
if scm.isDetailed {
|
||||
for serviceName, spanCount := range scm.serviceSpansCounts {
|
||||
statsTags := []tag.Mutator{tag.Insert(TagServiceNameKey, serviceName)}
|
||||
_ = stats.RecordWithTags(ctx, statsTags, measure.M(int64(spanCount)))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
stats.Record(ctx, measure.M(int64(scm.allSpansCount)))
|
||||
}
|
||||
|
||||
func serviceTagsEnabled() bool {
|
||||
level, err := telemetry.GetLevel()
|
||||
return err == nil && level == telemetry.Detailed
|
||||
}
|
||||
|
||||
// spanCountByResourceStringAttribute calculates the number of spans by resource specified by
|
||||
// provided string attribute attrKey.
|
||||
func spanCountByResourceStringAttribute(td pdata.Traces, attrKey string) map[string]int {
|
||||
spanCounts := make(map[string]int)
|
||||
|
||||
rss := td.ResourceSpans()
|
||||
for i := 0; i < rss.Len(); i++ {
|
||||
rs := rss.At(i)
|
||||
if rs.IsNil() {
|
||||
continue
|
||||
}
|
||||
|
||||
var attrStringVal string
|
||||
if attrVal, ok := rs.Resource().Attributes().Get(attrKey); ok {
|
||||
attrStringVal = attrVal.StringVal()
|
||||
}
|
||||
ilss := rs.InstrumentationLibrarySpans()
|
||||
for j := 0; j < ilss.Len(); j++ {
|
||||
ils := ilss.At(j)
|
||||
if ils.IsNil() {
|
||||
continue
|
||||
}
|
||||
spanCounts[attrStringVal] += ilss.At(j).Spans().Len()
|
||||
}
|
||||
}
|
||||
return spanCounts
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ import (
|
||||
"go.opentelemetry.io/collector/consumer"
|
||||
"go.opentelemetry.io/collector/consumer/pdatautil"
|
||||
"go.opentelemetry.io/collector/internal/data"
|
||||
collectormetrics "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/collector/metrics/v1"
|
||||
collectormetrics "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/metrics/v1"
|
||||
"go.opentelemetry.io/collector/obsreport"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -27,8 +27,8 @@ import (
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenterror"
|
||||
"go.opentelemetry.io/collector/consumer"
|
||||
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"
|
||||
collectormetrics "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/metrics/v1"
|
||||
collectortrace "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/trace/v1"
|
||||
"go.opentelemetry.io/collector/receiver/otlpreceiver/metrics"
|
||||
"go.opentelemetry.io/collector/receiver/otlpreceiver/trace"
|
||||
)
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import (
|
||||
"go.opentelemetry.io/collector/client"
|
||||
"go.opentelemetry.io/collector/consumer"
|
||||
"go.opentelemetry.io/collector/consumer/pdata"
|
||||
collectortrace "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/collector/trace/v1"
|
||||
collectortrace "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/trace/v1"
|
||||
"go.opentelemetry.io/collector/obsreport"
|
||||
)
|
||||
|
||||
|
||||
-57
@@ -1,57 +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 builder
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const (
|
||||
// flags
|
||||
configCfg = "config"
|
||||
memBallastFlag = "mem-ballast-size-mib"
|
||||
|
||||
kindLogKey = "component_kind"
|
||||
kindLogReceiver = "receiver"
|
||||
kindLogProcessor = "processor"
|
||||
kindLogExporter = "exporter"
|
||||
kindLogExtension = "extension"
|
||||
typeLogKey = "component_type"
|
||||
nameLogKey = "component_name"
|
||||
)
|
||||
|
||||
var (
|
||||
configFile *string
|
||||
memBallastSize *uint
|
||||
)
|
||||
|
||||
// Flags adds flags related to basic building of the collector application to the given flagset.
|
||||
func Flags(flags *flag.FlagSet) {
|
||||
configFile = flags.String(configCfg, "", "Path to the config file")
|
||||
memBallastSize = flags.Uint(memBallastFlag, 0,
|
||||
fmt.Sprintf("Flag to specify size of memory (MiB) ballast to set. Ballast is not used when this is not specified. "+
|
||||
"default settings: 0"))
|
||||
}
|
||||
|
||||
// GetConfigFile gets the config file from the config file flag.
|
||||
func GetConfigFile() string {
|
||||
return *configFile
|
||||
}
|
||||
|
||||
// MemBallastSize returns the size of memory ballast to use in MBs
|
||||
func MemBallastSize() int {
|
||||
return int(*memBallastSize)
|
||||
}
|
||||
-17
@@ -1,17 +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 builder handles the options to build the OpenTelemetry collector
|
||||
// pipeline.
|
||||
package builder
|
||||
-370
@@ -1,370 +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 builder
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenterror"
|
||||
"go.opentelemetry.io/collector/config/configerror"
|
||||
"go.opentelemetry.io/collector/config/configmodels"
|
||||
)
|
||||
|
||||
// builtExporter is an exporter that is built based on a config. It can have
|
||||
// a trace and/or a metrics consumer and have a shutdown function.
|
||||
type builtExporter struct {
|
||||
logger *zap.Logger
|
||||
te component.TraceExporterBase
|
||||
me component.MetricsExporterBase
|
||||
le component.LogExporter
|
||||
}
|
||||
|
||||
// Start the exporter.
|
||||
func (exp *builtExporter) Start(ctx context.Context, host component.Host) error {
|
||||
var errors []error
|
||||
if exp.te != nil {
|
||||
err := exp.te.Start(ctx, host)
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
}
|
||||
|
||||
if exp.me != nil {
|
||||
err := exp.me.Start(ctx, host)
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
}
|
||||
|
||||
return componenterror.CombineErrors(errors)
|
||||
}
|
||||
|
||||
// Shutdown the trace component and the metrics component of an exporter.
|
||||
func (exp *builtExporter) Shutdown(ctx context.Context) error {
|
||||
var errors []error
|
||||
if exp.te != nil {
|
||||
if err := exp.te.Shutdown(ctx); err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
}
|
||||
|
||||
if exp.me != nil {
|
||||
if err := exp.me.Shutdown(ctx); err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
}
|
||||
|
||||
return componenterror.CombineErrors(errors)
|
||||
}
|
||||
|
||||
func (exp *builtExporter) GetTraceExporter() component.TraceExporterBase {
|
||||
return exp.te
|
||||
}
|
||||
|
||||
func (exp *builtExporter) GetMetricExporter() component.MetricsExporterBase {
|
||||
return exp.me
|
||||
}
|
||||
|
||||
// Exporters is a map of exporters created from exporter configs.
|
||||
type Exporters map[configmodels.Exporter]*builtExporter
|
||||
|
||||
// StartAll starts all exporters.
|
||||
func (exps Exporters) StartAll(ctx context.Context, host component.Host) error {
|
||||
for _, exp := range exps {
|
||||
exp.logger.Info("Exporter is starting...")
|
||||
|
||||
if err := exp.Start(ctx, host); err != nil {
|
||||
return err
|
||||
}
|
||||
exp.logger.Info("Exporter started.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ShutdownAll stops all exporters.
|
||||
func (exps Exporters) ShutdownAll(ctx context.Context) error {
|
||||
var errs []error
|
||||
for _, exp := range exps {
|
||||
err := exp.Shutdown(ctx)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(errs) != 0 {
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (exps Exporters) ToMapByDataType() map[configmodels.DataType]map[configmodels.Exporter]component.Exporter {
|
||||
|
||||
exportersMap := make(map[configmodels.DataType]map[configmodels.Exporter]component.Exporter)
|
||||
|
||||
exportersMap[configmodels.TracesDataType] = make(map[configmodels.Exporter]component.Exporter, len(exps))
|
||||
exportersMap[configmodels.MetricsDataType] = make(map[configmodels.Exporter]component.Exporter, len(exps))
|
||||
|
||||
for cfg, exp := range exps {
|
||||
te := exp.GetTraceExporter()
|
||||
if te != nil {
|
||||
exportersMap[configmodels.TracesDataType][cfg] = te
|
||||
}
|
||||
me := exp.GetMetricExporter()
|
||||
if me != nil {
|
||||
exportersMap[configmodels.MetricsDataType][cfg] = me
|
||||
}
|
||||
}
|
||||
|
||||
return exportersMap
|
||||
}
|
||||
|
||||
type dataTypeRequirement struct {
|
||||
// Pipeline that requires the data type.
|
||||
requiredBy *configmodels.Pipeline
|
||||
}
|
||||
|
||||
// Map of data type requirements.
|
||||
type dataTypeRequirements map[configmodels.DataType]dataTypeRequirement
|
||||
|
||||
// Data type requirements for all exporters.
|
||||
type exportersRequiredDataTypes map[configmodels.Exporter]dataTypeRequirements
|
||||
|
||||
// ExportersBuilder builds exporters from config.
|
||||
type ExportersBuilder struct {
|
||||
logger *zap.Logger
|
||||
config *configmodels.Config
|
||||
factories map[configmodels.Type]component.ExporterFactoryBase
|
||||
}
|
||||
|
||||
// NewExportersBuilder creates a new ExportersBuilder. Call BuildExporters() on the returned value.
|
||||
func NewExportersBuilder(
|
||||
logger *zap.Logger,
|
||||
config *configmodels.Config,
|
||||
factories map[configmodels.Type]component.ExporterFactoryBase,
|
||||
) *ExportersBuilder {
|
||||
return &ExportersBuilder{logger.With(zap.String(kindLogKey, kindLogExporter)), config, factories}
|
||||
}
|
||||
|
||||
// BuildExporters exporters from config.
|
||||
func (eb *ExportersBuilder) Build() (Exporters, error) {
|
||||
exporters := make(Exporters)
|
||||
|
||||
// We need to calculate required input data types for each exporter so that we know
|
||||
// which data type must be started for each exporter.
|
||||
exporterInputDataTypes := eb.calcExportersRequiredDataTypes()
|
||||
|
||||
// BuildExporters exporters based on configuration and required input data types.
|
||||
for _, cfg := range eb.config.Exporters {
|
||||
componentLogger := eb.logger.With(zap.String(typeLogKey, string(cfg.Type())), zap.String(nameLogKey, cfg.Name()))
|
||||
exp, err := eb.buildExporter(componentLogger, cfg, exporterInputDataTypes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
exporters[cfg] = exp
|
||||
}
|
||||
|
||||
return exporters, nil
|
||||
}
|
||||
|
||||
func (eb *ExportersBuilder) calcExportersRequiredDataTypes() exportersRequiredDataTypes {
|
||||
|
||||
// Go over all pipelines. The data type of the pipeline defines what data type
|
||||
// each exporter is expected to receive. Collect all required types for each
|
||||
// exporter.
|
||||
//
|
||||
// We also remember the last pipeline that requested the particular data type.
|
||||
// This is only needed for logging purposes in error cases when we need to
|
||||
// print that a particular exporter does not support the data type required for
|
||||
// a particular pipeline.
|
||||
|
||||
result := make(exportersRequiredDataTypes)
|
||||
|
||||
// Iterate over pipelines.
|
||||
for _, pipeline := range eb.config.Service.Pipelines {
|
||||
// Iterate over all exporters for this pipeline.
|
||||
for _, expName := range pipeline.Exporters {
|
||||
// Find the exporter config by name.
|
||||
exporter := eb.config.Exporters[expName]
|
||||
|
||||
// Create the data type requirement for the exporter if it does not exist.
|
||||
if result[exporter] == nil {
|
||||
result[exporter] = make(dataTypeRequirements)
|
||||
}
|
||||
|
||||
// Remember that this data type is required for the exporter and also which
|
||||
// pipeline the requirement is coming from.
|
||||
result[exporter][pipeline.InputType] = dataTypeRequirement{pipeline}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (eb *ExportersBuilder) buildExporter(
|
||||
logger *zap.Logger,
|
||||
config configmodels.Exporter,
|
||||
exportersInputDataTypes exportersRequiredDataTypes,
|
||||
) (*builtExporter, error) {
|
||||
factory := eb.factories[config.Type()]
|
||||
if factory == nil {
|
||||
return nil, fmt.Errorf("exporter factory not found for type: %s", config.Type())
|
||||
}
|
||||
|
||||
exporter := &builtExporter{
|
||||
logger: logger,
|
||||
}
|
||||
|
||||
inputDataTypes := exportersInputDataTypes[config]
|
||||
if inputDataTypes == nil {
|
||||
logger.Info("Ignoring exporter as it is not used by any pipeline")
|
||||
return exporter, nil
|
||||
}
|
||||
|
||||
for dataType, requirement := range inputDataTypes {
|
||||
|
||||
switch dataType {
|
||||
case configmodels.TracesDataType:
|
||||
// Traces data type is required. Create a trace exporter based on config.
|
||||
te, err := createTraceExporter(factory, logger, config)
|
||||
if err != nil {
|
||||
if err == configerror.ErrDataTypeIsNotSupported {
|
||||
// Could not create because this exporter does not support this data type.
|
||||
return nil, exporterTypeMismatchErr(config, requirement.requiredBy, dataType)
|
||||
}
|
||||
return nil, fmt.Errorf("error creating %s exporter: %v", config.Name(), err)
|
||||
}
|
||||
|
||||
// Check if the factory really created the exporter.
|
||||
if te == nil {
|
||||
return nil, fmt.Errorf("factory for %q produced a nil exporter", config.Name())
|
||||
}
|
||||
|
||||
exporter.te = te
|
||||
|
||||
case configmodels.MetricsDataType:
|
||||
// Metrics data type is required. Create a trace exporter based on config.
|
||||
me, err := createMetricsExporter(factory, logger, config)
|
||||
if err != nil {
|
||||
if err == configerror.ErrDataTypeIsNotSupported {
|
||||
// Could not create because this exporter does not support this data type.
|
||||
return nil, exporterTypeMismatchErr(config, requirement.requiredBy, dataType)
|
||||
}
|
||||
return nil, fmt.Errorf("error creating %s exporter: %v", config.Name(), err)
|
||||
}
|
||||
|
||||
// The factories can be implemented by third parties, check if they really
|
||||
// created the exporter.
|
||||
if me == nil {
|
||||
return nil, fmt.Errorf("factory for %q produced a nil exporter", config.Name())
|
||||
}
|
||||
|
||||
exporter.me = me
|
||||
|
||||
case configmodels.LogsDataType:
|
||||
le, err := createLogExporter(factory, logger, config)
|
||||
if err != nil {
|
||||
if err == configerror.ErrDataTypeIsNotSupported {
|
||||
// Could not create because this exporter does not support this data type.
|
||||
return nil, exporterTypeMismatchErr(config, requirement.requiredBy, dataType)
|
||||
}
|
||||
return nil, fmt.Errorf("error creating %s exporter: %v", config.Name(), err)
|
||||
}
|
||||
|
||||
// Check if the factory really created the exporter.
|
||||
if le == nil {
|
||||
return nil, fmt.Errorf("factory for %q produced a nil exporter", config.Name())
|
||||
}
|
||||
|
||||
exporter.le = le
|
||||
|
||||
default:
|
||||
// Could not create because this exporter does not support this data type.
|
||||
return nil, exporterTypeMismatchErr(config, requirement.requiredBy, dataType)
|
||||
}
|
||||
}
|
||||
|
||||
eb.logger.Info("Exporter is enabled.", zap.String("exporter", config.Name()))
|
||||
|
||||
return exporter, nil
|
||||
}
|
||||
|
||||
func exporterTypeMismatchErr(
|
||||
config configmodels.Exporter,
|
||||
requiredByPipeline *configmodels.Pipeline,
|
||||
dataType configmodels.DataType,
|
||||
) error {
|
||||
return fmt.Errorf("pipeline %q of data type %q has an exporter %q, which does not support that data type",
|
||||
requiredByPipeline.Name, dataType,
|
||||
config.Name(),
|
||||
)
|
||||
}
|
||||
|
||||
// createTraceProcessor creates a trace exporter based on provided factory type.
|
||||
func createTraceExporter(
|
||||
factoryBase component.ExporterFactoryBase,
|
||||
logger *zap.Logger,
|
||||
cfg configmodels.Exporter,
|
||||
) (component.TraceExporterBase, error) {
|
||||
if factory, ok := factoryBase.(component.ExporterFactory); ok {
|
||||
creationParams := component.ExporterCreateParams{Logger: logger}
|
||||
ctx := context.Background()
|
||||
|
||||
// If exporter is of the new type (can manipulate on internal data structure),
|
||||
// use ExporterFactory.CreateTraceExporter.
|
||||
return factory.CreateTraceExporter(ctx, creationParams, cfg)
|
||||
}
|
||||
|
||||
// If exporter is of the old type (can manipulate on OC traces only),
|
||||
// use ExporterFactoryOld.CreateTraceExporter.
|
||||
return factoryBase.(component.ExporterFactoryOld).CreateTraceExporter(logger, cfg)
|
||||
}
|
||||
|
||||
// createMetricsExporter creates a metrics exporter based on provided factory type.
|
||||
func createMetricsExporter(factoryBase component.ExporterFactoryBase,
|
||||
logger *zap.Logger,
|
||||
cfg configmodels.Exporter,
|
||||
) (component.MetricsExporterBase, error) {
|
||||
if factory, ok := factoryBase.(component.ExporterFactory); ok {
|
||||
creationParams := component.ExporterCreateParams{Logger: logger}
|
||||
ctx := context.Background()
|
||||
|
||||
// If exporter is of the new type (can manipulate on internal data structure),
|
||||
// use ExporterFactory.CreateMetricsExporter.
|
||||
return factory.CreateMetricsExporter(ctx, creationParams, cfg)
|
||||
}
|
||||
|
||||
// If exporter is of the old type (can manipulate on OC metrics only),
|
||||
// use ExporterFactoryOld.CreateMetricsExporter.
|
||||
return factoryBase.(component.ExporterFactoryOld).CreateMetricsExporter(logger, cfg)
|
||||
}
|
||||
|
||||
// createLogExporter creates a data exporter based on provided factory type.
|
||||
func createLogExporter(
|
||||
factoryBase component.ExporterFactoryBase,
|
||||
logger *zap.Logger,
|
||||
cfg configmodels.Exporter,
|
||||
) (component.LogExporter, error) {
|
||||
factory, ok := factoryBase.(component.LogExporterFactory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("exporter %q does not support data type %q", factoryBase.Type(), configmodels.LogsDataType)
|
||||
}
|
||||
creationParams := component.ExporterCreateParams{Logger: logger}
|
||||
ctx := context.Background()
|
||||
return factory.CreateLogExporter(ctx, creationParams, cfg)
|
||||
}
|
||||
-181
@@ -1,181 +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 builder
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenterror"
|
||||
"go.opentelemetry.io/collector/config/configmodels"
|
||||
)
|
||||
|
||||
// builtExporter is an exporter that is built based on a config. It can have
|
||||
// a trace and/or a metrics consumer and have a shutdown function.
|
||||
type builtExtension struct {
|
||||
logger *zap.Logger
|
||||
extension component.ServiceExtension
|
||||
}
|
||||
|
||||
// Start the receiver.
|
||||
func (ext *builtExtension) Start(ctx context.Context, host component.Host) error {
|
||||
return ext.extension.Start(ctx, host)
|
||||
}
|
||||
|
||||
// Stop the receiver.
|
||||
func (ext *builtExtension) Shutdown(ctx context.Context) error {
|
||||
return ext.extension.Shutdown(ctx)
|
||||
}
|
||||
|
||||
var _ component.ServiceExtension = (*builtExtension)(nil)
|
||||
|
||||
// Exporters is a map of exporters created from exporter configs.
|
||||
type Extensions map[configmodels.Extension]*builtExtension
|
||||
|
||||
// StartAll starts all exporters.
|
||||
func (exts Extensions) StartAll(ctx context.Context, host component.Host) error {
|
||||
for _, ext := range exts {
|
||||
ext.logger.Info("Extension is starting...")
|
||||
|
||||
if err := ext.Start(ctx, host); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ext.logger.Info("Extension started.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ShutdownAll stops all exporters.
|
||||
func (exts Extensions) ShutdownAll(ctx context.Context) error {
|
||||
var errs []error
|
||||
for _, ext := range exts {
|
||||
err := ext.Shutdown(ctx)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(errs) != 0 {
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (exts Extensions) NotifyPipelineReady() error {
|
||||
for _, ext := range exts {
|
||||
if pw, ok := ext.extension.(component.PipelineWatcher); ok {
|
||||
if err := pw.Ready(); err != nil {
|
||||
ext.logger.Error("Error notifying extension that the pipeline was started.")
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (exts Extensions) NotifyPipelineNotReady() error {
|
||||
// Notify extensions in reverse order.
|
||||
var errs []error
|
||||
for _, ext := range exts {
|
||||
if pw, ok := ext.extension.(component.PipelineWatcher); ok {
|
||||
if err := pw.NotReady(); err != nil {
|
||||
ext.logger.Error("Error notifying extension that the pipeline was shutdown.")
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(errs) != 0 {
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (exts Extensions) ToMap() map[configmodels.Extension]component.ServiceExtension {
|
||||
result := make(map[configmodels.Extension]component.ServiceExtension, len(exts))
|
||||
for k, v := range exts {
|
||||
result[k] = v.extension
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// ExportersBuilder builds exporters from config.
|
||||
type ExtensionsBuilder struct {
|
||||
logger *zap.Logger
|
||||
config *configmodels.Config
|
||||
factories map[configmodels.Type]component.ExtensionFactory
|
||||
}
|
||||
|
||||
// NewExportersBuilder creates a new ExportersBuilder. Call BuildExporters() on the returned value.
|
||||
func NewExtensionsBuilder(
|
||||
logger *zap.Logger,
|
||||
config *configmodels.Config,
|
||||
factories map[configmodels.Type]component.ExtensionFactory,
|
||||
) *ExtensionsBuilder {
|
||||
return &ExtensionsBuilder{logger.With(zap.String(kindLogKey, kindLogExtension)), config, factories}
|
||||
}
|
||||
|
||||
// Build extensions from config.
|
||||
func (eb *ExtensionsBuilder) Build() (Extensions, error) {
|
||||
extensions := make(Extensions)
|
||||
|
||||
for _, extName := range eb.config.Service.Extensions {
|
||||
extCfg, exists := eb.config.Extensions[extName]
|
||||
if !exists {
|
||||
return nil, errors.Errorf("extension %q is not configured", extName)
|
||||
}
|
||||
|
||||
componentLogger := eb.logger.With(zap.String(typeLogKey, string(extCfg.Type())), zap.String(nameLogKey, extCfg.Name()))
|
||||
ext, err := eb.buildExtension(componentLogger, extCfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
extensions[extCfg] = ext
|
||||
}
|
||||
|
||||
return extensions, nil
|
||||
}
|
||||
|
||||
func (eb *ExtensionsBuilder) buildExtension(logger *zap.Logger, cfg configmodels.Extension) (*builtExtension, error) {
|
||||
factory := eb.factories[cfg.Type()]
|
||||
if factory == nil {
|
||||
return nil, errors.Errorf("extension factory for type %q is not configured", cfg.Type())
|
||||
}
|
||||
|
||||
ext := &builtExtension{
|
||||
logger: logger,
|
||||
}
|
||||
|
||||
ex, err := factory.CreateExtension(context.Background(), component.ExtensionCreateParams{Logger: eb.logger}, cfg)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to create extension %q", cfg.Name())
|
||||
}
|
||||
|
||||
// Check if the factory really created the extension.
|
||||
if ex == nil {
|
||||
return nil, errors.Errorf("factory for %q produced a nil extension", cfg.Name())
|
||||
}
|
||||
|
||||
ext.extension = ex
|
||||
|
||||
return ext, nil
|
||||
}
|
||||
-374
@@ -1,374 +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 builder
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenterror"
|
||||
"go.opentelemetry.io/collector/config/configmodels"
|
||||
"go.opentelemetry.io/collector/consumer"
|
||||
"go.opentelemetry.io/collector/consumer/converter"
|
||||
"go.opentelemetry.io/collector/processor"
|
||||
)
|
||||
|
||||
// builtPipeline is a pipeline that is built based on a config.
|
||||
// It can have a trace and/or a metrics consumer (the consumer is either the first
|
||||
// processor in the pipeline or the exporter if pipeline has no processors).
|
||||
type builtPipeline struct {
|
||||
logger *zap.Logger
|
||||
firstTC consumer.TraceConsumerBase
|
||||
firstMC consumer.MetricsConsumerBase
|
||||
firstLC consumer.LogConsumer
|
||||
|
||||
// MutatesConsumedData is set to true if any processors in the pipeline
|
||||
// can mutate the TraceData or MetricsData input argument.
|
||||
MutatesConsumedData bool
|
||||
|
||||
processors []component.Processor
|
||||
}
|
||||
|
||||
// BuiltPipelines is a map of build pipelines created from pipeline configs.
|
||||
type BuiltPipelines map[*configmodels.Pipeline]*builtPipeline
|
||||
|
||||
func (bps BuiltPipelines) StartProcessors(ctx context.Context, host component.Host) error {
|
||||
for _, bp := range bps {
|
||||
bp.logger.Info("Pipeline is starting...")
|
||||
// Start in reverse order, starting from the back of processors pipeline.
|
||||
// This is important so that processors that are earlier in the pipeline and
|
||||
// reference processors that are later in the pipeline do not start sending
|
||||
// data to later pipelines which are not yet started.
|
||||
for i := len(bp.processors) - 1; i >= 0; i-- {
|
||||
if err := bp.processors[i].Start(ctx, host); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
bp.logger.Info("Pipeline is started.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (bps BuiltPipelines) ShutdownProcessors(ctx context.Context) error {
|
||||
var errs []error
|
||||
for _, bp := range bps {
|
||||
bp.logger.Info("Pipeline is shutting down...")
|
||||
for _, p := range bp.processors {
|
||||
if err := p.Shutdown(ctx); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
bp.logger.Info("Pipeline is shutdown.")
|
||||
}
|
||||
|
||||
if len(errs) != 0 {
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PipelinesBuilder builds pipelines from config.
|
||||
type PipelinesBuilder struct {
|
||||
logger *zap.Logger
|
||||
config *configmodels.Config
|
||||
exporters Exporters
|
||||
factories map[configmodels.Type]component.ProcessorFactoryBase
|
||||
}
|
||||
|
||||
// NewPipelinesBuilder creates a new PipelinesBuilder. Requires exporters to be already
|
||||
// built via ExportersBuilder. Call BuildProcessors() on the returned value.
|
||||
func NewPipelinesBuilder(
|
||||
logger *zap.Logger,
|
||||
config *configmodels.Config,
|
||||
exporters Exporters,
|
||||
factories map[configmodels.Type]component.ProcessorFactoryBase,
|
||||
) *PipelinesBuilder {
|
||||
return &PipelinesBuilder{logger, config, exporters, factories}
|
||||
}
|
||||
|
||||
// BuildProcessors pipeline processors from config.
|
||||
func (pb *PipelinesBuilder) Build() (BuiltPipelines, error) {
|
||||
pipelineProcessors := make(BuiltPipelines)
|
||||
|
||||
for _, pipeline := range pb.config.Service.Pipelines {
|
||||
firstProcessor, err := pb.buildPipeline(pipeline)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pipelineProcessors[pipeline] = firstProcessor
|
||||
}
|
||||
|
||||
return pipelineProcessors, nil
|
||||
}
|
||||
|
||||
// Builds a pipeline of processors. Returns the first processor in the pipeline.
|
||||
// The last processor in the pipeline will be plugged to fan out the data into exporters
|
||||
// that are configured for this pipeline.
|
||||
func (pb *PipelinesBuilder) buildPipeline(pipelineCfg *configmodels.Pipeline,
|
||||
) (*builtPipeline, error) {
|
||||
|
||||
// BuildProcessors the pipeline backwards.
|
||||
|
||||
// First create a consumer junction point that fans out the data to all exporters.
|
||||
var tc consumer.TraceConsumerBase
|
||||
var mc consumer.MetricsConsumerBase
|
||||
var lc consumer.LogConsumer
|
||||
|
||||
switch pipelineCfg.InputType {
|
||||
case configmodels.TracesDataType:
|
||||
tc = pb.buildFanoutExportersTraceConsumer(pipelineCfg.Exporters)
|
||||
case configmodels.MetricsDataType:
|
||||
mc = pb.buildFanoutExportersMetricsConsumer(pipelineCfg.Exporters)
|
||||
case configmodels.LogsDataType:
|
||||
lc = pb.buildFanoutExportersLogConsumer(pipelineCfg.Exporters)
|
||||
}
|
||||
|
||||
mutatesConsumedData := false
|
||||
|
||||
processors := make([]component.Processor, len(pipelineCfg.Processors))
|
||||
|
||||
// Now build the processors backwards, starting from the last one.
|
||||
// The last processor points to consumer which fans out to exporters, then
|
||||
// the processor itself becomes a consumer for the one that precedes it in
|
||||
// in the pipeline and so on.
|
||||
for i := len(pipelineCfg.Processors) - 1; i >= 0; i-- {
|
||||
procName := pipelineCfg.Processors[i]
|
||||
procCfg := pb.config.Processors[procName]
|
||||
|
||||
factory := pb.factories[procCfg.Type()]
|
||||
|
||||
// This processor must point to the next consumer and then
|
||||
// it becomes the next for the previous one (previous in the pipeline,
|
||||
// which we will build in the next loop iteration).
|
||||
var err error
|
||||
componentLogger := pb.logger.With(zap.String(kindLogKey, kindLogProcessor), zap.String(typeLogKey, string(procCfg.Type())), zap.String(nameLogKey, procCfg.Name()))
|
||||
switch pipelineCfg.InputType {
|
||||
case configmodels.TracesDataType:
|
||||
var proc component.TraceProcessorBase
|
||||
proc, err = createTraceProcessor(factory, componentLogger, procCfg, tc)
|
||||
if proc != nil {
|
||||
mutatesConsumedData = mutatesConsumedData || proc.GetCapabilities().MutatesConsumedData
|
||||
}
|
||||
processors[i] = proc
|
||||
tc = proc
|
||||
case configmodels.MetricsDataType:
|
||||
var proc component.MetricsProcessorBase
|
||||
proc, err = createMetricsProcessor(factory, componentLogger, procCfg, mc)
|
||||
if proc != nil {
|
||||
mutatesConsumedData = mutatesConsumedData || proc.GetCapabilities().MutatesConsumedData
|
||||
}
|
||||
processors[i] = proc
|
||||
mc = proc
|
||||
|
||||
case configmodels.LogsDataType:
|
||||
var proc component.LogProcessor
|
||||
proc, err = createLogProcessor(factory, componentLogger, procCfg, lc)
|
||||
if proc != nil {
|
||||
mutatesConsumedData = mutatesConsumedData || proc.GetCapabilities().MutatesConsumedData
|
||||
}
|
||||
processors[i] = proc
|
||||
lc = proc
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("error creating processor %q in pipeline %q, data type %s is not supported",
|
||||
procName, pipelineCfg.Name, pipelineCfg.InputType)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating processor %q in pipeline %q: %v",
|
||||
procName, pipelineCfg.Name, err)
|
||||
}
|
||||
|
||||
// Check if the factory really created the processor.
|
||||
if tc == nil && mc == nil && lc == nil {
|
||||
return nil, fmt.Errorf("factory for %q produced a nil processor", procCfg.Name())
|
||||
}
|
||||
}
|
||||
|
||||
pipelineLogger := pb.logger.With(zap.String("pipeline_name", pipelineCfg.Name),
|
||||
zap.String("pipeline_datatype", string(pipelineCfg.InputType)))
|
||||
pipelineLogger.Info("Pipeline is enabled.")
|
||||
|
||||
bp := &builtPipeline{
|
||||
pipelineLogger,
|
||||
tc,
|
||||
mc,
|
||||
lc,
|
||||
mutatesConsumedData,
|
||||
processors,
|
||||
}
|
||||
|
||||
return bp, nil
|
||||
}
|
||||
|
||||
// Converts the list of exporter names to a list of corresponding builtExporters.
|
||||
func (pb *PipelinesBuilder) getBuiltExportersByNames(exporterNames []string) []*builtExporter {
|
||||
var result []*builtExporter
|
||||
for _, name := range exporterNames {
|
||||
exporter := pb.exporters[pb.config.Exporters[name]]
|
||||
result = append(result, exporter)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func (pb *PipelinesBuilder) buildFanoutExportersTraceConsumer(exporterNames []string) consumer.TraceConsumerBase {
|
||||
builtExporters := pb.getBuiltExportersByNames(exporterNames)
|
||||
|
||||
// Optimize for the case when there is only one exporter, no need to create junction point.
|
||||
if len(builtExporters) == 1 {
|
||||
return builtExporters[0].te
|
||||
}
|
||||
|
||||
var exporters []consumer.TraceConsumerBase
|
||||
for _, builtExp := range builtExporters {
|
||||
exporters = append(exporters, builtExp.te)
|
||||
}
|
||||
|
||||
// Create a junction point that fans out to all exporters.
|
||||
return processor.CreateTraceFanOutConnector(exporters)
|
||||
}
|
||||
|
||||
func (pb *PipelinesBuilder) buildFanoutExportersMetricsConsumer(exporterNames []string) consumer.MetricsConsumerBase {
|
||||
builtExporters := pb.getBuiltExportersByNames(exporterNames)
|
||||
|
||||
// Optimize for the case when there is only one exporter, no need to create junction point.
|
||||
if len(builtExporters) == 1 {
|
||||
return builtExporters[0].me
|
||||
}
|
||||
|
||||
var exporters []consumer.MetricsConsumerBase
|
||||
for _, builtExp := range builtExporters {
|
||||
exporters = append(exporters, builtExp.me)
|
||||
}
|
||||
|
||||
// Create a junction point that fans out to all exporters.
|
||||
return processor.CreateMetricsFanOutConnector(exporters)
|
||||
}
|
||||
|
||||
func (pb *PipelinesBuilder) buildFanoutExportersLogConsumer(
|
||||
exporterNames []string,
|
||||
) consumer.LogConsumer {
|
||||
builtExporters := pb.getBuiltExportersByNames(exporterNames)
|
||||
|
||||
// Optimize for the case when there is only one exporter, no need to create junction point.
|
||||
if len(builtExporters) == 1 {
|
||||
return builtExporters[0].le
|
||||
}
|
||||
|
||||
exporters := make([]consumer.LogConsumer, len(builtExporters))
|
||||
for _, builtExp := range builtExporters {
|
||||
exporters = append(exporters, builtExp.le)
|
||||
}
|
||||
|
||||
// Create a junction point that fans out to all exporters.
|
||||
return processor.NewLogFanOutConnector(exporters)
|
||||
}
|
||||
|
||||
// createTraceProcessor creates trace processor based on type of the current processor
|
||||
// and type of the downstream consumer.
|
||||
func createTraceProcessor(
|
||||
factoryBase component.ProcessorFactoryBase,
|
||||
logger *zap.Logger,
|
||||
cfg configmodels.Processor,
|
||||
nextConsumer consumer.TraceConsumerBase,
|
||||
) (component.TraceProcessorBase, error) {
|
||||
if factory, ok := factoryBase.(component.ProcessorFactory); ok {
|
||||
creationParams := component.ProcessorCreateParams{Logger: logger}
|
||||
ctx := context.Background()
|
||||
|
||||
// If both processor and consumer are of the new type (can manipulate on internal data structure),
|
||||
// use ProcessorFactory.CreateTraceProcessor.
|
||||
if nextConsumer, ok := nextConsumer.(consumer.TraceConsumer); ok {
|
||||
return factory.CreateTraceProcessor(ctx, creationParams, nextConsumer, cfg)
|
||||
}
|
||||
|
||||
// If processor is of the new type, but downstream consumer is of the old type,
|
||||
// use internalToOCTraceConverter compatibility shim.
|
||||
traceConverter := converter.NewInternalToOCTraceConverter(nextConsumer.(consumer.TraceConsumerOld))
|
||||
return factory.CreateTraceProcessor(ctx, creationParams, traceConverter, cfg)
|
||||
}
|
||||
|
||||
factoryOld := factoryBase.(component.ProcessorFactoryOld)
|
||||
|
||||
// If both processor and consumer are of the old type (can manipulate on OC traces only),
|
||||
// use ProcessorFactoryOld.CreateTraceProcessor.
|
||||
if nextConsumerOld, ok := nextConsumer.(consumer.TraceConsumerOld); ok {
|
||||
return factoryOld.CreateTraceProcessor(logger, nextConsumerOld, cfg)
|
||||
}
|
||||
|
||||
// If processor is of the old type, but downstream consumer is of the new type,
|
||||
// use NewInternalToOCTraceConverter compatibility shim to convert traces from internal format to OC.
|
||||
traceConverter := converter.NewOCToInternalTraceConverter(nextConsumer.(consumer.TraceConsumer))
|
||||
return factoryOld.CreateTraceProcessor(logger, traceConverter, cfg)
|
||||
}
|
||||
|
||||
// createMetricsProcessor creates metric processor based on type of the current processor
|
||||
// and type of the downstream consumer.
|
||||
func createMetricsProcessor(
|
||||
factoryBase component.ProcessorFactoryBase,
|
||||
logger *zap.Logger,
|
||||
cfg configmodels.Processor,
|
||||
nextConsumer consumer.MetricsConsumerBase,
|
||||
) (component.MetricsProcessorBase, error) {
|
||||
if factory, ok := factoryBase.(component.ProcessorFactory); ok {
|
||||
creationParams := component.ProcessorCreateParams{Logger: logger}
|
||||
ctx := context.Background()
|
||||
|
||||
// If both processor and consumer are of the new type (can manipulate on internal data structure),
|
||||
// use ProcessorFactory.CreateMetricsProcessor.
|
||||
if nextConsumer, ok := nextConsumer.(consumer.MetricsConsumer); ok {
|
||||
return factory.CreateMetricsProcessor(ctx, creationParams, nextConsumer, cfg)
|
||||
}
|
||||
|
||||
// If processor is of the new type, but downstream consumer is of the old type,
|
||||
// use internalToOCMetricsConverter compatibility shim.
|
||||
metricsConverter := converter.NewInternalToOCMetricsConverter(nextConsumer.(consumer.MetricsConsumerOld))
|
||||
return factory.CreateMetricsProcessor(ctx, creationParams, metricsConverter, cfg)
|
||||
}
|
||||
|
||||
factoryOld := factoryBase.(component.ProcessorFactoryOld)
|
||||
|
||||
// If both processor and consumer are of the old type (can manipulate on OC metrics only),
|
||||
// use ProcessorFactoryOld.CreateMetricsProcessor.
|
||||
if nextConsumerOld, ok := nextConsumer.(consumer.MetricsConsumerOld); ok {
|
||||
return factoryOld.CreateMetricsProcessor(logger, nextConsumerOld, cfg)
|
||||
}
|
||||
|
||||
// If processor is of the old type, but downstream consumer is of the new type,
|
||||
// use NewInternalToOCMetricsConverter compatibility shim to convert metrics from internal format to OC.
|
||||
metricsConverter := converter.NewOCToInternalMetricsConverter(nextConsumer.(consumer.MetricsConsumer))
|
||||
return factoryOld.CreateMetricsProcessor(logger, metricsConverter, cfg)
|
||||
}
|
||||
|
||||
// createLogProcessor creates a log processor using given factory and next consumer.
|
||||
func createLogProcessor(
|
||||
factoryBase component.ProcessorFactoryBase,
|
||||
logger *zap.Logger,
|
||||
cfg configmodels.Processor,
|
||||
nextConsumer consumer.LogConsumer,
|
||||
) (component.LogProcessor, error) {
|
||||
factory, ok := factoryBase.(component.LogProcessorFactory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("processor %q does support data type %q",
|
||||
cfg.Name(), configmodels.LogsDataType)
|
||||
}
|
||||
creationParams := component.ProcessorCreateParams{Logger: logger}
|
||||
ctx := context.Background()
|
||||
return factory.CreateLogProcessor(ctx, creationParams, cfg, nextConsumer)
|
||||
}
|
||||
-444
@@ -1,444 +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 builder
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenterror"
|
||||
"go.opentelemetry.io/collector/config/configerror"
|
||||
"go.opentelemetry.io/collector/config/configmodels"
|
||||
"go.opentelemetry.io/collector/consumer"
|
||||
"go.opentelemetry.io/collector/consumer/converter"
|
||||
"go.opentelemetry.io/collector/processor"
|
||||
)
|
||||
|
||||
var errUnusedReceiver = errors.New("receiver defined but not used by any pipeline")
|
||||
|
||||
// builtReceiver is a receiver that is built based on a config. It can have
|
||||
// a trace and/or a metrics component.
|
||||
type builtReceiver struct {
|
||||
logger *zap.Logger
|
||||
receiver component.Receiver
|
||||
}
|
||||
|
||||
// Start the receiver.
|
||||
func (rcv *builtReceiver) Start(ctx context.Context, host component.Host) error {
|
||||
return rcv.receiver.Start(ctx, host)
|
||||
}
|
||||
|
||||
// Stop the receiver.
|
||||
func (rcv *builtReceiver) Shutdown(ctx context.Context) error {
|
||||
return rcv.receiver.Shutdown(ctx)
|
||||
}
|
||||
|
||||
// Receivers is a map of receivers created from receiver configs.
|
||||
type Receivers map[configmodels.Receiver]*builtReceiver
|
||||
|
||||
// StopAll stops all receivers.
|
||||
func (rcvs Receivers) ShutdownAll(ctx context.Context) error {
|
||||
var errs []error
|
||||
for _, rcv := range rcvs {
|
||||
err := rcv.Shutdown(ctx)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(errs) != 0 {
|
||||
return componenterror.CombineErrors(errs)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StartAll starts all receivers.
|
||||
func (rcvs Receivers) StartAll(ctx context.Context, host component.Host) error {
|
||||
for _, rcv := range rcvs {
|
||||
rcv.logger.Info("Receiver is starting...")
|
||||
|
||||
if err := rcv.Start(ctx, host); err != nil {
|
||||
return err
|
||||
}
|
||||
rcv.logger.Info("Receiver started.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReceiversBuilder builds receivers from config.
|
||||
type ReceiversBuilder struct {
|
||||
logger *zap.Logger
|
||||
config *configmodels.Config
|
||||
builtPipelines BuiltPipelines
|
||||
factories map[configmodels.Type]component.ReceiverFactoryBase
|
||||
}
|
||||
|
||||
// NewReceiversBuilder creates a new ReceiversBuilder. Call BuildProcessors() on the returned value.
|
||||
func NewReceiversBuilder(
|
||||
logger *zap.Logger,
|
||||
config *configmodels.Config,
|
||||
builtPipelines BuiltPipelines,
|
||||
factories map[configmodels.Type]component.ReceiverFactoryBase,
|
||||
) *ReceiversBuilder {
|
||||
return &ReceiversBuilder{logger.With(zap.String(kindLogKey, kindLogReceiver)), config, builtPipelines, factories}
|
||||
}
|
||||
|
||||
// BuildProcessors receivers from config.
|
||||
func (rb *ReceiversBuilder) Build() (Receivers, error) {
|
||||
receivers := make(Receivers)
|
||||
|
||||
// BuildProcessors receivers based on configuration.
|
||||
for _, cfg := range rb.config.Receivers {
|
||||
logger := rb.logger.With(zap.String(typeLogKey, string(cfg.Type())), zap.String(nameLogKey, cfg.Name()))
|
||||
rcv, err := rb.buildReceiver(logger, cfg)
|
||||
if err != nil {
|
||||
if err == errUnusedReceiver {
|
||||
logger.Info("Ignoring receiver as it is not used by any pipeline", zap.String("receiver", cfg.Name()))
|
||||
continue
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
receivers[cfg] = rcv
|
||||
}
|
||||
|
||||
return receivers, nil
|
||||
}
|
||||
|
||||
// hasReceiver returns true if the pipeline is attached to specified receiver.
|
||||
func hasReceiver(pipeline *configmodels.Pipeline, receiverName string) bool {
|
||||
for _, name := range pipeline.Receivers {
|
||||
if name == receiverName {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type attachedPipelines map[configmodels.DataType][]*builtPipeline
|
||||
|
||||
func (rb *ReceiversBuilder) findPipelinesToAttach(config configmodels.Receiver) (attachedPipelines, error) {
|
||||
// A receiver may be attached to multiple pipelines. Pipelines may consume different
|
||||
// data types. We need to compile the list of pipelines of each type that must be
|
||||
// attached to this receiver according to configuration.
|
||||
|
||||
pipelinesToAttach := make(attachedPipelines)
|
||||
pipelinesToAttach[configmodels.TracesDataType] = make([]*builtPipeline, 0)
|
||||
pipelinesToAttach[configmodels.MetricsDataType] = make([]*builtPipeline, 0)
|
||||
|
||||
// Iterate over all pipelines.
|
||||
for _, pipelineCfg := range rb.config.Service.Pipelines {
|
||||
// Get the first processor of the pipeline.
|
||||
pipelineProcessor := rb.builtPipelines[pipelineCfg]
|
||||
if pipelineProcessor == nil {
|
||||
return nil, fmt.Errorf("cannot find pipeline processor for pipeline %s",
|
||||
pipelineCfg.Name)
|
||||
}
|
||||
|
||||
// Is this receiver attached to the pipeline?
|
||||
if hasReceiver(pipelineCfg, config.Name()) {
|
||||
if _, exists := pipelinesToAttach[pipelineCfg.InputType]; !exists {
|
||||
pipelinesToAttach[pipelineCfg.InputType] = make([]*builtPipeline, 0)
|
||||
}
|
||||
|
||||
// Yes, add it to the list of pipelines of corresponding data type.
|
||||
pipelinesToAttach[pipelineCfg.InputType] =
|
||||
append(pipelinesToAttach[pipelineCfg.InputType], pipelineProcessor)
|
||||
}
|
||||
}
|
||||
|
||||
return pipelinesToAttach, nil
|
||||
}
|
||||
|
||||
func (rb *ReceiversBuilder) attachReceiverToPipelines(
|
||||
logger *zap.Logger,
|
||||
factory component.ReceiverFactoryBase,
|
||||
dataType configmodels.DataType,
|
||||
config configmodels.Receiver,
|
||||
rcv *builtReceiver,
|
||||
builtPipelines []*builtPipeline,
|
||||
) error {
|
||||
// There are pipelines of the specified data type that must be attached to
|
||||
// the receiver. Create the receiver of corresponding data type and make
|
||||
// sure its output is fanned out to all attached pipelines.
|
||||
var err error
|
||||
var createdReceiver component.Receiver
|
||||
|
||||
switch dataType {
|
||||
case configmodels.TracesDataType:
|
||||
// First, create the fan out junction point.
|
||||
junction := buildFanoutTraceConsumer(builtPipelines)
|
||||
|
||||
// Now create the receiver and tell it to send to the junction point.
|
||||
createdReceiver, err = createTraceReceiver(context.Background(), factory, logger, config, junction)
|
||||
|
||||
case configmodels.MetricsDataType:
|
||||
junction := buildFanoutMetricConsumer(builtPipelines)
|
||||
createdReceiver, err = createMetricsReceiver(context.Background(), factory, logger, config, junction)
|
||||
|
||||
case configmodels.LogsDataType:
|
||||
junction := buildFanoutLogConsumer(builtPipelines)
|
||||
createdReceiver, err = createLogReceiver(context.Background(), factory, logger, config, junction)
|
||||
|
||||
default:
|
||||
err = configerror.ErrDataTypeIsNotSupported
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if err == configerror.ErrDataTypeIsNotSupported {
|
||||
return fmt.Errorf(
|
||||
"receiver %s does not support %s but it was used in a "+
|
||||
"%s pipeline",
|
||||
config.Name(),
|
||||
dataType,
|
||||
dataType)
|
||||
}
|
||||
return fmt.Errorf("cannot create receiver %s: %s", config.Name(), err.Error())
|
||||
}
|
||||
|
||||
// Check if the factory really created the receiver.
|
||||
if createdReceiver == nil {
|
||||
return fmt.Errorf("factory for %q produced a nil receiver", config.Name())
|
||||
}
|
||||
|
||||
if rcv.receiver != nil {
|
||||
// The receiver was previously created for this config. This can happen if the
|
||||
// same receiver type supports more than one data type. In that case we expect
|
||||
// that CreateTraceReceiver and CreateMetricsReceiver return the same value.
|
||||
if rcv.receiver != createdReceiver {
|
||||
return fmt.Errorf(
|
||||
"factory for %q is implemented incorrectly: "+
|
||||
"CreateTraceReceiver and CreateMetricsReceiver must return the same "+
|
||||
"receiver pointer when creating receivers of different data types",
|
||||
config.Name(),
|
||||
)
|
||||
}
|
||||
}
|
||||
rcv.receiver = createdReceiver
|
||||
|
||||
logger.Info("Receiver is enabled.", zap.String("datatype", string(dataType)))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rb *ReceiversBuilder) buildReceiver(logger *zap.Logger, config configmodels.Receiver) (*builtReceiver, error) {
|
||||
|
||||
// First find pipelines that must be attached to this receiver.
|
||||
pipelinesToAttach, err := rb.findPipelinesToAttach(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Prepare to build the receiver.
|
||||
factory := rb.factories[config.Type()]
|
||||
if factory == nil {
|
||||
return nil, fmt.Errorf("receiver factory not found for type: %s", config.Type())
|
||||
}
|
||||
rcv := &builtReceiver{
|
||||
logger: logger,
|
||||
}
|
||||
|
||||
// Now we have list of pipelines broken down by data type. Iterate for each data type.
|
||||
for dataType, pipelines := range pipelinesToAttach {
|
||||
if len(pipelines) == 0 {
|
||||
// No pipelines of this data type are attached to this receiver.
|
||||
continue
|
||||
}
|
||||
|
||||
// Attach the corresponding part of the receiver to all pipelines that require
|
||||
// this data type.
|
||||
err := rb.attachReceiverToPipelines(logger, factory, dataType, config, rcv, pipelines)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if rcv.receiver == nil {
|
||||
return nil, errUnusedReceiver
|
||||
}
|
||||
|
||||
return rcv, nil
|
||||
}
|
||||
|
||||
func buildFanoutTraceConsumer(pipelines []*builtPipeline) consumer.TraceConsumerBase {
|
||||
// Optimize for the case when there is only one processor, no need to create junction point.
|
||||
if len(pipelines) == 1 {
|
||||
return pipelines[0].firstTC
|
||||
}
|
||||
|
||||
var pipelineConsumers []consumer.TraceConsumerBase
|
||||
anyPipelineMutatesData := false
|
||||
for _, pipeline := range pipelines {
|
||||
pipelineConsumers = append(pipelineConsumers, pipeline.firstTC)
|
||||
anyPipelineMutatesData = anyPipelineMutatesData || pipeline.MutatesConsumedData
|
||||
}
|
||||
|
||||
// Create a junction point that fans out to all pipelines.
|
||||
if anyPipelineMutatesData {
|
||||
// If any pipeline mutates data use a cloning fan out connector
|
||||
// so that it is safe to modify fanned out data.
|
||||
// TODO: if there are more than 2 pipelines only clone data for pipelines that
|
||||
// declare the intent to mutate the data. Pipelines that do not mutate the data
|
||||
// can consume shared data.
|
||||
return processor.CreateTraceCloningFanOutConnector(pipelineConsumers)
|
||||
}
|
||||
return processor.CreateTraceFanOutConnector(pipelineConsumers)
|
||||
}
|
||||
|
||||
func buildFanoutMetricConsumer(pipelines []*builtPipeline) consumer.MetricsConsumerBase {
|
||||
// Optimize for the case when there is only one processor, no need to create junction point.
|
||||
if len(pipelines) == 1 {
|
||||
return pipelines[0].firstMC
|
||||
}
|
||||
|
||||
var pipelineConsumers []consumer.MetricsConsumerBase
|
||||
anyPipelineMutatesData := false
|
||||
for _, pipeline := range pipelines {
|
||||
pipelineConsumers = append(pipelineConsumers, pipeline.firstMC)
|
||||
anyPipelineMutatesData = anyPipelineMutatesData || pipeline.MutatesConsumedData
|
||||
}
|
||||
|
||||
// Create a junction point that fans out to all pipelines.
|
||||
if anyPipelineMutatesData {
|
||||
// If any pipeline mutates data use a cloning fan out connector
|
||||
// so that it is safe to modify fanned out data.
|
||||
// TODO: if there are more than 2 pipelines only clone data for pipelines that
|
||||
// declare the intent to mutate the data. Pipelines that do not mutate the data
|
||||
// can consume shared data.
|
||||
return processor.CreateMetricsCloningFanOutConnector(pipelineConsumers)
|
||||
}
|
||||
return processor.CreateMetricsFanOutConnector(pipelineConsumers)
|
||||
}
|
||||
|
||||
func buildFanoutLogConsumer(pipelines []*builtPipeline) consumer.LogConsumer {
|
||||
// Optimize for the case when there is only one processor, no need to create junction point.
|
||||
if len(pipelines) == 1 {
|
||||
return pipelines[0].firstLC
|
||||
}
|
||||
|
||||
var pipelineConsumers []consumer.LogConsumer
|
||||
anyPipelineMutatesData := false
|
||||
for _, pipeline := range pipelines {
|
||||
pipelineConsumers = append(pipelineConsumers, pipeline.firstLC)
|
||||
anyPipelineMutatesData = anyPipelineMutatesData || pipeline.MutatesConsumedData
|
||||
}
|
||||
|
||||
// Create a junction point that fans out to all pipelines.
|
||||
if anyPipelineMutatesData {
|
||||
// If any pipeline mutates data use a cloning fan out connector
|
||||
// so that it is safe to modify fanned out data.
|
||||
// TODO: if there are more than 2 pipelines only clone data for pipelines that
|
||||
// declare the intent to mutate the data. Pipelines that do not mutate the data
|
||||
// can consume shared data.
|
||||
return processor.NewLogCloningFanOutConnector(pipelineConsumers)
|
||||
}
|
||||
return processor.NewLogFanOutConnector(pipelineConsumers)
|
||||
}
|
||||
|
||||
// createTraceReceiver is a helper function that creates trace receiver based on the current receiver type
|
||||
// and type of the next consumer.
|
||||
func createTraceReceiver(
|
||||
ctx context.Context,
|
||||
factoryBase component.ReceiverFactoryBase,
|
||||
logger *zap.Logger,
|
||||
cfg configmodels.Receiver,
|
||||
nextConsumer consumer.TraceConsumerBase,
|
||||
) (component.TraceReceiver, error) {
|
||||
if factory, ok := factoryBase.(component.ReceiverFactory); ok {
|
||||
creationParams := component.ReceiverCreateParams{Logger: logger}
|
||||
|
||||
// If both receiver and consumer are of the new type (can manipulate on internal data structure),
|
||||
// use ProcessorFactory.CreateTraceReceiver.
|
||||
if nextConsumer, ok := nextConsumer.(consumer.TraceConsumer); ok {
|
||||
return factory.CreateTraceReceiver(ctx, creationParams, cfg, nextConsumer)
|
||||
}
|
||||
|
||||
// If receiver is of the new type, but downstream consumer is of the old type,
|
||||
// use internalToOCTraceConverter compatibility shim.
|
||||
traceConverter := converter.NewInternalToOCTraceConverter(nextConsumer.(consumer.TraceConsumerOld))
|
||||
return factory.CreateTraceReceiver(ctx, creationParams, cfg, traceConverter)
|
||||
}
|
||||
|
||||
factoryOld := factoryBase.(component.ReceiverFactoryOld)
|
||||
|
||||
// If both receiver and consumer are of the old type (can manipulate on OC traces only),
|
||||
// use Factory.CreateTraceReceiver.
|
||||
if nextConsumer, ok := nextConsumer.(consumer.TraceConsumerOld); ok {
|
||||
return factoryOld.CreateTraceReceiver(ctx, logger, cfg, nextConsumer)
|
||||
}
|
||||
|
||||
// If receiver is of the old type, but downstream consumer is of the new type,
|
||||
// use NewInternalToOCTraceConverter compatibility shim to convert traces from internal format to OC.
|
||||
traceConverter := converter.NewOCToInternalTraceConverter(nextConsumer.(consumer.TraceConsumer))
|
||||
return factoryOld.CreateTraceReceiver(ctx, logger, cfg, traceConverter)
|
||||
}
|
||||
|
||||
// createMetricsReceiver is a helper function that creates metric receiver based
|
||||
// on the current receiver type and type of the next consumer.
|
||||
func createMetricsReceiver(
|
||||
ctx context.Context,
|
||||
factoryBase component.ReceiverFactoryBase,
|
||||
logger *zap.Logger,
|
||||
cfg configmodels.Receiver,
|
||||
nextConsumer consumer.MetricsConsumerBase,
|
||||
) (component.MetricsReceiver, error) {
|
||||
if factory, ok := factoryBase.(component.ReceiverFactory); ok {
|
||||
creationParams := component.ReceiverCreateParams{Logger: logger}
|
||||
|
||||
// If both receiver and consumer are of the new type (can manipulate on internal data structure),
|
||||
// use ProcessorFactory.CreateMetricsReceiver.
|
||||
if nextConsumer, ok := nextConsumer.(consumer.MetricsConsumer); ok {
|
||||
return factory.CreateMetricsReceiver(ctx, creationParams, cfg, nextConsumer)
|
||||
}
|
||||
|
||||
// If receiver is of the new type, but downstream consumer is of the old type,
|
||||
// use internalToOCMetricsConverter compatibility shim.
|
||||
metricsConverter := converter.NewInternalToOCMetricsConverter(nextConsumer.(consumer.MetricsConsumerOld))
|
||||
return factory.CreateMetricsReceiver(ctx, creationParams, cfg, metricsConverter)
|
||||
}
|
||||
|
||||
factoryOld := factoryBase.(component.ReceiverFactoryOld)
|
||||
|
||||
// If both receiver and consumer are of the old type (can manipulate on OC metrics only),
|
||||
// use Factory.CreateMetricsReceiver.
|
||||
if nextConsumer, ok := nextConsumer.(consumer.MetricsConsumerOld); ok {
|
||||
return factoryOld.CreateMetricsReceiver(context.Background(), logger, cfg, nextConsumer)
|
||||
}
|
||||
|
||||
// If receiver is of the old type, but downstream consumer is of the new type,
|
||||
// use NewInternalToOCMetricsConverter compatibility shim to convert metrics from internal format to OC.
|
||||
metricsConverter := converter.NewOCToInternalMetricsConverter(nextConsumer.(consumer.MetricsConsumer))
|
||||
return factoryOld.CreateMetricsReceiver(context.Background(), logger, cfg, metricsConverter)
|
||||
}
|
||||
|
||||
// createLogReceiver creates a log receiver using given factory and next consumer.
|
||||
func createLogReceiver(
|
||||
ctx context.Context,
|
||||
factoryBase component.ReceiverFactoryBase,
|
||||
logger *zap.Logger,
|
||||
cfg configmodels.Receiver,
|
||||
nextConsumer consumer.LogConsumer,
|
||||
) (component.LogReceiver, error) {
|
||||
factory, ok := factoryBase.(component.LogReceiverFactory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("receiver %q does support data type %q",
|
||||
cfg.Name(), configmodels.LogsDataType)
|
||||
}
|
||||
creationParams := component.ReceiverCreateParams{Logger: logger}
|
||||
return factory.CreateLogReceiver(ctx, creationParams, cfg, nextConsumer)
|
||||
}
|
||||
Generated
Vendored
+1
-1
@@ -25,7 +25,7 @@ import (
|
||||
"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
|
||||
|
||||
"go.opentelemetry.io/collector/consumer/pdata"
|
||||
otlptrace "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/trace/v1"
|
||||
otlptrace "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1"
|
||||
"go.opentelemetry.io/collector/translator/conventions"
|
||||
tracetranslator "go.opentelemetry.io/collector/translator/trace"
|
||||
)
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
"go.opentelemetry.io/collector/consumer/pdata"
|
||||
"go.opentelemetry.io/collector/internal"
|
||||
otlptrace "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/trace/v1"
|
||||
otlptrace "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1"
|
||||
"go.opentelemetry.io/collector/translator/conventions"
|
||||
tracetranslator "go.opentelemetry.io/collector/translator/trace"
|
||||
)
|
||||
|
||||
Vendored
-6
@@ -95,7 +95,6 @@ github.com/bombsimon/wsl/v3
|
||||
# github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b
|
||||
github.com/bradfitz/gomemcache/memcache
|
||||
# github.com/census-instrumentation/opencensus-proto v0.2.1
|
||||
## explicit
|
||||
github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1
|
||||
github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1
|
||||
github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1
|
||||
@@ -885,7 +884,6 @@ go.opentelemetry.io/collector/consumer/converter
|
||||
go.opentelemetry.io/collector/consumer/pdata
|
||||
go.opentelemetry.io/collector/consumer/pdatautil
|
||||
go.opentelemetry.io/collector/internal
|
||||
go.opentelemetry.io/collector/internal/collector/telemetry
|
||||
go.opentelemetry.io/collector/internal/data
|
||||
go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/collector/metrics/v1
|
||||
go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/collector/trace/v1
|
||||
@@ -894,9 +892,7 @@ go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/logs/v1
|
||||
go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/metrics/v1
|
||||
go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/resource/v1
|
||||
go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/trace/v1
|
||||
go.opentelemetry.io/collector/internal/version
|
||||
go.opentelemetry.io/collector/obsreport
|
||||
go.opentelemetry.io/collector/processor
|
||||
go.opentelemetry.io/collector/receiver/jaegerreceiver
|
||||
go.opentelemetry.io/collector/receiver/opencensusreceiver
|
||||
go.opentelemetry.io/collector/receiver/opencensusreceiver/ocmetrics
|
||||
@@ -906,7 +902,6 @@ go.opentelemetry.io/collector/receiver/otlpreceiver/metrics
|
||||
go.opentelemetry.io/collector/receiver/otlpreceiver/trace
|
||||
go.opentelemetry.io/collector/receiver/receiverhelper
|
||||
go.opentelemetry.io/collector/receiver/zipkinreceiver
|
||||
go.opentelemetry.io/collector/service/builder
|
||||
go.opentelemetry.io/collector/translator/conventions
|
||||
go.opentelemetry.io/collector/translator/internaldata
|
||||
go.opentelemetry.io/collector/translator/trace
|
||||
@@ -945,7 +940,6 @@ golang.org/x/mod/modfile
|
||||
golang.org/x/mod/module
|
||||
golang.org/x/mod/semver
|
||||
# golang.org/x/net v0.0.0-20200625001655-4c5254603344
|
||||
## explicit
|
||||
golang.org/x/net/bpf
|
||||
golang.org/x/net/context
|
||||
golang.org/x/net/context/ctxhttp
|
||||
|
||||
Reference in New Issue
Block a user