metrics

package
v1.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IclaSignature = iota
	CclaSignature
	EmployeeSignature
	InvalidSignature
)

SignatureType constants

View Source
const (
	MetricTypeTotalCount             = "total_count"
	MetricTypeCompany                = "company"
	MetricTypeProject                = "project"
	MetricTypeClaManagerDistribution = "cla_manager_distribution"

	IDTotalCount             = "total_count"
	IDClaManagerDistribution = "cla_manager_distribution"
)

MetricType constants and ID constants

View Source
const (
	IndexMetricTypeSalesforceID = "metric-type-salesforce-id-index"
)

index

Variables

View Source
var (
	ErrMetricNotFound = errors.New("metric not found")
)

errors

View Source
var (
	LfMembers = make(map[string]interface{})
)

LfMembers contains names of LF members

Functions

func Configure

func Configure(api *operations.ClaAPI, service Service)

Configure setups handlers on api with service

Types

type ClaManagersDistribution added in v1.0.11

type ClaManagersDistribution struct {
	OneClaManager        int64  `json:"one_cla_manager"`
	TwoClaManager        int64  `json:"two_cla_manager"`
	ThreeClaManager      int64  `json:"three_cla_manager"`
	FourOrMoreClaManager int64  `json:"four_or_more_cla_manager"`
	CreatedAt            string `json:"created_at"`
}

ClaManagersDistribution tells distribution of number of cla mangers associated with company

type CompanyMetric added in v1.0.11

type CompanyMetric struct {
	ID                         string `json:"id"`
	CompanyName                string `json:"company_name"`
	ProjectCount               int64  `json:"project_count"`
	CorporateContributorsCount int64  `json:"corporate_contributors_count"`
	ClaManagersCount           int64  `json:"cla_managers_count"`
	CreatedAt                  string `json:"created_at"`
	// contains filtered or unexported fields
}

CompanyMetric contains all metrics related with particular company

type CompanyMetrics added in v1.0.11

type CompanyMetrics struct {
	CompanyMetrics map[string]*CompanyMetric
}

CompanyMetrics contain collection of all company metrics

type ItemCompany added in v1.0.13

type ItemCompany struct {
	CompanyID   string `json:"company_id"`
	CompanyName string `json:"company_name"`
}

ItemCompany represent item of companies table

type ItemGerritInstance added in v1.0.11

type ItemGerritInstance struct {
	ProjectID string `json:"project_id"`
}

ItemGerritInstance represent item of gerrit instance table

type ItemProject added in v1.0.11

type ItemProject struct {
	ProjectID         string `json:"project_id"`
	ProjectExternalID string `json:"project_external_id"`
	ProjectName       string `json:"project_name"`
}

ItemProject represent item of projects table

type ItemRepository added in v1.0.11

type ItemRepository struct {
	RepositoryProjectID string `json:"repository_project_id"`
}

ItemRepository represent item of repositories table

type ItemSignature added in v1.0.11

type ItemSignature struct {
	SignatureID            string   `json:"signature_id"`
	SignatureReferenceID   string   `json:"signature_reference_id"`
	SignatureReferenceName string   `json:"signature_reference_name"`
	SignatureACL           []string `json:"signature_acl"`
	SignatureUserCompanyID string   `json:"signature_user_ccla_company_id"`
	SignatureType          string   `json:"signature_type"`
	SignatureReferenceType string   `json:"signature_reference_type"`
	SignatureProjectID     string   `json:"signature_project_id"`
}

ItemSignature represent item of signature table

type Metrics added in v1.0.11

type Metrics struct {
	TotalCountMetrics       *TotalCountMetrics       `json:"total_metrics"`
	CompanyMetrics          *CompanyMetrics          `json:"company_metrics"`
	ProjectMetrics          *ProjectMetrics          `json:"project_metrics"`
	ClaManagersDistribution *ClaManagersDistribution `json:"cla_managers_distribution"`
	CalculatedAt            string                   `json:"calculated_at"`
}

Metrics contain all metrics related to easycla

type ProjectMetric added in v1.0.11

type ProjectMetric struct {
	ID                          string `json:"id"`
	SalesforceID                string `json:"salesforce_id,omitempty"`
	CompaniesCount              int64  `json:"companies_count"`
	ClaManagersCount            int64  `json:"cla_managers_count"`
	CorporateContributorsCount  int64  `json:"corporate_contributors_count"`
	IndividualContributorsCount int64  `json:"individual_contributors_count"`
	TotalContributorsCount      int64  `json:"total_contributors_count"`
	RepositoriesCount           int64  `json:"repositories_count"`
	CreatedAt                   string `json:"created_at"`
	ExternalProjectID           string `json:"external_project_id"`
	ProjectName                 string `json:"project_name"`
	// contains filtered or unexported fields
}

ProjectMetric contains all metrics related with particular project

type ProjectMetrics added in v1.0.11

type ProjectMetrics struct {
	ProjectMetrics map[string]*ProjectMetric
}

ProjectMetrics contain collection of all project metrics

type Repository added in v1.0.11

type Repository interface {
	CalculateAndSaveMetrics() error
	GetClaManagerDistribution() (*ClaManagersDistribution, error)
	GetTotalCountMetrics() (*TotalCountMetrics, error)
	GetCompanyMetrics() ([]*CompanyMetric, error)
	GetProjectMetrics(pageSize int64, nextKey string) ([]*ProjectMetric, string, error)
	GetCompanyMetric(companyID string) (*CompanyMetric, error)
	GetProjectMetric(projectID string) (*ProjectMetric, error)
	GetProjectMetricBySalesForceID(salesforceID string) ([]*ProjectMetric, error)
}

Repository provides methods for calculation,storage and retrieval of metrics

func NewRepository added in v1.0.11

func NewRepository(awsSession *session.Session, stage string, apiGwURL string) Repository

NewRepository creates new metrics repository

type Service

type Service interface {
	GetMetrics(params metrics.GetMetricsParams) (*models.Metrics, error)
	GetCLAManagerDistribution() (*models.ClaManagerDistribution, error)
	GetTotalCountMetrics() (*models.TotalCountMetrics, error)
	GetCompanyMetric(companyID string) (*models.CompanyMetric, error)
	GetProjectMetric(projectID string, idType string) (*models.SfProjectMetric, error)
	GetTopCompanies() (*models.TopCompanies, error)
	GetTopProjects() (*models.TopProjects, error)
	ListProjectMetrics(paramPageSize *int64, paramNextKey *string) (*models.ListProjectMetric, error)
}

Service interface defines function of Metrics service

func NewService

func NewService(
	userRepo users.UserRepository,
	companyRepo company.CompanyRepository,
	repositoriesRepo repositories.Repository,
	signatureRepo signatures.SignatureRepository,
	projectRepo project.ProjectRepository,
	metricsRepo Repository,
) Service

NewService creates new instance of metrics service

type TotalCountMetrics added in v1.0.11

type TotalCountMetrics struct {
	CorporateContributorsCount        int64  `json:"corporate_contributors_count"`
	IndividualContributorsCount       int64  `json:"individual_contributors_count"`
	ClaManagersCount                  int64  `json:"cla_managers_count"`
	ContributorsCount                 int64  `json:"contributors_count"`
	ProjectsCount                     int64  `json:"projects_count"`
	GithubRepositoriesCount           int64  `json:"github_repositories_count"`
	GerritRepositoriesCount           int64  `json:"gerrit_repositories_count"`
	RepositoriesCount                 int64  `json:"repositories_count"`
	CompaniesCount                    int64  `json:"companies_count"`
	CompaniesProjectContributionCount int64  `json:"companies_project_contribution_count"`
	LfMembersCLACount                 int64  `json:"lf_members_cla_count"`
	NonLfMembersCLACount              int64  `json:"non_lf_members_cla_count"`
	CreatedAt                         string `json:"created_at"`
	// contains filtered or unexported fields
}

TotalCountMetrics contains all metrics related to total count

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL