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

extended sdk-nestjs docs + cleanup #752

Merged
merged 6 commits into from
Feb 8, 2024

Conversation

bogdan-rosianu
Copy link
Contributor

Description of the pull request (what is new / what has changed)

Extended NestJS SDK docs + rebranding + code cleanup

Did you test the changes locally ?

  • yes
  • no

Which category (categories) does this pull request belong to?

  • document new feature
  • update documentation that is not relevant anymore
  • add examples or more information about a component
  • fix grammar issues
  • other

@bogdan-rosianu bogdan-rosianu self-assigned this Nov 20, 2023
andreibancioiu
andreibancioiu previously approved these changes Jan 30, 2024
@@ -88,7 +88,7 @@ Then it's serialized form (step 5 is omitted in this example) is as follows:

## **Ed25519 signature**

MultiversX uses the [Ed25519](https://ed25519.cr.yp.to/) algorithm to sign transactions. In order to obtain the signature, one can use generic software libraries such as [PyNaCl](https://pynacl.readthedocs.io/en/stable/signing/), [tweetnacl-js](https://github.com/dchest/tweetnacl-js#signatures) or components of MultiversX SDK such as [mx-sdk-js-wallet](https://github.com/multiversx/mx-sdk-js-wallet), [mx-sdk-py-wallet](https://github.com/multiversx/mx-sdk-py-wallet), [erdgo](https://github.com/multiversx/mx-sdk-erdgo), [erdjava](https://github.com/multiversx/mx-sdk-erdjava), [mx-sdk-js-wallet-cli](https://github.com/multiversx/mx-sdk-js-wallet-cli) etc.
MultiversX uses the [Ed25519](https://ed25519.cr.yp.to/) algorithm to sign transactions. In order to obtain the signature, one can use generic software libraries such as [PyNaCl](https://pynacl.readthedocs.io/en/stable/signing/), [tweetnacl-js](https://github.com/dchest/tweetnacl-js#signatures) or components of MultiversX SDK such as [mx-sdk-js-wallet](https://github.com/multiversx/mx-sdk-js-wallet), [mx-sdk-py-wallet](https://github.com/multiversx/mx-sdk-py-wallet), [sdk-go](https://github.com/multiversx/mx-sdk-go), [mxjava](https://github.com/multiversx/mx-sdk-java), [mx-sdk-js-wallet-cli](https://github.com/multiversx/mx-sdk-js-wallet-cli) etc.
Copy link
Contributor

Choose a reason for hiding this comment

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

🚀

- programmatically, using the [erdgo - Golang SDK](/sdk-and-tools/erdgo)
- programmatically, using the [erdjava - Java SDK](/sdk-and-tools/erdjava)
- programmatically, using the [sdk-go - Golang SDK](/sdk-and-tools/sdk-go)
- programmatically, using the [mxjava - Java SDK](/sdk-and-tools/mxjava)
Copy link
Contributor

Choose a reason for hiding this comment

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

In this context, can be sdk-java (the label - the link is OK).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


[comment]: # (mx-context-auto)

### erdjava - Java SDK
### mxjava - Java SDK
Copy link
Contributor

Choose a reason for hiding this comment

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

So, not mx-sdk-java (for consistency)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

[comment]: # (mx-context-auto)

## Utility
The package exports **in memory cache service** and **remote cache service**.
Copy link
Contributor

Choose a reason for hiding this comment

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

... two services: an in-memory ... and a remote ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

[comment]: # (mx-context-auto)

## Table of contents
- [In Memory Cache](#in-memory-cache) - super fast in memory caching system based on [LRU cache](https://www.npmjs.com/package/lru-cache)
Copy link
Contributor

Choose a reason for hiding this comment

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

in-memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

## In memory cache
In memory cache, available through `InMemoryCacheService`, is used to read and write data from and into the memory storage of your Node.js instance.

*Note that if you have multiple instances of your application you must sync local cache across all your instances.*
Copy link
Contributor

Choose a reason for hiding this comment

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

the local cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


*Note that if you have multiple instances of your application you must sync local cache across all your instances.*

Let's take as an example a ConfigService that loads some non-crucial configuration from the database and can be cached for 10 seconds.
Copy link
Contributor

Choose a reason for hiding this comment

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

ConfigService

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

[comment]: # (mx-context-auto)

## Redis Cache
Redis cache, available through `RedisCacheService`, is a caching system build ontop of Redis. It is used to share cache related information among multiple microservices.
Copy link
Contributor

Choose a reason for hiding this comment

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

"to share cache related information" -> "used as a shared cache, shared among ..." (without "cache related information").

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

[comment]: # (mx-context-auto)

## Interceptors
The package provides a series of [Nestjs Interceptors](https://docs.nestjs.com/interceptors) which will automatically log and set the CPU and overall duration for each request in a prom histogram ready to be scrapped by Prometheus.
Copy link
Contributor

Choose a reason for hiding this comment

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

_prom_ or Prometheus histogram, plus a link to Prometheus?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


## MetricsModule and MetricsService

`MetricsModule` is a [Nestjs Module](https://docs.nestjs.com/modules) responsible for aggregating metrics data through `MetricsService` and exposing them to be consumed by Prometheus. `MetricsService` is extensible, you can define and aggregate your own metrics and expose them. By default it exposes a set of metrics created by the interceptors specified [here](#interceptors). Most of the Multiversx packages expose metrics by default through this service. For example [@multiversx/sdk-nestjs-redis](https://www.npmjs.com/package/@multiversx/sdk-nestjs-redis) automatically tracks the execution time of each redis query, overall redis health and much more, by leveraging the `MetricsService`.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Most of the Multiversx packages" -> typo X.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

tanghel
tanghel previously approved these changes Jan 31, 2024
@bogdan-rosianu bogdan-rosianu dismissed stale reviews from tanghel and andreibancioiu via de4d91d January 31, 2024 09:08
@bogdan-rosianu bogdan-rosianu merged commit d0be7e8 into development Feb 8, 2024
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.

3 participants