metrics

package
v0.0.0-...-0c3f707 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 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"
	MetricTypeCompanyProject         = "company_project"
	MetricTypeClaManagerDistribution = "cla_manager_distribution" // nolint G101: Potential hardcoded credentials (gosec)

	IDTotalCount             = "total_count"
	IDClaManagerDistribution = "cla_manager_distribution" // nolint G101: Potential hardcoded credentials (gosec)
)

MetricType constants and ID constants

View Source
const (
	// FoundationType the SF foundation type string - previously was "Foundation", now "Project Group"
	FoundationType = "Project Group"
)

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.EasyclaAPI, service Service, v1CompanyRepo v1Company.IRepository)

Configure setups handlers on api with service

Types

type ClaManagersDistribution

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

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

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

CompanyMetrics contain collection of all company metrics

type CompanyProjectMetric

type CompanyProjectMetric struct {
	CompanyID         string `json:"company_id"`
	ProjectID         string `json:"project_id"`
	ClaGroupName      string `json:"cla_group_name"`
	ProjectName       string `json:"project_name"`
	CompanyName       string `json:"company_name"`
	ClaManagersCount  int64  `json:"cla_managers_count"`
	ContributorsCount int64  `json:"contributors_count"`
	ProjectSFID       string `json:"project_sfid"`
	// contains filtered or unexported fields
}

CompanyProjectMetric contain metrics for company-project pair

type CompanyProjectMetrics

type CompanyProjectMetrics struct {
	CompanyProjectMetrics map[string]*CompanyProjectMetric
}

CompanyProjectMetrics contain collection of company-project metric

type ItemCompany

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

ItemCompany represent item of companies table

type ItemGerritInstance

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

ItemGerritInstance represent item of gerrit instance table

type ItemProject

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

ItemProject represent item of projects table

type ItemRepository

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

ItemRepository represent item of repositories table

type ItemSignature

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 ItemUser

type ItemUser struct {
	LfUsername string `json:"lf_username"`
}

ItemUser represent item of users table

type Metrics

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

Metrics contain all metrics related to easycla

type ProjectMetric

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

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

ProjectMetrics contain collection of all project metrics

type Repository

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)
	ListCompanyProjectMetrics(companyID string) ([]*CompanyProjectMetric, error)
}

Repository provides methods for calculation,storage and retrieval of metrics

func NewRepository

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

NewRepository creates new metrics repository

type Service

type Service interface {
	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)
	ListCompanyProjectMetrics(ctx context.Context, companyID string, projectSFID string) (*models.CompanyProjectMetrics, error)
}

Service interface defines function of Metrics service

func NewService

func NewService(metricsRepo Repository, pcgRepo projects_cla_groups.Repository) Service

NewService creates new instance of metrics service

type TotalCountMetrics

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"`
	ProjectsLiveCount                 int64  `json:"projects_live_count"`
	GithubRepositoriesCount           int64  `json:"github_repositories_count"`
	GithubRepositoriesEnabledCount    int64  `json:"github_repositories_enabled_count"`
	GerritRepositoriesCount           int64  `json:"gerrit_repositories_count"`
	GerritRepositoriesEnabledCount    int64  `json:"gerrit_repositories_enabled_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"`
	CLAsSignedCount                   int64  `json:"clas_signed_count"`
	// 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