diff --git a/docs/cache/develop/basics/client-configuration-objects.md b/docs/cache/develop/basics/client-configuration-objects.md index 917ee4849..c555b1374 100644 --- a/docs/cache/develop/basics/client-configuration-objects.md +++ b/docs/cache/develop/basics/client-configuration-objects.md @@ -59,4 +59,4 @@ Here are some of the pre-built configurations that you might be interested in. `Configurations.Lambda` is a configuration that is available in some SDKs, and is optimized for the AWS Lambda environment. It has configuration settings designed to pre-warm the client on Lambda function cold starts, and to ensure the connection is re-established proactively if a Lambda function remains idle long enough for the connection to time out. - + diff --git a/docs/cache/develop/sdks/dart/index.md b/docs/cache/develop/sdks/dart/index.md index 5697733b5..23751a3ed 100644 --- a/docs/cache/develop/sdks/dart/index.md +++ b/docs/cache/develop/sdks/dart/index.md @@ -21,9 +21,3 @@ The Momento Dart SDK and source code are available via GitHub: [momentohq/client - [Dart SDK cheat sheet](./cheat-sheet.mdx) - [Dart SDK examples](https://github.com/momentohq/client-sdk-dart/tree/main/example): working example projects that illustrate how to use the Dart SDK -- COMING SOON: Observability: Logging and client-side metrics with the Dart SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the Dart SDK - -## Integrations - -COMING SOON diff --git a/docs/cache/develop/sdks/dotnet/index.md b/docs/cache/develop/sdks/dotnet/index.md index f0df0f5cc..6a5c6a30c 100644 --- a/docs/cache/develop/sdks/dotnet/index.md +++ b/docs/cache/develop/sdks/dotnet/index.md @@ -23,7 +23,6 @@ The source code can be found on GitHub: [momentohq/client-sdk-dotnet](https://gi - [.NET SDK Cheat Sheet](./cheat-sheet.mdx) - [.NET SDK Examples](https://github.com/momentohq/client-sdk-dotnet/blob/main/examples/README.md): working example projects that illustrate how to use the .NET SDK - [.NET SDK Observability](./observability.mdx): Logging and Client-side Metrics with the .NET SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the .NET SDK ## Integrations diff --git a/docs/cache/develop/sdks/elixir/index.md b/docs/cache/develop/sdks/elixir/index.md index 7bda1059f..210115a1f 100644 --- a/docs/cache/develop/sdks/elixir/index.md +++ b/docs/cache/develop/sdks/elixir/index.md @@ -21,9 +21,3 @@ The source code can be found on GitHub: [momentohq/client-sdk-elixir](https://gi - [Elixir SDK cheat sheet](./cheat-sheet.mdx) - [Elixir SDK examples](https://github.com/momentohq/client-sdk-elixir/blob/main/examples/README.md): working example projects that illustrate how to use the Elixir SDK -- COMING SOON: Observability: Logging and client-side metrics with the Elixir SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the Elixir SDK - -## Integrations - -COMING SOON diff --git a/docs/cache/develop/sdks/go/index.md b/docs/cache/develop/sdks/go/index.md index 974ccd67e..6d9c951d9 100644 --- a/docs/cache/develop/sdks/go/index.md +++ b/docs/cache/develop/sdks/go/index.md @@ -21,8 +21,6 @@ The source code can be found on GitHub: [momentohq/client-sdk-go](https://github - [Go SDK Cheat Sheet](./cheat-sheet.mdx) - [Go SDK Examples](https://github.com/momentohq/client-sdk-go/blob/main/examples/README.md): working example projects that illustrate how to use the Go SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Go SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Go SDK ## Integrations diff --git a/docs/cache/develop/sdks/java/index.md b/docs/cache/develop/sdks/java/index.md index ba40e44e7..ed158c274 100644 --- a/docs/cache/develop/sdks/java/index.md +++ b/docs/cache/develop/sdks/java/index.md @@ -22,9 +22,3 @@ The source code can be found on GitHub: [momentohq/client-sdk-java](https://gith - [Java SDK Cheat Sheet](./cheat-sheet.mdx) - [Java SDK Examples](https://github.com/momentohq/client-sdk-java/blob/main/examples/README.md): working example projects that illustrate how to use the Java SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Java SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Java SDK - -## Integrations - -COMING SOON diff --git a/docs/cache/develop/sdks/kotlin/index.md b/docs/cache/develop/sdks/kotlin/index.md index 01db2bdaa..18f0a6b7c 100644 --- a/docs/cache/develop/sdks/kotlin/index.md +++ b/docs/cache/develop/sdks/kotlin/index.md @@ -23,9 +23,3 @@ The source code can be found on GitHub: [momentohq/client-sdk-kotlin](https://gi - [Kotlin SDK Cheat Sheet](./cheat-sheet.mdx) - [Kotlin SDK Examples](https://github.com/momentohq/client-sdk-kotlin/blob/main/examples/README.md): working example projects that illustrate how to use the Kotlin SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Kotlin SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Kotlin SDK - -## Integrations - -COMING SOON diff --git a/docs/cache/develop/sdks/nodejs/config-and-error-handling.mdx b/docs/cache/develop/sdks/nodejs/config-and-error-handling.mdx new file mode 100644 index 000000000..b538abb85 --- /dev/null +++ b/docs/cache/develop/sdks/nodejs/config-and-error-handling.mdx @@ -0,0 +1,53 @@ +--- +sidebar_position: 2 +sidebar_label: Config and Error Handling +title: Observability for TypeScript and Node.js +description: Instrument your Momento-enabled Node.js code with Logs, Metrics, and Traces +--- + +import { SdkExampleCodeBlock } from "@site/src/components/SdkExampleCodeBlock"; +// This import is necessary even though it looks like it's un-used; The inject-example-code-snippet +// plugin will transform instances of SdkExampleCodeBlock to SdkExampleCodeBlockImpl +import { SdkExampleCodeBlockImpl } from "@site/src/components/SdkExampleCodeBlockImpl"; + +# Configuration and Error Handling in the Momento node.js SDK + +## Configuration + +The code below illustrates the simplest way to construct a `CacheClient`: + + + +However, you may pass in a `Configuration` object to customize the behavior. + +Momento provides several pre-built configurations in the `Configurations` module, such as `InRegion` (which is configured +with timeouts and connection counts that are appropriate for server-side connectivity from within the same AWS region), +and `Lambda` (which is tuned for use in AWS Lambda environments). Here is how you can specify the `Lambda` configuration: + + + +If you omit the configuration, Momento will use the `Laptop` configuration by default. This configuration has relaxed +timeouts, suitable for development or in high-latency environments. (It is not recommended for production, server-side use.) + +For more information about `Configuration` objects see [SDK Configuration Objects](/cache/develop/basics/client-configuration-objects.md). + +## Error Handling + +By default, `CacheClient` errors are surfaced to developers as part of the return values of the calls, as opposed to throwing +exceptions. This makes errors more visible when you're writing your code, and allows your IDE to be more helpful in ensuring +you've handled the errors you care about. + +Here's an example of how to check for errors on a `get` call: + + + +However, if you prefer for exceptions to be thrown, you can configure the `CacheClient` to do so: + + + +With this configuration setting, any errors that occur will result in an instance of `SdkError` being thrown. You may +catch it and use its `.errorCode()` method to determine the specific error that occurred: + + + +For more information about error handling in Momento see [SDK Error Handling](/cache/develop/basics/error-handling-production-readiness.md). diff --git a/docs/cache/develop/sdks/nodejs/index.md b/docs/cache/develop/sdks/nodejs/index.md index 1759212cc..2202d88d0 100644 --- a/docs/cache/develop/sdks/nodejs/index.md +++ b/docs/cache/develop/sdks/nodejs/index.md @@ -6,7 +6,7 @@ sidebar_label: Node.js description: Information about the Momento Node.js SDK --- -# Momento Node.js SDK +# Momento Node.js SDK - Cache Client The Momento Node.js SDK is available via the npm package [`@gomomento/sdk`](https://www.npmjs.com/package/@gomomento/sdk). @@ -21,11 +21,11 @@ The source code can be found on GitHub: [momentohq/client-sdk-javascript](https: - [Node.js SDK Cache Cheat Sheet](./cheat-sheet.mdx) - [Node.js SDK Examples](https://github.com/momentohq/client-sdk-javascript/blob/main/examples/nodejs/README.md): working example projects that illustrate how to use the Node.js SDK -- [Node.js Token Vending Machine](https://github.com/momentohq/client-sdk-javascript/tree/main/examples/nodejs/token-vending-machine): provides temporary, restricted scope Momento Auth tokens that can be used by browsers running apps written against the [Momento Web SDK](https://github.com/momentohq/client-sdk-javascript/tree/main/packages/client-sdk-web). +- [Node.js SDK Configuration and Error Handling](./config-and-error-handling.mdx): Taking your code to production - [Node.js SDK Observability](./observability.mdx): Logging and Client-side Metrics with the Node.js SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Node.js SDK ## Integrations +- [Node.js Token Vending Machine](https://github.com/momentohq/client-sdk-javascript/tree/main/examples/nodejs/token-vending-machine): provides temporary, restricted scope Momento Auth tokens that can be used by browsers running apps written against the [Momento Web SDK](https://github.com/momentohq/client-sdk-javascript/tree/main/packages/client-sdk-web). - [Redis Compatibility Client for `@redis/client`](https://github.com/momentohq/momento-node-redis-client) - a drop-in replacement that allows you to use Momento Cache with your existing `@redis/client` code! See also our [Redis Client Compatibility](./../../integrations/redis-client-compatibility.md) page. - [Redis Compatibility Client for `ioredis`](https://github.com/momentohq/momento-node-ioredis-client) - a drop-in replacement that allows you to use Momento Cache with your existing `ioredis` code! See also our [Redis Client Compatibility](./../../integrations/redis-client-compatibility.md) page. diff --git a/docs/cache/develop/sdks/php/index.md b/docs/cache/develop/sdks/php/index.md index 413d25246..0436af516 100644 --- a/docs/cache/develop/sdks/php/index.md +++ b/docs/cache/develop/sdks/php/index.md @@ -22,11 +22,10 @@ The source code can be found on GitHub: [momentohq/client-sdk-php](https://githu - [PHP SDK cheat sheet](./cheat-sheet.md) - [PHP SDK examples](https://github.com/momentohq/client-sdk-php/blob/main/examples/README.md): working example projects that illustrate how to use the PHP SDK -- COMING SOON: Observability: logging and client-side metrics with the PHP SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the PHP SDK ## Integrations +- [Drupal Cache Backend](../../integrations/drupal-integration.md) - [Laravel Cache](https://github.com/momentohq/laravel-cache) - a drop-in replacement that allows you to use Momento Cache with your existing Laravel application! See also our [Laravel Integration](./../../integrations/momento-cache-laravel-php.md) page. - [Laravel Example App](https://github.com/momentohq/laravel-example) - a fully operational Laravel example application that uses the Momento Laravel cache integration. - [PSR-16 Cache API](https://github.com/momentohq/client-sdk-php/blob/main/README-PSR16.md) - an implementation of the PHP PSR-16 cache specification backed by Momento Cache. diff --git a/docs/cache/develop/sdks/python/index.md b/docs/cache/develop/sdks/python/index.md index 916ea5a73..58a6648f0 100644 --- a/docs/cache/develop/sdks/python/index.md +++ b/docs/cache/develop/sdks/python/index.md @@ -21,8 +21,6 @@ The source code can be found on GitHub: [momentohq/client-sdk-python](https://gi - [Python SDK Cheat Sheet](./cheat-sheet.md) - [Python SDK Examples](https://github.com/momentohq/client-sdk-python/blob/main/examples/README.md): working example projects that illustrate how to use the Python SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Python SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Python SDK ## Integrations diff --git a/docs/cache/develop/sdks/ruby/index.md b/docs/cache/develop/sdks/ruby/index.md index 9020149f0..bac209f26 100644 --- a/docs/cache/develop/sdks/ruby/index.md +++ b/docs/cache/develop/sdks/ruby/index.md @@ -19,11 +19,4 @@ The source code can be found on GitHub: [momentohq/client-sdk-ruby](https://gith ## Resources -- COMING SOON: Ruby SDK Cheat Sheet - [Ruby SDK Examples](https://github.com/momentohq/client-sdk-ruby/blob/main/examples/README.md): working example projects that illustrate how to use the Ruby SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Ruby SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Ruby SDK - -## Integrations - -COMING SOON diff --git a/docs/cache/develop/sdks/rust/index.md b/docs/cache/develop/sdks/rust/index.md index 9e08f34f1..5613cd36f 100644 --- a/docs/cache/develop/sdks/rust/index.md +++ b/docs/cache/develop/sdks/rust/index.md @@ -18,11 +18,4 @@ The source code can be found on github: [momentohq/client-sdk-rust](https://gith ## Resources -- COMING SOON: Rust SDK Cheat Sheet - [Rust SDK Examples](https://github.com/momentohq/client-sdk-rust/blob/main/example/README.md): working example projects that illustrate how to use the Rust SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Rust SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Rust SDK - -## Integrations - -COMING SOON diff --git a/docs/cache/develop/sdks/swift/index.md b/docs/cache/develop/sdks/swift/index.md index e6cd61f01..6a23bcb0a 100644 --- a/docs/cache/develop/sdks/swift/index.md +++ b/docs/cache/develop/sdks/swift/index.md @@ -19,9 +19,3 @@ The Momento Swift SDK and source code are available via GitHub: [momentohq/clien - [Swift SDK cheat sheet](./cheat-sheet.mdx) - [Swift SDK examples](https://github.com/momentohq/client-sdk-swift/tree/main/Examples): working example projects that illustrate how to use the Swift SDK -- COMING SOON: Observability: Logging and client-side metrics with the Swift SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the Swift SDK - -## Integrations - -COMING SOON diff --git a/docs/cache/develop/sdks/web/index.md b/docs/cache/develop/sdks/web/index.md index 8e4c91310..41a526e22 100644 --- a/docs/cache/develop/sdks/web/index.md +++ b/docs/cache/develop/sdks/web/index.md @@ -33,7 +33,6 @@ The source code can be found on GitHub: [momentohq/client-sdk-javascript](https: - [Chat app: Next.js](https://github.com/momentohq/client-sdk-javascript/tree/main/examples/web/nextjs-chat): a dynamic app that allows users to chat in their browser by entering a cache and topic name. The application vends low scope, short-lived auth tokens to the browser which uses them to subscribe to the topic. - [Chat app: Vite](https://github.com/momentohq/client-sdk-javascript/tree/main/examples/web/vite-chat-app): a static version of the chat app that requires a separate API (such as our [Node.js token vending machine](https://github.com/momentohq/client-sdk-javascript/tree/main/examples/nodejs/token-vending-machine)) to provide auth tokens to browsers. - [Web SDK Examples](https://github.com/momentohq/client-sdk-javascript/blob/main/examples/web/README.md): working example projects that illustrate how to use the web SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the web SDK ## Momento web SDK and Momento Topics diff --git a/docs/topics/develop/api-reference/index.md b/docs/topics/develop/api-reference/index.md index 2c68a379e..3613803fb 100644 --- a/docs/topics/develop/api-reference/index.md +++ b/docs/topics/develop/api-reference/index.md @@ -13,6 +13,12 @@ import { SdkExampleTabsImpl } from "@site/src/components/SdkExampleTabsImpl"; # Using the Momento Topics API Momento Topics is a messaging pattern enabling real-time communication between parts of a distributed application. It enables you to publish (produce) values to a topic and subscribe (consume) from a topic. This page details the Momento API methods for interacting with Momento Topics. +## TopicClient + +Momento Topics API calls are made using a `TopicClient` object. + + + ## Topics methods ### Subscribe @@ -47,15 +53,6 @@ Publishes a message to a topic. | topicName | String | Name of the topic to publish the value to. | | value | String / bytes | Value to publish to the topic. | - - - This is example code. - - - Coming soon. - - -
Method response object @@ -68,12 +65,6 @@ See [response objects](./response-objects.md) for specific information. -## TopicClient - -Instead of the CacheClient, as used in most Momento Cache API calls, for Topics you use a TopicClient object. - - - ## Example apps using Momento Topics APIs A growing list of example apps using the Momento Topics. diff --git a/docs/topics/develop/sdks/dart/index.md b/docs/topics/develop/sdks/dart/index.md index b0d5a2395..659d69cdb 100644 --- a/docs/topics/develop/sdks/dart/index.md +++ b/docs/topics/develop/sdks/dart/index.md @@ -21,9 +21,3 @@ The Momento Dart SDK and source code are available via GitHub: [momentohq/client - [Dart SDK cheat sheet](./cheat-sheet.mdx) - [Dart SDK examples](https://github.com/momentohq/client-sdk-dart/tree/main/example): working example projects that illustrate how to use the Dart SDK -- COMING SOON: Observability: Logging and client-side metrics with the Dart SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the Dart SDK - -## Integrations - -COMING SOON diff --git a/docs/topics/develop/sdks/dotnet/index.md b/docs/topics/develop/sdks/dotnet/index.md index 83b26f568..b24fb53d6 100644 --- a/docs/topics/develop/sdks/dotnet/index.md +++ b/docs/topics/develop/sdks/dotnet/index.md @@ -22,10 +22,7 @@ The source code can be found on GitHub: [momentohq/client-sdk-dotnet](https://gi ## Resources -- COMING SOON: .NET SDK Cheat Sheet - [.NET SDK Examples](https://github.com/momentohq/client-sdk-dotnet/blob/main/examples/README.md): working example projects that illustrate how to use the .NET SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the .NET SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the .NET SDK ## Integrations diff --git a/docs/topics/develop/sdks/elixir/index.md b/docs/topics/develop/sdks/elixir/index.md index 92c719ef9..a63188e40 100644 --- a/docs/topics/develop/sdks/elixir/index.md +++ b/docs/topics/develop/sdks/elixir/index.md @@ -20,9 +20,3 @@ The source code can be found on GitHub: [momentohq/client-sdk-elixir](https://gi ## Resources - [Elixir SDK examples](https://github.com/momentohq/client-sdk-elixir/blob/main/examples/README.md): working example projects that illustrate how to use the Elixir SDK -- COMING SOON: Observability: Logging and client-side metrics with the Elixir SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the Elixir SDK - -## Integrations - -COMING SOON diff --git a/docs/topics/develop/sdks/go/index.md b/docs/topics/develop/sdks/go/index.md index 447f1f37e..4417d2100 100644 --- a/docs/topics/develop/sdks/go/index.md +++ b/docs/topics/develop/sdks/go/index.md @@ -20,5 +20,3 @@ The source code can be found on GitHub: [momentohq/client-sdk-go](https://github ## Resources - [Go SDK Examples](https://github.com/momentohq/client-sdk-go/blob/main/examples/README.md): working example projects that illustrate how to use the Go SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Go SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Go SDK diff --git a/docs/topics/develop/sdks/java/index.md b/docs/topics/develop/sdks/java/index.md index 18a3d053d..03bdca064 100644 --- a/docs/topics/develop/sdks/java/index.md +++ b/docs/topics/develop/sdks/java/index.md @@ -21,9 +21,3 @@ The source code can be found on GitHub: [momentohq/client-sdk-java](https://gith ## Resources - [Java SDK Examples](https://github.com/momentohq/client-sdk-java/blob/main/examples/README.md): working example projects that illustrate how to use the Java SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Java SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Java SDK - -## Integrations - -COMING SOON diff --git a/docs/topics/develop/sdks/kotlin/index.md b/docs/topics/develop/sdks/kotlin/index.md index c90c2fd7d..529bf7f98 100644 --- a/docs/topics/develop/sdks/kotlin/index.md +++ b/docs/topics/develop/sdks/kotlin/index.md @@ -21,9 +21,3 @@ The source code can be found on GitHub: [momentohq/client-sdk-kotlin](https://gi ## Resources - [Kotlin SDK Examples](https://github.com/momentohq/client-sdk-kotlin/blob/main/examples/README.md): working example projects that illustrate how to use the Kotlin SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Kotlin SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Kotlin SDK - -## Integrations - -COMING SOON diff --git a/docs/topics/develop/sdks/nodejs/images/grafana_screenshot.png b/docs/topics/develop/sdks/nodejs/images/grafana_screenshot.png deleted file mode 100644 index acf0cdf2f..000000000 Binary files a/docs/topics/develop/sdks/nodejs/images/grafana_screenshot.png and /dev/null differ diff --git a/docs/topics/develop/sdks/nodejs/images/prometheus_screenshot.png b/docs/topics/develop/sdks/nodejs/images/prometheus_screenshot.png deleted file mode 100644 index 794f9db87..000000000 Binary files a/docs/topics/develop/sdks/nodejs/images/prometheus_screenshot.png and /dev/null differ diff --git a/docs/topics/develop/sdks/nodejs/images/zipkin_screenshot.png b/docs/topics/develop/sdks/nodejs/images/zipkin_screenshot.png deleted file mode 100644 index b5c15f96b..000000000 Binary files a/docs/topics/develop/sdks/nodejs/images/zipkin_screenshot.png and /dev/null differ diff --git a/docs/topics/develop/sdks/nodejs/index.md b/docs/topics/develop/sdks/nodejs/index.md index 10ed0d819..41ef3d0bb 100644 --- a/docs/topics/develop/sdks/nodejs/index.md +++ b/docs/topics/develop/sdks/nodejs/index.md @@ -1,12 +1,12 @@ --- sidebar_position: 1 -title: Momento Topics Node.js SDK +title: Momento Node.js SDK pagination_prev: null sidebar_label: Node.js description: Information about the Momento Node.js SDK --- -# Momento Topics Node.js SDK +# Momento Node.js SDK - Topic Client The Momento Node.js SDK is available via the npm package [`@gomomento/sdk`](https://www.npmjs.com/package/@gomomento/sdk). @@ -15,12 +15,13 @@ The source code can be found on GitHub: [momentohq/client-sdk-javascript](https: ## Requirements - Node version [14 or higher](https://nodejs.org/en/download/) is required. -- A Momento API key is required; you can get one from the [Momento Web Console](https://console.gomomento.com/). +- A Momento API Key is required; you can get one from the [Momento Web Console](https://console.gomomento.com/). ## Resources -- [Node.js SDK cheat sheet](./cheat-sheet.mdx) +- [Node.js SDK Topics Cheat Sheet](./cheat-sheet.mdx) - [Node.js SDK Examples](https://github.com/momentohq/client-sdk-javascript/blob/main/examples/nodejs/README.md): working example projects that illustrate how to use the Node.js SDK + +## Integrations + - [Node.js Token Vending Machine](https://github.com/momentohq/client-sdk-javascript/tree/main/examples/nodejs/token-vending-machine): provides temporary, restricted scope Momento Auth tokens that can be used by browsers running apps written against the [Momento Web SDK](https://github.com/momentohq/client-sdk-javascript/tree/main/packages/client-sdk-web). -- [Node.js SDK Observability](./observability.mdx): Logging and Client-side Metrics with the Node.js SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Node.js SDK diff --git a/docs/topics/develop/sdks/nodejs/observability.mdx b/docs/topics/develop/sdks/nodejs/observability.mdx deleted file mode 100644 index e90182cfa..000000000 --- a/docs/topics/develop/sdks/nodejs/observability.mdx +++ /dev/null @@ -1,81 +0,0 @@ ---- -sidebar_position: 3 -sidebar_label: Observability -title: Observability for TypeScript and Node.js -description: Instrument your Momento-enabled Node.js code with Logs, Metrics, and Traces ---- - -import { SdkExampleCodeBlock } from "@site/src/components/SdkExampleCodeBlock"; -// This import is necessary even though it looks like it's un-used; The inject-example-code-snippet -// plugin will transform instances of SdkExampleCodeBlock to SdkExampleCodeBlockImpl -import { SdkExampleCodeBlockImpl } from "@site/src/components/SdkExampleCodeBlockImpl"; - -# Observability with Momento in Node.js - -## Logging - -Our goal for all of the Momento SDKs is to make sure that developers can direct Momento log output to the same destination that they are using for the rest of their application logs; therefore, we aim to be compatible with all of the popular logging frameworks for a given programming language. - -There are many different logging libraries available for node.js. Some popular ones include: - -- [Pino](https://github.com/pinojs/pino) -- [Winston](https://github.com/winstonjs/winston) -- [Bunyan](https://github.com/trentm/node-bunyan) -- [Morgan](https://github.com/expressjs/morgan) - -To ensure that Momento is compatible with all of these libraries (and more!), we provide a light-weight logging facade that you can use to wrap your favorite logging client. To use it, you simply need to implement the `MomentoLoggerFactory` and `MomentoLogger` interfaces: - - - -Your implementation will just be a thin wrapper around your logging library of choice. We provide a complete, working example implementation that uses the [`pino`](https://github.com/pinojs/pino) logger; you can find the [source code for that here](https://github.com/momentohq/client-sdk-javascript/blob/main/examples/nodejs/observability/pino-logger.ts). - -Once you have defined your `MomentoLoggerFactory` and `MomentoLogger`, the last step is to configure your Momento client to use your preferred logger, like this: - - - -Then you should see log messages from Momento coming through your pino logging environment. In this case you should see log messages that look like this: - -``` -[1685649962168] INFO (CacheClient/4386 on mycomputer.local): Creating Momento CacheClient -[1685649962168] INFO (ControlClient/4386 on mycomputer.local): Creating cache: test-cache -``` - -## Metrics -Metrics are measurements that provide quantitative information about system performance and behavior. They are numerical values captured and recorded over regular intervals, providing statistical data to aid in understanding the trends and patterns in a system. - -For Momento specifically, you might desire to capture metrics on the number of requests made, their duration, request or response size, or failure rates. Capture these in the Node.js SDK using a middleware, which intercepts the Momento gRPC calls and responses. Here is an example that uses OpenTelemetry and Prometheus to capture request count faceted by request type: - -First, set up metrics in your application: - - - -Then, create a middleware that captures the metric: - - - -When you create the Momento `CacheClient`, add the middleware and the metric will be incremented with each request: - - - -Here is an example of the Grafana UI displaying a graph of get and set requests made against Momento: -![image](./images/grafana_screenshot.png) - -## Traces -Traces provide a detailed timeline of processes within an application, showing the relationship between different components and services involved in a specific request or operation. They allow developers to analyze the sequence and duration of these operations, facilitating a better understanding of how data flows through the system. - -The Momento Node.js SDK uses gRPC internally to communicate with the Momento servers. OpenTelemetry provides a capability for auto-instrumenting all gRPC calls with traces. You don't need to add any middleware code to produce these traces, like you do for the metrics. Here is an example that automatically generates traces for these calls and exports them to Zipkin: - - - -This needs to run before any Momento code. - -Here is an example of the Zipkin UI displaying traces for a cache creation, a get, and a set: -![image](./images/zipkin_screenshot.png) - -If the performance of your application is impacted by trace generation, you should consider sampling them to cut down on the number of traces generated. You can do this with OpenTelemetry by setting two environment variables: - -```cli -export OTEL_TRACES_SAMPLER="traceidratio" -export OTEL_TRACES_SAMPLER_ARG="0.1" -``` -Setting these will ensure that only 10% of traces are created. diff --git a/docs/topics/develop/sdks/php/index.md b/docs/topics/develop/sdks/php/index.md index 74d171ef6..c2e7e5b01 100644 --- a/docs/topics/develop/sdks/php/index.md +++ b/docs/topics/develop/sdks/php/index.md @@ -21,8 +21,6 @@ The source code can be found on GitHub: [momentohq/client-sdk-php](https://githu ## Resources - [PHP SDK examples](https://github.com/momentohq/client-sdk-php/blob/main/examples/README.md): working example projects that illustrate how to use the PHP SDK -- COMING SOON: Observability: logging and client-side metrics with the PHP SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the PHP SDK ## Integrations diff --git a/docs/topics/develop/sdks/python/index.md b/docs/topics/develop/sdks/python/index.md index 0409c131c..16d00aed1 100644 --- a/docs/topics/develop/sdks/python/index.md +++ b/docs/topics/develop/sdks/python/index.md @@ -20,5 +20,3 @@ The source code can be found on GitHub: [momentohq/client-sdk-python](https://gi ## Resources - [Python SDK Examples](https://github.com/momentohq/client-sdk-python/blob/main/examples/README.md): working example projects that illustrate how to use the Python SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Python SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Python SDK diff --git a/docs/topics/develop/sdks/ruby/index.md b/docs/topics/develop/sdks/ruby/index.md index 9020149f0..bac209f26 100644 --- a/docs/topics/develop/sdks/ruby/index.md +++ b/docs/topics/develop/sdks/ruby/index.md @@ -19,11 +19,4 @@ The source code can be found on GitHub: [momentohq/client-sdk-ruby](https://gith ## Resources -- COMING SOON: Ruby SDK Cheat Sheet - [Ruby SDK Examples](https://github.com/momentohq/client-sdk-ruby/blob/main/examples/README.md): working example projects that illustrate how to use the Ruby SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Ruby SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Ruby SDK - -## Integrations - -COMING SOON diff --git a/docs/topics/develop/sdks/rust/index.md b/docs/topics/develop/sdks/rust/index.md index 9e08f34f1..5613cd36f 100644 --- a/docs/topics/develop/sdks/rust/index.md +++ b/docs/topics/develop/sdks/rust/index.md @@ -18,11 +18,4 @@ The source code can be found on github: [momentohq/client-sdk-rust](https://gith ## Resources -- COMING SOON: Rust SDK Cheat Sheet - [Rust SDK Examples](https://github.com/momentohq/client-sdk-rust/blob/main/example/README.md): working example projects that illustrate how to use the Rust SDK -- COMING SOON: Observability: Logging and Client-side Metrics with the Rust SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Rust SDK - -## Integrations - -COMING SOON diff --git a/docs/topics/develop/sdks/swift/index.md b/docs/topics/develop/sdks/swift/index.md index fe92bf582..b4f8fbbb7 100644 --- a/docs/topics/develop/sdks/swift/index.md +++ b/docs/topics/develop/sdks/swift/index.md @@ -19,9 +19,3 @@ The Momento Swift SDK and source code are available via GitHub: [momentohq/clien - [Swift SDK cheat sheet](./cheat-sheet.mdx) - [Swift SDK examples](https://github.com/momentohq/client-sdk-swift/tree/main/Examples): working example projects that illustrate how to use the Swift SDK -- COMING SOON: Observability: Logging and client-side metrics with the Swift SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the Swift SDK - -## Integrations - -COMING SOON diff --git a/docs/topics/develop/sdks/web/index.md b/docs/topics/develop/sdks/web/index.md index 413ac3020..d7961c684 100644 --- a/docs/topics/develop/sdks/web/index.md +++ b/docs/topics/develop/sdks/web/index.md @@ -33,7 +33,6 @@ The source code can be found on GitHub: [momentohq/client-sdk-javascript](https: - [Chat app: Next.js](https://github.com/momentohq/client-sdk-javascript/tree/main/examples/web/nextjs-chat): a dynamic app that allows users to chat in their browser by entering a cache and topic name. The application vends low scope, short-lived auth tokens to the browser which uses them to subscribe to the topic. - [Chat app: Vite](https://github.com/momentohq/client-sdk-javascript/tree/main/examples/web/vite-chat-app): a static version of the chat app that requires a separate API (such as our [Node.js token vending machine](https://github.com/momentohq/client-sdk-javascript/tree/main/examples/nodejs/token-vending-machine)) to provide auth tokens to browsers. - [Web SDK Examples](https://github.com/momentohq/client-sdk-javascript/blob/main/examples/web/README.md): working example projects that illustrate how to use the web SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the web SDK ## Momento web SDK and Momento Topics diff --git a/docs/vector-index/develop/sdks/nodejs/index.md b/docs/vector-index/develop/sdks/nodejs/index.md index a5d8703e0..d1c32a084 100644 --- a/docs/vector-index/develop/sdks/nodejs/index.md +++ b/docs/vector-index/develop/sdks/nodejs/index.md @@ -21,4 +21,3 @@ The source code can be found on GitHub: [momentohq/client-sdk-javascript](https: - [Node.js MVI SDK cheat sheet](./cheat-sheet.md) - [Node.js SDK Examples](https://github.com/momentohq/client-sdk-javascript/blob/main/examples/nodejs/README.md): working example projects that illustrate how to use the Node.js SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Node.js SDK diff --git a/docs/vector-index/develop/sdks/python/index.md b/docs/vector-index/develop/sdks/python/index.md index f3419bfaf..602048a71 100644 --- a/docs/vector-index/develop/sdks/python/index.md +++ b/docs/vector-index/develop/sdks/python/index.md @@ -20,5 +20,3 @@ The source code can be found on GitHub: [momentohq/client-sdk-python](https://gi ## Resources - [Python SDK Examples](https://github.com/momentohq/client-sdk-python/blob/main/examples/README.md): working example projects that illustrate how to use the Python SDK with Momento Vector Index. -- COMING SOON: Observability: Logging and Client-side Metrics with the Python SDK -- COMING SOON: Taking your code to prod: Configuration and Error handling in the Python SDK diff --git a/docs/vector-index/develop/sdks/web/index.md b/docs/vector-index/develop/sdks/web/index.md index b446db75f..27797e270 100644 --- a/docs/vector-index/develop/sdks/web/index.md +++ b/docs/vector-index/develop/sdks/web/index.md @@ -31,8 +31,6 @@ The source code can be found on GitHub: [momentohq/client-sdk-javascript](https: - [Momento Node.js cheat sheet](./../nodejs/cheat-sheet.md): this cheat sheet targets the Node.js SDK, but the web SDK APIs are fully compatible. - [Web SDK Examples](https://github.com/momentohq/client-sdk-javascript/blob/main/examples/web/README.md): working example projects that illustrate how to use the web SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the web SDK - ## Using the web SDK for browsers diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/cache/develop/sdks/swift/index.md b/i18n/ja/docusaurus-plugin-content-docs/current/cache/develop/sdks/swift/index.md index afc0b8a47..3b49f54c9 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/cache/develop/sdks/swift/index.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/cache/develop/sdks/swift/index.md @@ -21,9 +21,3 @@ The Momento Swift SDK and source code are available via GitHub: [momentohq/clien - [Swift SDK cheat sheet](./cheat-sheet.mdx) - [Swift SDK examples](https://github.com/momentohq/client-sdk-swift/tree/main/Examples): working example projects that illustrate how to use the Swift SDK -- COMING SOON: Observability: Logging and client-side metrics with the Swift SDK -- COMING SOON: Taking your code to prod: configuration and error handling in the Swift SDK - -## Integrations - -COMING SOON diff --git a/plugins/example-code-snippets/src/examples/resolvers/source-parsers/languages/javascript-snippet-source-parser.ts b/plugins/example-code-snippets/src/examples/resolvers/source-parsers/languages/javascript-snippet-source-parser.ts index 694d97565..607ca5b8d 100644 --- a/plugins/example-code-snippets/src/examples/resolvers/source-parsers/languages/javascript-snippet-source-parser.ts +++ b/plugins/example-code-snippets/src/examples/resolvers/source-parsers/languages/javascript-snippet-source-parser.ts @@ -16,6 +16,7 @@ export class JavascriptSnippetSourceParser extends RegexSnippetSourceParser { 'examples/nodejs/aws/doc-example-files/doc-examples-js-aws-secrets.ts', 'examples/nodejs/vector-index/doc-example-files/doc-examples-nodejs-apis.ts', 'examples/nodejs/cache/doc-example-files/collection-ttl.ts', + 'examples/nodejs/cache/doc-example-files/config-and-error-handling.ts', ]; super({ wholeFileExamplesDir: path.join(repoSourceDir, wholeFileExamplesDir),