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

[exporter/debug] format spans as one-liners in normal verbosity #10280

Conversation

andrzej-stencel
Copy link
Member

@andrzej-stencel andrzej-stencel commented May 31, 2024

Description

This is an initial barebones implementation that only outputs the span's name, trace ID and span ID. Other useful fields like duration etc. can be added in follow-up enhancements.

This pull request is part of #7806; it implements the change for traces. The changes for logs and metrics are proposed in separate pull requests.

This change applies to the Debug exporter only. The behavior of the Logging exporter remains unchanged. To use this behavior, switch from the deprecated Logging exporter to Debug exporter.

Link to tracking issue

Testing

Added unit tests for the formatter.

Documentation

Described the formatting in the Debug exporter's README.

This is an initial barebones implementation that only outputs the span's name, trace ID and span ID.
Other useful fields like duration etc. can be added in follow-up enhancements.
Copy link

codecov bot commented May 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.46%. Comparing base (426e660) to head (018174f).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10280      +/-   ##
==========================================
+ Coverage   92.36%   92.46%   +0.09%     
==========================================
  Files         387      390       +3     
  Lines       18435    18461      +26     
==========================================
+ Hits        17028    17070      +42     
+ Misses       1053     1036      -17     
- Partials      354      355       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrzej-stencel andrzej-stencel added the exporter/debug Issues related to the Debug exporter label Jun 3, 2024
andrzej-stencel and others added 2 commits June 5, 2024 12:18
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, needs make goporto and it should be good to go

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jun 21, 2024
mx-psi added a commit that referenced this pull request Jun 21, 2024
…ty (#10225)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Changes the behavior of `normal` verbosity of the Debug exporter for
logs to display each log record in one line of text.

Note that if the body of the log record contains newlines, the output
will be displayed in multiple lines.

This pull request is part of
#7806;
it implements the change for logs. The changes for metrics and
[traces](#10280)
will be proposed in separate pull requests.

The implementation in this pull request does not display any details on
the resource or the scope of the logs. I would like to propose
displaying the resource and the scope as separate lines in a separate
pull request.

This change applies to the Debug exporter only. The behavior of the
Logging exporter remains unchanged. To use this behavior, switch from
the deprecated Logging exporter to Debug exporter.

#### Link to tracking issue

- #7806

#### Testing

Added unit tests for the formatter.

#### Documentation

Described the formatting in the Debug exporter's README.

---------

Co-authored-by: Roger Coll <roger.coll@elastic.co>
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
@mx-psi
Copy link
Member

mx-psi commented Jun 21, 2024

Looks like you need to do make goporto

// 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())
Copy link
Member Author

@andrzej-stencel andrzej-stencel Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I could rewrite writeAttributes to take buffer and use buffer.WriteString instead of fmt.Sprintf if that helps? Perhaps as a follow-up improvement PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense, fine for me to do this on a follow up PR

@mx-psi mx-psi merged commit 3364ba1 into open-telemetry:main Jun 24, 2024
50 checks passed
@github-actions github-actions bot added this to the next release milestone Jun 24, 2024
mx-psi pushed a commit that referenced this pull request Jun 24, 2024
…verbosity (#10462)

#### Description

This pull request is part of
#7806;
it implements the change for metrics. The changes for
[logs](#10225)
and
[traces](#10280)
have been proposed in separate pull requests.

This change applies to the Debug exporter only. The behavior of the
Logging exporter remains unchanged. To use this behavior, switch from
the deprecated Logging exporter to Debug exporter.

#### Link to tracking issue

- #7806

#### Testing

Added unit tests for the formatter.

#### Documentation

Described the formatting in the Debug exporter's README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter/debug Issues related to the Debug exporter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants