Creating Grafana Annotations with InfluxDb

Published: August 8, 2016

When reviewing historical data in tools such as InfluxDb, it’s typically useful to overlay a timeline of key events. For example, Google Analytics features a simple GUI for adding annotations and New Relic offers an API for marking deployments. In this post we’ll look at creating annotations for your InfluxDb powered Grafana visualizations.

One "Weird Trick" To Instantly Break usesSource

Published: August 5, 2016

As you might know, Magento features several frontend input types for catalog attributes. For example the “New From Date” attribute, is stored as DATETIME in the catalog_product_entity_datetime table, whereas the product’s “Name” is stored as VARCHAR(255) in the catalog_product_entity_varchar table.

For both of these attribute types, the values can be pulled directly from the db and are ready to display to the end user with no further manipulation. However, there are a couple types which are initially stored numerically (e.g. in catalog_product_entity_int) and need to be translated via eav_attribute_option and eav_attribute_option_value before they are ready to be displayed to the end user.

There is a method in Mage_Eav_Model_Entity_Attribute_Abstract (an ancestor of Mage_Catalog_Model_Resource_Eav_Attribute) called usesSource. It is uncommented, but at first glance it looks like it can reliably used to determine whether or not an attribute’s values need to be translated in that way…

public function usesSource()
    return $this->getFrontendInput() === 'select' || $this->getFrontendInput() === 'multiselect'
        || $this->getData('source_model') != '';

However, as I learned the hard way, there’s this “one weird trick” that will cause usesSource to return true no matter what.

Magento Enterprise_Index Lesson #329 - Don't TRUNCATE the _cl tables

Published: July 29, 2016

I’ve been looking into a problem recently that was reported by the client as follows…

“Sold out products continue to show as in stock, until I go into the Magento admin, mark the product as out of stock and save it.”

The issue took a lot of time to diagnose, but ended up with a really interesting discovery.

Don’t TRUNCATE the _cl tables (and no, it wasn’t me who did it here, although I’m pretty sure I’m guilty of doing so in other places).

Let me explain why.

Using Kapacitor UDFs to monitor URL query parameter usage

Published: July 26, 2016

Page caching implementations such as Varnish store unique cache entries for each URL. This makes sense…in theory each URL should identify a unique resource. However, advertising platforms such as Google Adwords need to be able to track the behavior of users that enter your site through their ads. To do this, they add their own unique identifier to the URL (e.g. “gclid”, “gdftrk”). If nothing is done about this, traffic entering your site through these platforms will never hit the cache (on the first page load). What would happen if your site experienced a surge of traffic using these unique identifiers? Can your infrastructure handle a sudden burst of requests for uncached pages?

Monitoring the Magento Cron with InfluxDb

Published: July 12, 2016

The Magento cron has a nasty habit of getting stuck. Ideally this wouldn’t happen, but it’s a fact of life.

Ultimately, if you have a site where cron is getting stuck frequently you’re going to want to spend some time diagnosing the root cause. That being said, in all cases, it’s probably a good idea to have something in place that will tell you if and when the Magento cron gets stuck…even on sites where it has never happened to you before.

We’ve implemented a good system for doing this at Something Digital. We’re using two tools from the “TICK” stack - InfluxDb, a time-series database which we use to store data from cron_schedule, and Kapacitor, an agent that runs alongside InfluxDb and can stream or batch query data and react to it (e.g. send alerts). In this post I’ll outline our set up.

NOTE: Magento 2 has significantly improved reliability of cron through new features such as groups (which are actually available in Magento 1 if you use Aoe_Scheduler) and the ability to parallelize jobs with the use_separate_process setting. That being said, cron is always mission critical and there's never a case where you shouldn't be monitoring it.

Monitoring Magento FPC Hit Rate

Published: June 16, 2016

We’ve been breaking some new ground (at least from what I can see in my Google searches) at Something Digital with the work we’ve been doing to monitor, and improve, FPC hit rate using Enterprise_PageCache on our client’s sites. I’ll likely publish a few posts related to this topic, but the first thing I wanted to focus on is why, and how, you can track your FPC hit rate.