API Metrics : send context type, not context name

Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
Guillaume Tardif 2020-09-25 16:26:48 +02:00
parent fbe505f27f
commit 7807fb33cc
6 changed files with 45 additions and 23 deletions

View file

@ -44,10 +44,16 @@ func New(ctx context.Context) (*Client, error) {
return nil, err
}
return &Client{
backendType: cc.Type(),
client := NewClient(cc.Type(), service)
return &client, nil
}
// NewClient returns new client
func NewClient(backendType string, service backend.Service) Client {
return Client{
backendType: backendType,
bs: service,
}, nil
}
}
// GetCloudService returns a backend CloudService (typically login, create context)
@ -61,6 +67,11 @@ type Client struct {
bs backend.Service
}
// ContextType the context type associated with backend
func (c *Client) ContextType() string {
return c.backendType
}
// ContainerService returns the backend service for the current context
func (c *Client) ContainerService() containers.Service {
if cs := c.bs.ContainerService(); cs != nil {