Skip to content

Conversation

@mayorova
Copy link
Contributor

@mayorova mayorova commented Apr 23, 2025

Adding a document that describes the keys stored in Backend Redis (storage, not queues, because the latter is managed by resque).

@mayorova mayorova force-pushed the document-redis-keys branch from 5dbbbce to c19aead Compare April 24, 2025 13:32
@mayorova mayorova force-pushed the document-redis-keys branch from c19aead to 35c145f Compare April 24, 2025 13:34
Copy link
Contributor

@jlledom jlledom left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!! 🙏🙏

@akostadinov
Copy link
Contributor

Wow, this is amazing work! I would just suggest to mention that the two kinds of data are stored in separate Redis databases. Also would be nice to mention somewhere that the statistical data is generated based on API calls from apicast as well I think we had something on porta side that was sending stats about providers accessing porta.

@mayorova mayorova marked this pull request as ready for review April 25, 2025 07:19
@mayorova
Copy link
Contributor Author

Wow, this is amazing work!

Thank you! ❤️

I would just suggest to mention that the two kinds of data are stored in separate Redis databases.

That's not actually true. All of this data is stored in the same DB. I kind of mentioned that this document is talking about "storage", which is one DB. The other DB is called "queues", and it is managed by resque. I don't think we have anything "custom" there, but I'll double-check.

Also would be nice to mention somewhere that the statistical data is generated based on API calls from apicast as well I think we had something on porta side that was sending stats about providers accessing porta.

Well, actually, backend doesn't really care where the requests come from, the stats data are generated when usage is reported through authrep.xml or transactions.xml calls, it can be through APIcast, directly to the API (e.g. through ActiveDocs in the admin portal), or through some client - like in the case of ReportTrafficWorker in porta, which is what I guess you were referring to.

I can add a note in the doc to clarify that.

| `application/service_id:SERVICE_ID/id:APP_ID/plan_name` | SERVICE_ID, APP_ID | string | `application/service_id:2/id:593a8c1a/plan_name` | `"Test plan"` | Getting the plan name of the application by its app ID and service ID |
| `application/service_id:SERVICE_ID/id:APP_ID/state` | SERVICE_ID, APP_ID | string | `application/service_id:2/id:593a8c1a/state` | `"active"`, or `"pending"`, or `"suspended"` | Getting the state of the application by its app ID and service ID |
| `application/service_id:SERVICE_ID/id:APP_ID/keys` | SERVICE_ID, APP_ID | set | `application/service_id:2/id:593a8c1a/keys` | `1) "91efe8a356c83e94b40e54cce211a1a4"` | List of application keys associated to the application (for App Id / App Key mode) |
| `application/service_id:SERVICE_ID/id:APP_ID/redirect_url` | SERVICE_ID, APP_ID | string | `application/service_id:2/id:593a8c1a/redirect_url` | `"https://example.com/redirect"` | Redirect URL of the aplication (for application of services with OAuth/OpenID Connect auth mode) |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just added this line in the 2nd commit, the diff doesn't show it clearly because of reordering and fixing the columns widths.

@mayorova
Copy link
Contributor Author

@akostadinov hopefully I addressed your comments here: 57c5819

Copy link
Contributor

@akostadinov akostadinov left a comment

Choose a reason for hiding this comment

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

Extraordinary useful, thank you!

Just one suggestion if it makes sense to you.

### Stats

Stats keys hold the counters for application usage, reported through the Service Management API, specifically, `/transactions/authrep.xml`, `transactions/oauth_authrep.xml`, and `/transactions.xml` endpoints. For example, sending `usage[hits]=1` in authrep calls or `transactions[0][usage][hits]=1` in transaction calls will increase the counter for the metric "hits" by `1`.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This API is usually used by the respective provider API gateway (e.g. APIcast) to indicate buyer's usage of their APIs, as well by system/porta to indicate providers accessing system's API.

Hope this makes sense. Feel free to ignore or revert if it is not good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I expanded the explanation and pushed it in 0322a74

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also saw some issues with reporting Analytics API and opened a Jira: https://issues.redhat.com/browse/THREESCALE-11812

Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, good catch!

@mayorova mayorova merged commit af43cef into master Apr 29, 2025
11 checks passed
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.

4 participants