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

[JSON-API] Add information from the jwtpayload to the logging context #9995

Merged
merged 9 commits into from
Jun 16, 2021

Conversation

realvictorprm
Copy link
Contributor

This fixes #9982.

Only problematic thing with my changes is that IntelliJ now complains a bit more although it compiles fine:
image

However, I think this is the right direction but I'm not sure if that is already enough, what do you think @cocreature?

changelog_begin

  • [JSON API] For applicable requests actAs, readAs, applicationId & ledgerId are included in the log context

changelog_end

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@realvictorprm realvictorprm changed the title Add information from the jwtpayload to the logging context [JSON API] Add information from the jwtpayload to the logging context Jun 14, 2021
@S11001001 S11001001 changed the title [JSON API] Add information from the jwtpayload to the logging context Add information from the jwtpayload to the logging context Jun 14, 2021
@S11001001 S11001001 added this to the HTTP JSON API Maintenance milestone Jun 14, 2021
@S11001001 S11001001 added the component/json-api HTTP JSON API label Jun 14, 2021
@realvictorprm realvictorprm changed the title Add information from the jwtpayload to the logging context [JSON-API] Add information from the jwtpayload to the logging context Jun 15, 2021
@realvictorprm realvictorprm force-pushed the http-json/tokenLoggingContext branch from 5e5b91c to 24b0c33 Compare June 15, 2021 15:26
Copy link
Contributor

@cocreature cocreature left a comment

Choose a reason for hiding this comment

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

Thanks!

@realvictorprm
Copy link
Contributor Author

go mergify goooo 😄

@realvictorprm
Copy link
Contributor Author

no you got to be kidding me

need to resolve that merge conflict first 🔥

@realvictorprm realvictorprm force-pushed the http-json/tokenLoggingContext branch from 2d97aaa to 1af8a4f Compare June 16, 2021 07:26
@realvictorprm
Copy link
Contributor Author

now, finally resolved. Shouldn't take long till this is in 😁

@mergify mergify bot merged commit cfee5a2 into main Jun 16, 2021
@mergify mergify bot deleted the http-json/tokenLoggingContext branch June 16, 2021 07:55
realvictorprm added a commit that referenced this pull request Jun 21, 2021
…#9995)

* Add information from the jwtpayload to the logging context

changelog_begin

- [JSON API] For applicable requests actAs, readAs, applicationId & ledgerId are included in the log context

changelog_end

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala

Co-authored-by: Stephen Compall <[email protected]>

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala

Co-authored-by: Stephen Compall <[email protected]>

* Revert changes to make the function generic

* Create JwtPayloadG trait from which both payload variants inherit

* Reduce code duplication in Endpoints.scala

* Apply review suggestion

* Update test name to reflect field name changes

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala

Co-authored-by: Moritz Kiefer <[email protected]>

Co-authored-by: Stephen Compall <[email protected]>
Co-authored-by: Moritz Kiefer <[email protected]>
realvictorprm added a commit that referenced this pull request Jun 21, 2021
* Load the correct logback file for the http json service respecting the deployment situation (#9938)

* Load the correct logback file for the http json service respecting the deployment situation

changelog_begin

[HTTP-JSON]
- fixed that json log output could not be enabled via cli options except via usage of env vars

changelog_end

* Move import statement, remove some braces and reformat

* Move system prop dependend logic to cliopts Logging.scala

* Remove PathKind type in cliopts Logging.scala as it's not necessary anymore

* Log call to submitAndWaitRequest with the command id provided in the log ctx (#9940)

* Log call to submitAndWaitRequest with the command id provided in the log ctx

changelog_begin

- [HTTP-JSON] Calls which trigger a submitAndWaitRequest are logged with the command id provided in the log ctx

changelog_end

* Require the request id to be also in the log ctx

* Log command kind in submitAndWaitRequest of CommandService.scala

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/CommandService.scala

Co-authored-by: Moritz Kiefer <[email protected]>

Co-authored-by: Moritz Kiefer <[email protected]>

* Just print out the operator name for the operation logging in CommandService.scala (#9989)

changelog_begin
changelog_end

* Don't duplicate log failed futures in the http json api (commandservice specific ones) (#9990)

* Don't duplicate log failed futures in the http json api (commandservice specific)

changelog_begin

- [JSON API] Errors which arise from the CommandService are not logged twice anymore (thus reducing noise)

changelog_end

* Fix duplicate logging of a failed future differently via adding another error case in CommandService.scala

* Restore old formatting

* Improve comment

* Remove the wrong changes I accidentally made, the functions are quite similar xD

* remove the additional type and just make the id optional & remove unecessary comment

* [JSON-API] Log source and path of incoming http requests & the response with info level (#10007)

changelog_begin

- [JSON-API] The source and the path for incoming http requests are now logged
- [JSON-API] The http response for a request is now logged

changelog_end

* [JSON-API] Log templateId & choice name (if present) on command submissions in the json API (#10005)

* Log templateId & choice name (if present) on command submissions in the json API

changelog_begin

- [JSON API] The template id & choice name (if present) are now logged on command submissions in the Json API (at trace level)

changelog_end

* Move the template id & the choice into the logging context

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/CommandService.scala

Co-authored-by: Stefano Baghino <[email protected]>

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/CommandService.scala

Co-authored-by: Stefano Baghino <[email protected]>

* Fix compile error due to scala 2.12 collection differences

Co-authored-by: Stefano Baghino <[email protected]>

* [JSON-API] Add information from the jwtpayload to the logging context (#9995)

* Add information from the jwtpayload to the logging context

changelog_begin

- [JSON API] For applicable requests actAs, readAs, applicationId & ledgerId are included in the log context

changelog_end

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala

Co-authored-by: Stephen Compall <[email protected]>

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala

Co-authored-by: Stephen Compall <[email protected]>

* Revert changes to make the function generic

* Create JwtPayloadG trait from which both payload variants inherit

* Reduce code duplication in Endpoints.scala

* Apply review suggestion

* Update test name to reflect field name changes

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala

Co-authored-by: Moritz Kiefer <[email protected]>

Co-authored-by: Stephen Compall <[email protected]>
Co-authored-by: Moritz Kiefer <[email protected]>

* Add date to log statements in the HTTP JSON service (#9988)

changelog_begin

- [JSON API] log statements now include the date next to the time

changelog_end

Co-authored-by: Moritz Kiefer <[email protected]>
Co-authored-by: Stefano Baghino <[email protected]>
Co-authored-by: Stephen Compall <[email protected]>
azure-pipelines bot pushed a commit that referenced this pull request Jun 23, 2021
This PR has been created by a script, which is not very smart
and does not have all the context. Please do double-check that
the version prefix is correct before merging.

@S11001001 is in charge of this release.

Commit log:
```
d867d90 define query offset semantics solely in terms of #9847 per-query offsets (#10071)
1f5aa44 [JSON-API] Add metrics for ledger command submission timing (#10076)
7eb2ce7 update compat versions for 1.15.0-snapshot.20210615.7169.0.adeba206 (#10028)
c44f337 Simplify speedy benchmark (#10079)
58b1c4e Speedy: Refactor contract Id/Key callback (#10033)
8558c73 Upgrade canton to 0.25.0 based on daml 1.14.0 (#10074)
e4c1c58 Run scenarios in off-ledger machine (#10070)
31a76a4 allow CI pools to use any zone (#10069)
0391f35 [JSON-API] Add db metrics & response construction metrics (#10068)
ea089ad clean up local VSCode after release (#10065)
39a5890 fix 9_functional redirect (#10067)
fb757d8 Handle visibility outside of speedy (#10056)
b796695 Add per-query offsets to HTTP-JSON API (#9847)
ab8bac5 [In-memory fan-out] BuffersUpdater subscribes from the ledger end (#10037)
e458529 [JSON-API] Add moar timing metrics (#10045)
e12a449 s/DABL/Daml Hub/ (#10062)
a205d0e Enriched conformance tests for transactions (trees) streams (#9977)
b98ad91 Bump test sha (#10055)
f3106c3 I9996 value limits it fails oracle (#10027)
febca5d Use ScenarioRunner.submit in Daml Script (#10053)
3113702 index json-api signatories and observers on Oracle (#9895)
cb3a42a update NOTICES file (#10047)
2f51869 Allow constraints in any position in data-deps. (#10049)
7dfa36f pass supportedJdbcDriverNames implicitly, and only to what actually needs it (#10036)
0fbc1ee H2 support for append only schema (part2) [DPP-394] (#10030)
cd2fda6 Fix broken package.json config (#10044)
10ab05f Fix vsce publishing (#10043)
090dd95 rotate release duty after 1.14.0-snapshot.20210615.7169.0.adeba206 (#10019)
eee484b Implemented in-memory buffers prunning in BaseLedger (#9936)
b96639e Do not terminate streams when no end-offset given in `ledger-api-bench-tool` [DPP-422] (#10035)
2b915e9 Split scenario & ledger execution (#10039)
591176c Remove SqlSequence, cleanup code (#10042)
8ea240f Release SDK 1.14.0 (#10041)
3532460 LF: Structure Preprocessing Errors (#10013)
1852830 [JSON-API] Concurrent query etc. metrics (#10031)
321c4da test different template-ID frequencies in the "mega" perf scenario (#10016)
993591e truncate party name for 64 chars for multi-valued submitters to avoid… (#10000)
7a2a349 Log context of all updates written to the database (#10010)
4005c84 release 1.15.0-snapshot.20210615.7169.0.adeba206 (#10022)
d1aa256 Force css-what resolution in compiler/daml-extension & fully regenera… (#10025)
0fbfd99 DPP-394 h2 support for append only schema (#10009)
32d70cf Revert "release 1.14.0-snapshot.20210615.7169.0.adeba206 (#10018)" (#10023)
cfee5a2 [JSON-API] Add information from the jwtpayload to the logging context (#9995)
fe63825 release 1.14.0-snapshot.20210615.7169.0.adeba206 (#10018)
```
Changelog:
```
- [JSON-API] Timing metrics which measure how long the processing of a command submission request takes on the ledger are now available

- [JSON-API] The database operations (regardless of in-memory or postgres) contain now metrics for fetching contracts by id or key (seperate metrics foreach)
- [JSON-API] The time for a repsonse payload construction of a request is now also tracked in a metric

[HTTP/JSON API] The streaming query endpoint now accepts to override the
offset for each query using the `offset` field. You can read more
about it on the documentation.
- [JSON-API] Timing metrics are now available for party management, package management, command submission and query endpoints.
- [JSON-API] Also added a timing metric for parsing and decoding of incoming json payloads
- [JSON API] The Oracle database schema has changed; if using
  ``--query-store-jdbc-config``, you must rebuild the database by adding
  ``,createSchema=true``.  See #9895.
- [JSON-API] The metrics which describe the amount of these concurrent events is now available:
	- running http request
	- command submissions
	- package allocations
	- party allocations
[metrics] Limit size of multi party metrics to ease consumption
For every update in the index db log the full context at the INFO level.
- [JSON API] For applicable requests actAs, readAs, applicationId & ledgerId are included in the log context
```

CHANGELOG_BEGIN
CHANGELOG_END
@stefanobaghino-da stefanobaghino-da added the team/ledger-clients Related to the Ledger Clients team's components. label Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/json-api HTTP JSON API team/ledger-clients Related to the Ledger Clients team's components.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include token information in JSON API logging context
5 participants