private Metric.Context getDimensions(String source) {
        Metric.Context context = statePageOnlyContexts.get(source == null ? "" : source);
        if (context == null) {
            Map<String, String> dims = new HashMap<>();
            if (source != null) {
                dims.put("source", source);
            }
            context = this.metric.createContext(dims);
            statePageOnlyContexts.put(source == null ? "" : source, context);
        }
        // TODO add other relevant metric dimensions
        // Would be nice to have chain as a dimension as
        // we can separate errors from different chains
        return context;
    }
Creates error metric for StateHandler only. These metrics are only exposed on /state/v1/metrics page
and not forwarded to the log file.

@param result The result to check for errors
container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java