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

Proposing a formatter allow-list configuration #440

Merged
merged 5 commits into from
Aug 18, 2021

Conversation

eyalkoren
Copy link
Contributor

@eyalkoren eyalkoren commented May 4, 2021

It's easy to imagine cases where users would want some logs to be automatically reformatted, but not others.
We can choose different entities to filter upon, for example - loggers, but the formatting entity seems like a good candidate to provide a good default, as normally we would like to reformat plain-text or pattern-based formatters, but not format specific ones, like JSON/HTML/XML etc.

@basepi I already added this config to the Java agent, but not necessarily we want to align on that. I asked your review because you are the only one that implemented it so far, to see if you think it makes sense.

@eyalkoren eyalkoren requested a review from basepi May 4, 2021 12:53
@apmmachine
Copy link

apmmachine commented May 4, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-08-18T04:23:19.151+0000

  • Duration: 3 min 4 sec

  • Commit: f45a84c

Trends 🧪

Image of Build Times

@eyalkoren eyalkoren requested a review from felixbarny June 1, 2021 12:39
Copy link
Contributor

@basepi basepi left a comment

Choose a reason for hiding this comment

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

I don't think this would apply for Python. The Python implementation is a very blunt instrument, we explicitly recommend users to do it manually for better control.

We may want to bring in other agent teams to see if this makes sense as a cross-agent option or if it should just be Java.

@eyalkoren eyalkoren marked this pull request as ready for review August 15, 2021 09:08
@eyalkoren eyalkoren requested review from a team as code owners August 15, 2021 09:08
@eyalkoren
Copy link
Contributor Author

Checking with other agents - if no agent see how this may be relevant, we don't have to include it in the spec, it can be Java-agent-specific

@trentm
Copy link
Member

trentm commented Aug 16, 2021

I think it would be a very rare, but possible, use case in Node.js-land. The following are limiters to a config like this being used by Node.js users:

  • Only a subset of the logging frameworks supported by ecs-logging-nodejs support multiple "transports/formatters" and only one of the three (Winston) discusses having multiple transports without literal "stern warning"s against doing so.
  • An implementation of this for Node.js would be a little bit of hack, because matching the allow list patterns would be looking at the constructor names of the transport/formatter objects passed into the logging framework API. That works, but isn't the kind of thing I see done much in node.js packages, so might be somewhat surprising to users.
  • Like @basepi mentioned for Python, I think I would tend to encourage Node.js APM + ecs-logging users to explicitly setup their logging config manually because there can be unintended side-effects.

@eyalkoren
Copy link
Contributor Author

Like @basepi mentioned for Python, I think I would tend to encourage Node.js APM + ecs-logging users to explicitly setup their logging config manually because there can be unintended side-effects.

Just to clarify - the entire purpose of log_ecs_reformatting is to make this functionality zero-config as part of the onboarding enhancement efforts we make. Wherever we feel it's not possible or not safe, we need to think if we really want to implement that and recommend users to do otherwise. The ECS-logging libraries already offer minimal manual config effort, this one is really reducing from minimal to zero.

@eyalkoren
Copy link
Contributor Author

An additional thing I just noticed now that I missed in my original review - we called this config log_ecs_reformatting in the Java agent, whereas in the spec and the Python agent it's log_ecs_formatting.

Personally, I prefer reformatting because it emphasizes the "aggressive" nature of this instrumentation, but I don't mind changing it if others prefer formatting. @basepi , assuming this was not intentional, WDYT?

@basepi
Copy link
Contributor

basepi commented Aug 17, 2021

@eyalkoren I don't have strong feelings on log_ecs_formatting vs log_ecs_reformatting. I do think the latter is probably more descriptive. This feature is still marked as experimental so it's easy enough to change in python.

Copy link
Contributor

@russcam russcam left a comment

Choose a reason for hiding this comment

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

This looks fine to me, although not relevant to the .NET agent.

@eyalkoren
Copy link
Contributor Author

OK, I will merge this with a clarification that this is currently only used in the Java agent, so it is there in case some other agent needs something similar when implementing this.
Thanks for the feedback 🙏

@eyalkoren eyalkoren merged commit 17f11c1 into master Aug 18, 2021
@eyalkoren eyalkoren deleted the formatter-allowlist-config branch August 18, 2021 04:43
trentm pushed a commit to trentm/apm that referenced this pull request Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants