Ejemplo n.º 1
0
func (s *metricsAdderIntegrationSuite) SetUpTest(c *gc.C) {
	s.JujuConnSuite.SetUpTest(c)
	f := factory.NewFactory(s.State)
	machine0 := f.MakeMachine(c, &factory.MachineParams{
		Series: "quantal",
		Jobs:   []state.MachineJob{state.JobHostUnits},
	})

	meteredCharm := f.MakeCharm(c, &factory.CharmParams{
		Name: "metered",
		URL:  "cs:quantal/metered",
	})
	meteredService := f.MakeService(c, &factory.ServiceParams{
		Charm: meteredCharm,
	})
	meteredUnit := f.MakeUnit(c, &factory.UnitParams{
		Service:     meteredService,
		SetCharmURL: true,
		Machine:     machine0,
	})

	state, _ := s.OpenAPIAsNewMachine(c)
	s.adder = metricsadder.NewClient(state)
	s.unitTag = meteredUnit.Tag()
}
Ejemplo n.º 2
0
	"time"

	"github.com/juju/errors"
	"github.com/juju/loggo"

	"github.com/juju/juju/api/base"
	"github.com/juju/juju/api/metricsadder"
	"github.com/juju/juju/worker"
	"github.com/juju/juju/worker/dependency"
	"github.com/juju/juju/worker/metrics/spool"
)

var (
	logger               = loggo.GetLogger("juju.worker.metrics.sender")
	newMetricAdderClient = func(apiCaller base.APICaller) metricsadder.MetricsAdderClient {
		return metricsadder.NewClient(apiCaller)
	}
)

const (
	period = time.Minute * 5
)

// ManifoldConfig defines configuration of a metric sender manifold.
type ManifoldConfig struct {
	APICallerName   string
	MetricSpoolName string
}

// Manifold creates a metric sender manifold.
func Manifold(config ManifoldConfig) dependency.Manifold {
Ejemplo n.º 3
0
func (s *metricsAdderSuite) SetUpTest(c *gc.C) {
	s.JujuConnSuite.SetUpTest(c)
	s.adder = metricsadder.NewClient(s.APIState)
	c.Assert(s.adder, gc.NotNil)
}