The state service provides a key-value storage that a Dynatrace App can use to store internal states. It allows essential data needed for the app's functioning to be stored in its context, either accessible to all users or confined to the specific user's context. These states are only accessible from their respective apps and can't be accessed using a different app or ad-hoc functions.
Alternatively, there is a storage system called the document service which is a better fit for use-cases where the information has the following characteristics
- Multiple users can collaborate on this data; it can be created, modified, or deleted by a user through the app UI
- The data set is very large (to learn more, visit Limitations)
User app states
You can use user app states to store information only relevant to a specific user and a specific app context. For example, storing minimal data concerning the configurable state of components used in your app. Thus, user app states can act as a "local storage" that transfers across sessions and devices used by that user.
Be aware that all users of the app can read app states. If your use-case allows for a user-scoped state, then the user app state is preferable as best practice.
App states are accessible to all users; therefore, you can share specific states essential to the app's context. For example, you can create a workflow that fetches third-party data into your app function. Your app stores this information in its app state. You can then query this in your app's browser code and see that it is visible to all your app users.
There are also use cases to write an app state in browser code. For example, the app can allow the user to share some meta information, only relevant in the context of this app, with other users.
Generic key-value-based state storage, where the key and value are simple strings, makes it possible for the app developer to manage the state design according to the specific needs of their app. For example, instead of using multiple small chunks of state, you can use one more significantly larger state as an alternative. In any case, below there are the limits that the app needs to abide by - any operation violating them will result in an error:
- User app states: At most, 16 states are allowed per app for every user. Each user app state value may be at a maximum of 32 KB. A user app state key may be a maximum of 200 characters long.
- App states: The sum of all values per app can't exceed 50 MB. A single app state value may be at a maximum of 10 MB. An app state key may be a maximum of 200 characters long.
Of course, it is possible to delete states to avoid an imminent quota violation.