At Rockset, we frequently search for methods to present our prospects higher visibility into the product. Towards this objective, we not too long ago determined to enhance our customer-facing question logging. Our earlier iteration of question logs was primarily based in one in every of our shared providers known as apiserver. As a part of the work that apiserver would do when finishing a question execution request, it might create a log that might finally be ingested into the _events assortment. Nonetheless, there have been points that made us rethink this implementation of question logs:
- No isolation: as a result of the question logs in
_eventsrelied on shared providers, heavy site visitors from one org may have an effect on question logging in different orgs. - Incomplete logs: due to the problems prompted by utilizing shared providers, we solely logged question errors – profitable queries wouldn’t be logged. Moreover, it was not attainable for us to log knowledge about async queries.
- No skill to debug question efficiency – the question logs in
_eventssolely contained fundamental details about every question. There was no approach for the person to get details about why a given question might have run slowly or exhausted compaute sources for the reason that logs contained no details about the question plan.
Improved Question Logging
The brand new question logs characteristic addresses all of those points. The mechanisms that deal with question logs are contained totally inside your Digital Occasion versus being inside one in every of Rockset’s shared providers. This offers question logs the benefit of isolation. Moreover, each question you submit might be robotically logged if in case you have already created a set with a question logs supply (supplied you don’t hit a price restrict).
How Question Logs Work
Question logging begins on the finish of question execution. As a part of the steps which might be run within the remaining aggregator when a question has accomplished, a document containing metadata related along with your question is created. At this level, we might also have to gather data from different aggregators that have been concerned within the question. After that is completed, the document is briefly saved in an in-memory buffer. The contents of this buffer are flushed to S3 each few seconds. As soon as question logs have been dumped to S3, they are going to be ingested into any of your question log collections which were created.
INFO vs DEBUG Logs
After we first designed this challenge, we had all the time meant for it to work with the question profiler within the console. This is able to permit our prospects to debug question bottlenecks with these logs. Nonetheless, the question profiler requires fairly a bit of information, which means it might be inconceivable for each question log to comprise all the data obligatory for the profiler. To resolve this downside, we opted to create two tiers of question logs – INFO and DEBUG logs.
INFO logs are robotically created for each question issued by your org. They comprise some fundamental metadata related along with your question however can’t be used with the question profiler. When you recognize that you could be need to have the flexibility to debug a sure question with the profiler, you’ll be able to specify a DEBUG log threshold along with your question request. If the question execution time is bigger than the required threshold, Rockset will create each an INFO and a DEBUG log. There are two methods of specifying a threshold:
-
Use the
debug_log_threshold_msquestion traceSELECT * FROM _events HINT(debug_log_threshold_ms=1000) - Use the
debug_threshold_msparameter in API requests. That is accessible for each question and question lambda execution requests.
Observe that since DEBUG logs are a lot bigger than INFO logs, the speed restrict for DEBUG logs is way decrease. Because of this, it is suggested that you just solely present a DEBUG log threshold when you recognize that this data may very well be helpful. In any other case, you run the danger of hitting the speed restrict if you most want a DEBUG log.
System Sources
As a part of this challenge, we determined to introduce a brand new idea known as system sources. These are sources which ingest knowledge originating from Rockset. Nonetheless, in contrast to the _events assortment, collections with system sources are managed totally by your group. This lets you configure all the settings of those collections. We might be introducing extra system supply varieties as time goes on.
Getting Began with Question Logging
With a purpose to begin logging your queries, all you should do is create a set with a question logs supply. This may be completed via the console.
Rockset will start ingesting question logs into this assortment as you submit queries. Logs for the final 24 hours of queries may also be ingested into this assortment. Please be aware that it will probably take a couple of minutes after a question has accomplished earlier than the related log will present up in your assortment.
With a purpose to use the question profiler with these logs, open the Rockset Console’s question editor and problem a question that targets one in every of your question logs collections. The question editor will detect that you’re making an attempt to question a set with a question logs supply and a column known as ‘Profiler’ might be added to the question outcomes desk. Any paperwork which have a populated stats subject could have a hyperlink on this column. Clicking on this hyperlink will open the question profile in a brand new tab.
Observe that customized ingest transformations or question aliases can intervene with this performance so it is suggested that you don’t rename any columns.
For an in depth dive into utilizing Rockset’s Question Profiler, please consult with the video accessible right here.
Conclusion
Hopefully, this has given you a fast look into the performance that question logs can provide. Whether or not you should debug question efficiency or examine why beforehand accomplished queries have failed, your expertise with Rockset might be improved by making use of question logs.
