Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into mx-psi/enable-compone…
Browse files Browse the repository at this point in the history
…nt-localhost-fgh
  • Loading branch information
mx-psi committed Jun 24, 2024
2 parents 8b7dfe5 + 227fb82 commit 7f86347
Show file tree
Hide file tree
Showing 67 changed files with 782 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ change_type: enhancement
component: exporter/debug

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: In `normal` verbosity, display one line of text for each log record
note: In `normal` verbosity, display one line of text for each telemetry record (log, data point, span)

# One or more tracking issues or pull requests related to the change
issues: [7806]
Expand Down
25 changes: 25 additions & 0 deletions .chloggen/pprofile-wrapper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: pdata/pprofile

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add pprofile wrapper to convert proto into pprofile.

# One or more tracking issues or pull requests related to the change
issues: [10401]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/profile-testdata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: pdata/testdata

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add pdata testdata for profiles.

# One or more tracking issues or pull requests related to the change
issues: [10401]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ check-contrib:
-replace go.opentelemetry.io/collector/otelcol/otelcoltest=$(CURDIR)/otelcol/otelcoltest \
-replace go.opentelemetry.io/collector/pdata=$(CURDIR)/pdata \
-replace go.opentelemetry.io/collector/pdata/testdata=$(CURDIR)/pdata/testdata \
-replace go.opentelemetry.io/collector/pdata/pprofile=$(CURDIR)/pdata/pprofile \
-replace go.opentelemetry.io/collector/processor=$(CURDIR)/processor \
-replace go.opentelemetry.io/collector/processor/batchprocessor=$(CURDIR)/processor/batchprocessor \
-replace go.opentelemetry.io/collector/processor/memorylimiterprocessor=$(CURDIR)/processor/memorylimiterprocessor \
Expand Down Expand Up @@ -341,6 +342,7 @@ restore-contrib:
-dropreplace go.opentelemetry.io/collector/otelcol/otelcoltest \
-dropreplace go.opentelemetry.io/collector/pdata \
-dropreplace go.opentelemetry.io/collector/pdata/testdata \
-dropreplace go.opentelemetry.io/collector/pdata/pprofile \
-dropreplace go.opentelemetry.io/collector/processor \
-dropreplace go.opentelemetry.io/collector/processor/batchprocessor \
-dropreplace go.opentelemetry.io/collector/processor/memorylimiterprocessor \
Expand Down
1 change: 1 addition & 0 deletions cmd/builder/internal/builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ var (
"/otelcol",
"/pdata",
"/pdata/testdata",
"/pdata/pprofile",
"/semconv",
"/service",
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/mdatagen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ retract (
v0.76.1
v0.65.0
)

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
1 change: 1 addition & 0 deletions cmd/mdatagen/statusdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
var distros = map[string]string{
"core": "https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol",
"contrib": "https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib",
"k8s": "https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-k8s",
}

type Codeowners struct {
Expand Down
5 changes: 3 additions & 2 deletions cmd/otelcorecol/builder-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# NOTE:
# This builder configuration is NOT used to build any official binary.
# To see the builder manifests used for official binaries,
# To see the builder manifests used for official binaries,
# check https://github.com/open-telemetry/opentelemetry-collector-releases
#
#
# For the OpenTelemetry Collector Core official distribution sources, check
# https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol

Expand Down Expand Up @@ -77,6 +77,7 @@ replaces:
- go.opentelemetry.io/collector/featuregate => ../../featuregate
- go.opentelemetry.io/collector/pdata => ../../pdata
- go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
- go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
- go.opentelemetry.io/collector/processor => ../../processor
- go.opentelemetry.io/collector/receiver => ../../receiver
- go.opentelemetry.io/collector/receiver/nopreceiver => ../../receiver/nopreceiver
Expand Down
2 changes: 2 additions & 0 deletions cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/processor => ../../processor

replace go.opentelemetry.io/collector/receiver => ../../receiver
Expand Down
4 changes: 4 additions & 0 deletions config/configgrpc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ require (
github.com/prometheus/procfs v0.15.0 // indirect
go.opentelemetry.io/collector/confmap v0.103.0 // indirect
go.opentelemetry.io/collector/extension v0.103.0 // indirect
go.opentelemetry.io/collector/featuregate v1.10.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect
go.opentelemetry.io/otel/metric v1.27.0 // indirect
go.opentelemetry.io/otel/sdk v1.27.0 // indirect
Expand Down Expand Up @@ -94,6 +96,8 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/component => ../../component

replace go.opentelemetry.io/collector/consumer => ../../consumer
2 changes: 2 additions & 0 deletions config/confighttp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ replace go.opentelemetry.io/collector/component => ../../component
replace go.opentelemetry.io/collector/consumer => ../../consumer

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
2 changes: 2 additions & 0 deletions config/internal/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer
replace go.opentelemetry.io/collector/component => ../../component

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
2 changes: 2 additions & 0 deletions confmap/converter/expandconverter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ replace go.opentelemetry.io/collector/pdata => ../../../pdata
replace go.opentelemetry.io/collector/featuregate => ../../../featuregate

replace go.opentelemetry.io/collector/consumer => ../../../consumer

replace go.opentelemetry.io/collector/pdata/pprofile => ../../../pdata/pprofile
3 changes: 2 additions & 1 deletion connector/forwardconnector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
<!-- status autogenerated section -->
| Status | |
| ------------- |-----------|
| Distributions | [core], [contrib] |
| Distributions | [core], [contrib], [k8s] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aconnector%2Fforward%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aconnector%2Fforward) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aconnector%2Fforward%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aconnector%2Fforward) |

[beta]: https://github.com/open-telemetry/opentelemetry-collector#beta
[core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
[k8s]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-k8s

## Supported Pipeline Types

Expand Down
2 changes: 2 additions & 0 deletions connector/forwardconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ retract (
)

replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
2 changes: 1 addition & 1 deletion connector/forwardconnector/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ status:
class: connector
stability:
beta: [traces_to_traces, metrics_to_metrics, logs_to_logs]
distributions: [core, contrib]
distributions: [core, contrib, k8s]
3 changes: 3 additions & 0 deletions connector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ require (
github.com/prometheus/common v0.54.0 // indirect
github.com/prometheus/procfs v0.15.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.103.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/otel v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect
go.opentelemetry.io/otel/metric v1.27.0 // indirect
Expand Down Expand Up @@ -61,3 +62,5 @@ replace go.opentelemetry.io/collector/featuregate => ../featuregate
replace go.opentelemetry.io/collector/pdata => ../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile
4 changes: 3 additions & 1 deletion consumer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
Expand All @@ -31,6 +31,8 @@ replace go.opentelemetry.io/collector/pdata => ../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile

retract (
v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module, use v0.76.1
v0.69.0 // Release failed, use v0.69.1
Expand Down
1 change: 0 additions & 1 deletion consumer/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions exporter/debugexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
| Status | |
| ------------- |-----------|
| Stability | [development]: traces, metrics, logs |
| Distributions | [core], [contrib] |
| Distributions | [core], [contrib], [k8s] |
| Warnings | [Unstable Output Format](#warnings) |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fdebug%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fdebug) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fdebug%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fdebug) |

[development]: https://github.com/open-telemetry/opentelemetry-collector#development
[core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
[k8s]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-k8s
<!-- end autogenerated section -->

Exports data to the console (stderr) via `zap.Logger`.
Expand Down Expand Up @@ -62,21 +63,17 @@ Here's an example output:

### Normal verbosity

With `verbosity: normal`, the exporter outputs about one line for each telemetry record, including its body and attributes.
With `verbosity: normal`, the exporter outputs about one line for each telemetry record.
The "one line per telemetry record" is not a strict rule.
For example, logs with multiline body will be output as multiple lines.

> [!IMPORTANT]
> Currently the `normal` verbosity is only implemented for logs.
> Metrics and traces are going to be implemented in the future.
> The current behavior for metrics and traces is the same as in `basic` verbosity.

Here's an example output:

```console
2024-05-27T12:46:22.423+0200 info LogsExporter {"kind": "exporter", "data_type": "logs", "name": "debug", "resource logs": 1, "log records": 1}
2024-05-27T12:46:22.423+0200 info the message app=server
{"kind": "exporter", "data_type": "logs", "name": "debug"}
2024-06-24T15:18:58.559+0200 info TracesExporter {"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 2}
2024-06-24T15:18:58.559+0200 info okey-dokey-0 4bdc558f0f0650e3ccaac8f3ae133954 8b69459f015c164b net.peer.ip=1.2.3.4 peer.service=telemetrygen-client
lets-go 4bdc558f0f0650e3ccaac8f3ae133954 8820ee5366817639 net.peer.ip=1.2.3.4 peer.service=telemetrygen-server
{"kind": "exporter", "data_type": "traces", "name": "debug"}
```

### Detailed verbosity
Expand Down Expand Up @@ -126,3 +123,5 @@ Attributes:
## Warnings

- Unstable Output Format: The output formats for all verbosity levels is not guaranteed and may be changed at any time without a breaking change.

[telemetrygen]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/cmd/telemetrygen
14 changes: 10 additions & 4 deletions exporter/debugexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,31 @@ type debugExporter struct {

func newDebugExporter(logger *zap.Logger, verbosity configtelemetry.Level) *debugExporter {
var logsMarshaler plog.Marshaler
var metricsMarshaler pmetric.Marshaler
var tracesMarshaler ptrace.Marshaler
if verbosity == configtelemetry.LevelDetailed {
logsMarshaler = otlptext.NewTextLogsMarshaler()
metricsMarshaler = otlptext.NewTextMetricsMarshaler()
tracesMarshaler = otlptext.NewTextTracesMarshaler()
} else {
logsMarshaler = normal.NewNormalLogsMarshaler()
metricsMarshaler = normal.NewNormalMetricsMarshaler()
tracesMarshaler = normal.NewNormalTracesMarshaler()
}
return &debugExporter{
verbosity: verbosity,
logger: logger,
logsMarshaler: logsMarshaler,
metricsMarshaler: otlptext.NewTextMetricsMarshaler(),
tracesMarshaler: otlptext.NewTextTracesMarshaler(),
metricsMarshaler: metricsMarshaler,
tracesMarshaler: tracesMarshaler,
}
}

func (s *debugExporter) pushTraces(_ context.Context, td ptrace.Traces) error {
s.logger.Info("TracesExporter",
zap.Int("resource spans", td.ResourceSpans().Len()),
zap.Int("spans", td.SpanCount()))
if s.verbosity != configtelemetry.LevelDetailed {
if s.verbosity == configtelemetry.LevelBasic {
return nil
}

Expand All @@ -65,7 +71,7 @@ func (s *debugExporter) pushMetrics(_ context.Context, md pmetric.Metrics) error
zap.Int("resource metrics", md.ResourceMetrics().Len()),
zap.Int("metrics", md.MetricCount()),
zap.Int("data points", md.DataPointCount()))
if s.verbosity != configtelemetry.LevelDetailed {
if s.verbosity == configtelemetry.LevelBasic {
return nil
}

Expand Down
3 changes: 3 additions & 0 deletions exporter/debugexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ require (
go.opentelemetry.io/collector/config/configretry v0.103.0 // indirect
go.opentelemetry.io/collector/extension v0.103.0 // indirect
go.opentelemetry.io/collector/featuregate v1.10.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/collector/receiver v0.103.0 // indirect
go.opentelemetry.io/otel v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect
Expand Down Expand Up @@ -76,6 +77,8 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/receiver => ../../receiver

replace go.opentelemetry.io/collector/extension => ../../extension
Expand Down
20 changes: 20 additions & 0 deletions exporter/debugexporter/internal/normal/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package normal // import "go.opentelemetry.io/collector/exporter/debugexporter/internal/normal"

import (
"fmt"

"go.opentelemetry.io/collector/pdata/pcommon"
)

// writeAttributes returns a slice of strings in the form "attrKey=attrValue"
func writeAttributes(attributes pcommon.Map) (attributeStrings []string) {
attributes.Range(func(k string, v pcommon.Value) bool {
attribute := fmt.Sprintf("%s=%s", k, v.AsString())
attributeStrings = append(attributeStrings, attribute)
return true
})
return attributeStrings
}
11 changes: 0 additions & 11 deletions exporter/debugexporter/internal/normal/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"fmt"
"strings"

"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/plog"
)

Expand Down Expand Up @@ -40,13 +39,3 @@ func (normalLogsMarshaler) MarshalLogs(ld plog.Logs) ([]byte, error) {
}
return buffer.Bytes(), nil
}

// writeAttributes returns a slice of strings in the form "attrKey=attrValue"
func writeAttributes(attributes pcommon.Map) (attributeStrings []string) {
attributes.Range(func(k string, v pcommon.Value) bool {
attribute := fmt.Sprintf("%s=%s", k, v.AsString())
attributeStrings = append(attributeStrings, attribute)
return true
})
return attributeStrings
}
Loading

0 comments on commit 7f86347

Please sign in to comment.