Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add debug exporter #8375

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .chloggen/debug-exporter-2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add debug exporter, which replaces the logging exporter

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

# (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:
16 changes: 16 additions & 0 deletions .chloggen/debug-exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: deprecation

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Mark the logging exporter as deprecated, in favour of debug exporter

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

# (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:
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ updates:
schedule:
interval: "weekly"
day: "wednesday"
- package-ecosystem: "gomod"
directory: "/exporter/debugexporter"
schedule:
interval: "weekly"
day: "wednesday"
- package-ecosystem: "gomod"
directory: "/exporter/loggingexporter"
schedule:
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ check-contrib:
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -replace go.opentelemetry.io/collector/connector/forwardconnector=$(CURDIR)/connector/forwardconnector"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -replace go.opentelemetry.io/collector/consumer=$(CURDIR)/consumer"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -replace go.opentelemetry.io/collector/exporter=$(CURDIR)/exporter"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -replace go.opentelemetry.io/collector/exporter/debugexporter=$(CURDIR)/exporter/debugexporter"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -replace go.opentelemetry.io/collector/exporter/loggingexporter=$(CURDIR)/exporter/loggingexporter"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -replace go.opentelemetry.io/collector/exporter/otlpexporter=$(CURDIR)/exporter/otlpexporter"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -replace go.opentelemetry.io/collector/exporter/otlphttpexporter=$(CURDIR)/exporter/otlphttpexporter"
Expand Down Expand Up @@ -346,6 +347,7 @@ restore-contrib:
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -dropreplace go.opentelemetry.io/collector/connector/forwardconnector"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -dropreplace go.opentelemetry.io/collector/consumer"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -dropreplace go.opentelemetry.io/collector/exporter"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -dropreplace go.opentelemetry.io/collector/exporter/debugexporter"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -dropreplace go.opentelemetry.io/collector/exporter/loggingexporter"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -dropreplace go.opentelemetry.io/collector/exporter/otlpexporter"
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -dropreplace go.opentelemetry.io/collector/exporter/otlphttpexporter"
Expand Down
4 changes: 2 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@
// authprinter:
// attribute: subject
// exporters:
// logging:
// debug:
// service:
// extensions: [oidc]
// pipelines:
// traces:
// receivers: [otlp]
// processors: [authprinter]
// exporters: [logging]
// exporters: [debug]
package client // import "go.opentelemetry.io/collector/client"

import (
Expand Down
6 changes: 3 additions & 3 deletions cmd/builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dist:
output_path: /tmp/dist
exporters:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alibabacloudlogserviceexporter v0.69.0
- gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.69.1
- gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.69.1

receivers:
- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.69.1
Expand All @@ -34,7 +34,7 @@ processors:
batch:

exporters:
logging:
debug:

service:
pipelines:
Expand All @@ -44,7 +44,7 @@ service:
processors:
- batch
exporters:
- logging
- debug
EOF
$ /tmp/dist/otelcol-custom --config=/tmp/otelcol.yaml
```
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 @@ -67,6 +67,7 @@ func TestGenerateAndCompile(t *testing.T) {
fmt.Sprintf("go.opentelemetry.io/collector/consumer => %s/consumer", workspaceDir),
fmt.Sprintf("go.opentelemetry.io/collector/connector => %s/connector", workspaceDir),
fmt.Sprintf("go.opentelemetry.io/collector/exporter => %s/exporter", workspaceDir),
fmt.Sprintf("go.opentelemetry.io/collector/exporter/debugexporter => %s/exporter/debugexporter", workspaceDir),
fmt.Sprintf("go.opentelemetry.io/collector/exporter/loggingexporter => %s/exporter/loggingexporter", workspaceDir),
fmt.Sprintf("go.opentelemetry.io/collector/exporter/otlpexporter => %s/exporter/otlpexporter", workspaceDir),
fmt.Sprintf("go.opentelemetry.io/collector/exporter/otlphttpexporter => %s/exporter/otlphttpexporter", workspaceDir),
Expand Down
1 change: 1 addition & 0 deletions cmd/builder/internal/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dist:
receivers:
- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.84.0
exporters:
- gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.84.0
- gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.84.0
- gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.84.0
- gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.84.0
Expand Down
2 changes: 2 additions & 0 deletions cmd/builder/test/core.builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ receivers:
path: ${WORKSPACE_DIR}

exporters:
- gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.84.0
- import: go.opentelemetry.io/collector/exporter/loggingexporter
gomod: go.opentelemetry.io/collector v0.84.0
path: ${WORKSPACE_DIR}
Expand All @@ -33,6 +34,7 @@ replaces:
- go.opentelemetry.io/collector/consumer => ${WORKSPACE_DIR}/consumer
- go.opentelemetry.io/collector/connector => ${WORKSPACE_DIR}/connector
- go.opentelemetry.io/collector/exporter => ${WORKSPACE_DIR}/exporter
- go.opentelemetry.io/collector/exporter/debugexporter => ${WORKSPACE_DIR}/exporter/debugexporter
- go.opentelemetry.io/collector/exporter/loggingexporter => ${WORKSPACE_DIR}/exporter/loggingexporter
- go.opentelemetry.io/collector/extension => ${WORKSPACE_DIR}/extension
- go.opentelemetry.io/collector/extension/auth => ${WORKSPACE_DIR}/extension/auth
Expand Down
4 changes: 2 additions & 2 deletions cmd/builder/test/core.otel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ receivers:
processors:

exporters:
logging:
debug:

service:
extensions: [zpages]
Expand All @@ -19,4 +19,4 @@ service:
- otlp
processors: []
exporters:
- logging
- debug
4 changes: 2 additions & 2 deletions cmd/builder/test/default.otel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ receivers:
processors:

exporters:
logging:
debug:

service:
extensions: [zpages]
Expand All @@ -19,4 +19,4 @@ service:
- otlp
processors: []
exporters:
- logging
- debug
2 changes: 2 additions & 0 deletions cmd/otelcorecol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dist:
receivers:
- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.84.0
exporters:
- gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.84.0
- gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.84.0
- gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.84.0
- gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.84.0
Expand Down Expand Up @@ -37,6 +38,7 @@ replaces:
- go.opentelemetry.io/collector/connector => ../../connector
- go.opentelemetry.io/collector/connector/forwardconnector => ../../connector/forwardconnector
- go.opentelemetry.io/collector/exporter => ../../exporter
- go.opentelemetry.io/collector/exporter/debugexporter => ../../exporter/debugexporter
- go.opentelemetry.io/collector/exporter/loggingexporter => ../../exporter/loggingexporter
- go.opentelemetry.io/collector/exporter/otlpexporter => ../../exporter/otlpexporter
- go.opentelemetry.io/collector/exporter/otlphttpexporter => ../../exporter/otlphttpexporter
Expand Down
2 changes: 2 additions & 0 deletions cmd/otelcorecol/components.go

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

3 changes: 3 additions & 0 deletions cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
go.opentelemetry.io/collector/connector v0.84.0
go.opentelemetry.io/collector/connector/forwardconnector v0.84.0
go.opentelemetry.io/collector/exporter v0.84.0
go.opentelemetry.io/collector/exporter/debugexporter v0.84.0
go.opentelemetry.io/collector/exporter/loggingexporter v0.84.0
go.opentelemetry.io/collector/exporter/otlpexporter v0.84.0
go.opentelemetry.io/collector/exporter/otlphttpexporter v0.84.0
Expand Down Expand Up @@ -156,6 +157,8 @@ replace go.opentelemetry.io/collector/connector/forwardconnector => ../../connec

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

replace go.opentelemetry.io/collector/exporter/debugexporter => ../../exporter/debugexporter

replace go.opentelemetry.io/collector/exporter/loggingexporter => ../../exporter/loggingexporter

replace go.opentelemetry.io/collector/exporter/otlpexporter => ../../exporter/otlpexporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ processors:
check_interval: 5s

exporters:
logging:
debug:
verbosity: detailed

service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [logging]
exporters: [debug]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [logging]
exporters: [debug]

extensions: [memory_ballast, zpages]
46 changes: 27 additions & 19 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ receivers:
regex: '.*grpc_io.*'
action: drop
exporters:
logging:
debug:
service:
pipelines:
metrics:
receivers: [prometheus]
processors: []
exporters: [logging]
exporters: [debug]
```

### zPages
Expand All @@ -109,21 +109,21 @@ extensions:
exporters](https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter#general-information)
can be configured to inspect the data being processed by the Collector.

For live troubleshooting purposes consider leveraging the `logging` exporter,
For live troubleshooting purposes consider leveraging the `debug` exporter,
which can be used to confirm that data is being received, processed and
exported by the Collector.

```yaml
receivers:
zipkin:
exporters:
logging:
debug:
service:
pipelines:
traces:
receivers: [zipkin]
processors: []
exporters: [logging]
exporters: [debug]
```

Get a Zipkin payload to test. For example create a file called `trace.json`
Expand Down Expand Up @@ -161,34 +161,42 @@ $ curl -X POST localhost:9411/api/v2/spans -H'Content-Type: application/json' -d
You should see a log entry like the following from the Collector:

```
2020-11-11T04:12:33.089Z INFO loggingexporter/logging_exporter.go:296 TraceExporter {"#spans": 1}
2023-09-07T09:57:43.468-0700 info TracesExporter {"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 2}
```

You can also configure the `logging` exporter so the entire payload is printed:
You can also configure the `debug` exporter so the entire payload is printed:

```yaml
exporters:
logging:
debug:
verbosity: detailed
```

With the modified configuration if you re-run the test above the log output should look like:

```
2020-11-11T04:08:17.344Z DEBUG loggingexporter/logging_exporter.go:353 ResourceSpans #0
Resource labels:
-> service.name: Str(api)
2023-09-07T09:57:12.820-0700 info TracesExporter {"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 2}
2023-09-07T09:57:12.821-0700 info ResourceSpans #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.4.0
Resource attributes:
-> service.name: Str(telemetrygen)
ScopeSpans #0
ScopeSpans SchemaURL:
InstrumentationScope telemetrygen
Span #0
Trace ID : 5982fe77008310cc80f1da5e10147519
Parent ID : 90394f6bcffb5d13
ID : 67fae42571535f60
Name : /m/n/2.6.1
Kind : SPAN_KIND_SERVER
Start time : 2018-01-24 08:16:15.726 +0000 UTC
End time : 2018-01-24 08:16:15.752 +0000 UTC
Trace ID : 0c636f29e29816ea76e6a5b8cd6601cf
Parent ID : 1a08eba9395c5243
ID : 10cebe4b63d47cae
Name : okey-dokey
Kind : Internal
Start time : 2023-09-07 16:57:12.045933 +0000 UTC
End time : 2023-09-07 16:57:12.046058 +0000 UTC
Status code : Unset
Status message :
Attributes:
-> data.http_response_code: Str(201)
-> span.kind: Str(server)
-> net.peer.ip: Str(1.2.3.4)
-> peer.service: Str(telemetrygen)
```

### Health Check
Expand Down
6 changes: 3 additions & 3 deletions examples/local/otel-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ processors:
check_interval: 5s

exporters:
logging:
debug:
verbosity: detailed

service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [logging]
exporters: [debug]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [logging]
exporters: [debug]

extensions: [memory_ballast, zpages]
1 change: 1 addition & 0 deletions exporter/debugexporter/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.Common
Loading