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

Support ltsv #363

Merged
merged 4 commits into from
Jul 10, 2023
Merged

Support ltsv #363

merged 4 commits into from
Jul 10, 2023

Conversation

u5surf
Copy link
Contributor

@u5surf u5surf commented Jul 2, 2023

Proposed changes

Describe the use case and detail of the change. If this PR addresses an issue on GitHub, make sure to include a link to that issue using one of the supported keywords here in this description (not in the title of the PR).

  • The many nginx's users choice the log format into Labeled Tab Separated Values to be able to analyze and extend logs more easily.
    * So, it should be support this format that the user can be more easily to switch from conventional log collector to nginx-agent.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

* The many nginx's users choice the log format into
Labeled Tab Separated Values to be able to analyze and
extend logs more easily.
* So, it should be support this format that the user
can be more easily to switch from conventional log collector
to nginx-agent.
@netlify
Copy link

netlify bot commented Jul 2, 2023

Deploy Preview for agent-public-docs canceled.

Name Link
🔨 Latest commit 5e6df6d
🔍 Latest deploy log https://app.netlify.com/sites/agent-public-docs/deploys/64a582942d8843000814b368

@github-actions github-actions bot added chore Pull requests for routine tasks dependencies labels Jul 2, 2023
Copy link
Collaborator

@dhurley dhurley left a comment

Choose a reason for hiding this comment

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

There is a failing unit test that needs to be addressed when you get a chance. https://github.com/nginx/agent/actions/runs/5437056592/jobs/9899420232

@@ -95,6 +101,28 @@ func NewPatternTailer(file string, patterns map[string]string) (*PatternTailer,
return &PatternTailer{t, gc}, nil
}

func NewLTSVTailer(file string) (*LTSVTailer, error) {
ltsvParseString := func(line string) map[string]string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you move this out into its own function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dhurley I could move out the parse function outside.

func NewLTSVTailer(file string) (*LTSVTailer, error) {
ltsvParseString := func(line string) map[string]string {
columns := strings.Split(line, "\t")
lvs := make(map[string]string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure what lvs and lv mean. Could you give the variables more meaningful names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dhurley Also Fix those name.

@u5surf
Copy link
Contributor Author

u5surf commented Jul 3, 2023

There is a failing unit test that needs to be addressed when you get a chance. https://github.com/nginx/agent/actions/runs/5437056592/jobs/9899420232

Sorry my bad, some of checksum and line count hadn’t fixed. l’ve already fixed

@codecov-commenter
Copy link

codecov-commenter commented Jul 5, 2023

Codecov Report

Patch coverage: 64.40% and project coverage change: +0.11 🎉

Comparison is base (1bd2513) 67.13% compared to head (5e6df6d) 67.25%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #363      +/-   ##
==========================================
+ Coverage   67.13%   67.25%   +0.11%     
==========================================
  Files         113      113              
  Lines       12748    12792      +44     
==========================================
+ Hits         8559     8603      +44     
+ Misses       3616     3613       -3     
- Partials      573      576       +3     
Impacted Files Coverage Δ
...nt/v2/src/core/metrics/sources/nginx_access_log.go 86.83% <50.00%> (-1.34%) ⬇️
...ithub.com/nginx/agent/v2/src/core/tailer/tailer.go 62.03% <68.42%> (+3.46%) ⬆️
...or/github.com/nginx/agent/sdk/v2/config_helpers.go 70.34% <71.42%> (-0.09%) ⬇️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

src/core/tailer/tailer_test.go Outdated Show resolved Hide resolved
@oliveromahony oliveromahony merged commit 28881ff into nginx:main Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants