now I'm going to talk about some of the bits that we're doing to help you make sure that your spend on the infrastructure to operate that observability platform doesn't balloon out of control so first I'm going to talk about some of the changes that we're making on the cloud metrics side so uh when we hear on the metric side from a lot of our users is hey I see the number of Time series that I'm storing in my tsdb continuing to climb especially as I on board more and more teams at my company but I
I'm not necessarily necessarily seeing better outcomes it's not like I'm able to root cause things faster and in fact many teams that we talked to say hey I am pretty sure that most of these time series are just never being looked at someone's writing them I'm storing them but just you know no one ever bothers to query them back so we've set out on a mission to understand is is that really the case is it true that much of the data that's being stored in this tstb is not actually ever getting used so to do
this we built some tooling that's going to analyze the metrics coming into graphana cloud and then compare it to how users are accessing these metrics and if you think about looking at access patterns there's really three signals that you have to look at doing this kind of analysis one are the metrics being used in an alerting or recording rule two are they being used to power a dashboard and three we look at 30 days of query logs so that's going to catch If a metric is being accessed either VR API maybe someone wrote a script
or if someone's using the grafana Explorer View for each metric then we're able to determine how it's being used what type of functions are we performing to it what labels are being used as selectors to slice and dice it or to group it up and what do we see we see that metrics fall then into three categories from here there are some that are totally unused there's been no reference made to it based on any of those three signals some are partially used where we do see the metric being accessed but there's a ton of
labels being used to segment that metric into many many time series and people are only using a subset of them or the third category where we see the metric is being completely used so all the labels on that metric are being used to slice and dice it and now what I'm going to do is go through an example of each we've run this tooling on our own Ops cluster and that's what I'm going to use to kind of walk through the whole flow so one here's the very the simplest example to explain here's a metric
API server audit event total it's creating 3 000 time series in our tstb and it is not present in any alerts recording rules dashboards and no one has queried it in the last 30 days set bug number two the metric is being used but we don't actually see that all the detail is needed so for this uh receive samples total metric that's creating 975 000 time series in our tstb we see it's present in some alerting rules in a dashboard and it's being querred however when we look across all of those access patterns what we
see is that actually only four of the six labels on that metric are ever being used to individually access the time series you can see kind of what I boxed here and you can see that we're using user and cluster as selectors and when we're doing some some operations we're aggregating over you know cluster and job but no one's ever bothering to look at the time series on a per instance and a per pod granularity and then bucket three this is a case where all the time series under the parent metric are being used so
for this gateway to request duration seconds count which is creating 2000 time series uh we see that it's not being used in any alerts or dashboards but it is being queried and when we look across all of those 73 queries we see that all labels are being used in some capacity the set of unused labels is empty all right great uh when we ran this analysis on our own environment we did see that a surprising number of metrics fell into that category one or two meeting either they're unused or only a subset of their labels
are being used okay now what am I supposed to do with this information the sort of easy option is that you could just start throwing out a lot of these metrics wholesale you say hey it's not very useful just completely wipe it away but we wanted to give you something better than the hatchet approach of dropping the whole metric and we wanted to be able to realize some savings on these partially in use metrics without making you re-architect how you label your metrics so we built some tooling that's a next stage that's going to give
you a way to take these metrics and turn them into lower cardinality versions of themselves now we're not the first to come up with this concept of aggregation other time series databases do have this but we're the first to make it easy for you to know what to aggregate based on your own unique usage patterns now let's go through an example of how this works let's take our nice friend the first unused metric API server audit event total this metric was totally unused so we have to actually make a guess on how best to aggregate
it because we have no historic usage pattern that no one's using it so what are we going to do we're going to suggest an aggregation that is going to decrease the cardinality of that metric by looking at the labels on this metric and looking for the high cardinality ones we look at both the cardinality of the labels so how many values does it have and the churn how long is that time series alive for and what we're going to do is we're going to recommend rolling up high churn or high cardinality labels and as Tom
mentioned in the keynote what we think is really neat about this is that we're able to reduce the cardinality of this particular metric by a ton but we're able to retain a lower Fidelity version of that metric in our tsdb so you know even if it's not in use today maybe at some point in the future it will come in handy and this is what we think of as efficiency right a balance between cost savings and still maintaining the ability to answer questions about your system in the second case where we saw in the metric
is used but not all the labels being used on it this is actually the easier case because we can suggest an aggregation that ensures that the existing access patterns are all honored and we're just getting rid of the labels that are never touched so in our case we saw instance in pod were never used so we can aggregate away those labels giving you a savings there reducing cardinality but leaving in place all the other labels that you would use for your accesses and so again what do we do we're able to roll up this metric
to a fraction of what it was but everything that you needed to know from before will still complete and you yourself have to make no changes to your dashboards or alerts they will continue to execute now when I talk to our Engineers about this there was some concern because they say sure I haven't used this label in the last 30 days but you know what if I want it in two days three days what if there's an incident next week that it's important well we get it observability is not static so what we can do
today with the aggregations is that we provide a way to unapply them and so here's an example with a metric we had incident request duration seconds bucket where we had an aggregation applied the developer comes to us and said is hey actually I want to break this method down by or break this metric down by method which was a label we'd previously been aggregating away we unapply the aggregation and then you can see the cardinality of the metric pops back up and suddenly now they're empowered to answer this question they want we are giving them
back the Fidelity on the metric so they can continue with their analysis and this is what we call good cardinality right it's being used to answer a question about the system so we've used this already in our own internal environment to great success we are actively able to reduce the cardinality of our internal Ops cluster by 39 that's the Delta between how many series are being sent to the time series database and then how many time series get persisted and we actually believe that we can go significantly further than that because we right now only
have a subset of aggregation operations that we can do right now we're actively able to sum away certain labels but we're looking at applying more functions Max Min average so you can have a variety of aggregations represented on certain metrics and we think we could probably get this even higher today we're extremely conservative in what we recommend which means that if a metric is queried even once a label is touched even once we say okay don't touch it but you could see in the future that you might say okay if someone only issued a query
for this once and it's not in a dashboard like we could probably get rid of it so as we are able to more intelligently improve our heuristics for what we suggest to roll up we think we can get that savings number even higher and what we're most proud of here is that we're able to realize savings for you but doing it in a way that we aren't eliminating your ability to answer questions about your systems