How Do I Know If i'm Hitting My Cosmodb Limits?

Author: aronchick

Originally Sourced from:

I have a very standard executable that I integration test often. However, every so often, it flakes out on the second execution. It's doing it async, so I think one of two things may be happening:

  1. I'm hitting my throughput limits
  2. It's not responding quickly enough, and I should block on my async call until I get a response.

I know how to address the second, but before I do so, I need to check if I'm hitting my cosmo limits. How do I do so?

The code isn't very interesting, but here you go. Like I said, absolutely nothing changes in the first two calls, but the second one fails maybe once every 5th time I run it. It's in a test environment:

def execute_query(self, query, return_node=False):
    logging.debug(f"Inside the execute query: {query}")
    callback = self._gremlin_client.submitAsync(query)
    result = None
    if callback.result() is not None:
        result = callback.result().one()
        logging.debug("Something went wrong with this query: {0}".format(query))
    if return_node:
        return result[0]

query = "g.V().drop()"
execute_query(query)  # <= Executes every time

query = "g.addV('workflow').property('id', '0.0.1').property('workflow_id', '29b6c480-8392-42c4-8fc5-f0f02bdd3636')"
execute_query(query)  # <= Has no result 1 out of 5 times