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

formatter: add a formatter that returns a google::protobuf::Struct rather than a string #14258

Merged
merged 5 commits into from Dec 16, 2020

Conversation

itamarkam
Copy link
Contributor

@itamarkam itamarkam commented Dec 3, 2020

Commit Message: add a formatter that returns google::protobuf::Struct rather than a string
Additional Description: the logic was already implemented in the JSON (string) formatter, which created a formatted struct and converted it into a string. The JSON formatter was split into the aforementioned Struct formatter, and a wrapper that converts the struct into a string. Note that the new formatter is still not used anywhere (will be in the OTLP logger)
Risk Level: Low (refactoring)
Testing: Unit tests (JSON formatter tests were converted to Struct formatter tests and a simpler test was added to the JSON formatter).
Docs Changes: None
Release Notes: None
Platform Specific Features: None
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]

@omriz @yanavlasov @htuch @edrukh

@repokitteh-read-only
Copy link

Hi @itamarkam, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #14258 was opened by itamarkam.

see: more, trace.

@itamarkam
Copy link
Contributor Author

@yanavlasov this is a small refactoring, to be used later by the OT logger - I wanted to get the hang of Envoy repo PRs with something relatively simple. If you prefer that I wait with this change and send it together with the actual logger implementation, I'll do that.

@yanavlasov yanavlasov self-assigned this Dec 8, 2020
@itamarkam itamarkam force-pushed the master branch 2 times, most recently from 5c04629 to 784528a Compare December 8, 2020 17:38
Copy link
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

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

Thanks! This is just a quick initial pass.

test/common/formatter/substitution_formatter_speed_test.cc Outdated Show resolved Hide resolved
@itamarkam itamarkam force-pushed the master branch 4 times, most recently from accf9cb to 5da219b Compare December 9, 2020 19:14
@repokitteh-read-only repokitteh-read-only bot added api deps Approval required for changes to Envoy's external dependencies labels Dec 9, 2020
@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
API shepherd assignee is @mattklein123
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.
CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).

🐱

Caused by: #14258 was synchronize by itamarkam.

see: more, trace.

@itamarkam itamarkam marked this pull request as draft December 9, 2020 19:34
… wrapper that generates a string

Signed-off-by: Itamar Kaminski <itamark@google.com>
Signed-off-by: Itamar Kaminski <itamark@google.com>

Delete some leftovers

Signed-off-by: Itamar Kaminski <itamark@google.com>

Delete some leftovers

Signed-off-by: Itamar Kaminski <itamark@google.com>

clang-format

Signed-off-by: Itamar Kaminski <itamark@google.com>

Revert "clang-format"

This reverts commit 4576bc86fdb8baa2f161bde2dbdd7871169f725f.

Signed-off-by: Itamar Kaminski <itamark@google.com>

Fix error message formatting test

Fix clang-tidy

Signed-off-by: Itamar Kaminski <itamark@google.com>

Fix clang tidy again

Signed-off-by: Itamar Kaminski <itamark@google.com>
Copy link
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

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

Thanks! Some small comments, but otherwise looks good.

source/common/formatter/substitution_formatter.cc Outdated Show resolved Hide resolved
};

bool omit_empty_values_;
bool preserve_types_;
Copy link
Member

@zuercher zuercher Dec 10, 2020

Choose a reason for hiding this comment

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

I think these bools can be const as well.

source/common/formatter/substitution_formatter.h Outdated Show resolved Hide resolved
@mattklein123
Copy link
Member

I think this was tagged for API remove accidentally so I'm removing myself.

@mattklein123 mattklein123 removed api deps Approval required for changes to Envoy's external dependencies labels Dec 10, 2020
@mattklein123 mattklein123 removed their assignment Dec 10, 2020
@yanavlasov
Copy link
Contributor

yanavlasov commented Dec 11, 2020

LGTM modulo @zuercher comments.

Signed-off-by: Itamar Kaminski <itamark@google.com>
Signed-off-by: Itamar Kaminski <itamark@google.com>
yanavlasov
yanavlasov previously approved these changes Dec 14, 2020
@yanavlasov
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yanavlasov yanavlasov merged commit ba656eb into envoyproxy:master Dec 16, 2020
mpuncel added a commit to mpuncel/envoy that referenced this pull request Dec 16, 2020
* master: (49 commits)
  sds: allow multiple init managers share sds target (envoyproxy#14357)
  [http] Remove legacy codecs (envoyproxy#14381)
  http2: Add integration tests for METADATA and RST_STREAM frame flood mitigation for upstream servers (envoyproxy#14365)
  test: start dissolving :printers_include rule. (envoyproxy#14429)
  integration tests: re-enable set_node_on_first_message_only (envoyproxy#14270)
  formatter: add a formatter that returns a google::protobuf::Struct rather than a string (envoyproxy#14258)
  ratelimit: support returning custom response bodies for non-OK responses from the external ratelimit service (envoyproxy#14189)
  deps: update protobuf to 3.14 (envoyproxy#14253)
  stream_info: add setResponseCode and update local_reply to take a normal StreamInfo (envoyproxy#14402)
  http: alpn upstream (envoyproxy#13922)
  Moved starttls integration test to test/extensions/transport_sockets/starttls. (envoyproxy#14425)
  generic conn pool: directly use thread local cluster (envoyproxy#14423)
  wasm: add mathetake to CODEOWNERS (envoyproxy#14427)
  wasm: clear route cache when modifying HTTP request headers. (envoyproxy#14318)
  tls: disable TLS inspector injection (envoyproxy#14404)
  aggregate cluster: cleanups (envoyproxy#14411)
  Mark starttls_integration_test flaky on Windows (envoyproxy#14419)
  tcp: improved unit testing (envoyproxy#14415)
  config: making protocol config explicit (envoyproxy#14362)
  wasm: dead code (envoyproxy#14407)
  ...

Signed-off-by: Michael Puncel <mpuncel@squareup.com>
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.

None yet

4 participants