<commit_before>package uaa

type ZonedTokenLoader struct {
	uaaClient UAAClientInterface
}

type UAAClientInterface interface {
	ZonedGetClientToken(string) (string, error)
}

func NewZonedTokenLoader(uaaClient UAAClientInterface) *ZonedTokenLoader {
	return &ZonedTokenLoader{
		uaaClient: uaaClient,
	}
}

func (z *ZonedTokenLoader) Load(uaaHost string) (string, error) {
	token, err := z.uaaClient.ZonedGetClientToken(uaaHost)
	return token, err
}<commit_msg>Add back some logging of time to load a token [#97314780]<commit_after>package uaa

import (
	"time"

	"github.com/cloudfoundry-incubator/notifications/metrics"
)

type ZonedTokenLoader struct {
	uaaClient UAAClientInterface
}

type UAAClientInterface interface {
	ZonedGetClientToken(string) (string, error)
}

func NewZonedTokenLoader(uaaClient UAAClientInterface) *ZonedTokenLoader {
	return &ZonedTokenLoader{
		uaaClient: uaaClient,
	}
}

func (z *ZonedTokenLoader) Load(uaaHost string) (string, error) {
	then := time.Now()

	token, err := z.uaaClient.ZonedGetClientToken(uaaHost)

	duration := time.Now().Sub(then)

	metrics.NewMetric("histogram", map[string]interface{}{
		"name":  "notifications.external-requests.uaa.client-token",
		"value": duration.Seconds(),
	}).Log()
	return token, err
}
{'fraction_non_alphanumeric': 0.11067193675889328, 'fraction_numerical': 0.006324110671936759, 'mean_word_length': 6.234285714285714, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5364234', 'n_tokens_mistral': 446, 'n_tokens_neox': 443, 'n_words': 92}