Developer Certificate of Origin
The project uses the Developer Certificate of Origin 1.1, as outlined in the DCO file. By contributing to this project, you certify that:
- You created the contribution in whole or in part.
- The contribution is based on previous work covered under an appropriate open source license, with modifications.
- You received the contribution from someone who certified the above conditions.
Contribution Guidelines
Contribution guidelines are documented in the CONTRIBUTING.md file.
Code Style
Go Formatting
- The project uses
gofmtto enforce consistent code formatting. - Run
make fmtto format the entire codebase. - The Makefile uses
GOFMTfor formatting.
Go Vet
- The project uses
go vetto check for potential issues in the code. - Run
make lintto rungo vetand other linters. - The Makefile uses
GOVETfor code vetting.
Go Testing
- The project uses
go testfor unit testing. - Run
make testto execute all tests. - The Makefile uses
GOTESTfor running tests.
Code Coverage
- The project aims for high code coverage.
- Run
make coverto generate a coverage report. - The Makefile uses
go tool coverfor generating a coverage report.
Linting
- The project uses
golintfor code style checks. - Run
make lintto rungolintand other linters. - The Makefile uses
GOLINTfor linting.
Project Structure
The project is organized into subdirectories, each containing specific functionality:
metrics: contains code for metricssample: contains a sample codemetrics/go-kit: contains code for go-kit metrics adaptermetrics/histogram: contains code for histogramsmetrics/metricstest: contains code for testing metricsmetrics/adapters/tagless: contains code for a tagless metrics adaptermetrics/prometheus: contains code for Prometheus metrics adapter
Dependencies
The project uses Go Modules for dependency management. Dependencies are listed in the Gopkg.toml file.
Naming Conventions
Packages
- Package names should be lowercase and descriptive.
Functions
- Function names should be in camelCase, starting with a lowercase letter.
Variables
- Variable names should be in camelCase, starting with a lowercase letter.
- Constants should be in UPPERCASE.
Types
- Type names should be in CamelCase, starting with an uppercase letter.
Interfaces
- Interface names should start with an uppercase letter.
- Interface methods should be in camelCase, starting with a lowercase letter.
Tags
- Tags should be in lowercase, separated by underscores (
_).
Logging
- Logging should be done using the
zaplibrary. - Log levels should be used appropriately.
Error Handling
- All errors should be handled gracefully.
- Errors should be wrapped with context information to aid in debugging.
Documentation
- All public functions and types should be documented with GoDoc comments.
- Documentation should be concise and clear.
Example
metrics/go-kit/factory.go
// TagsSeparator returns an option that overrides default tags separator.
func TagsSeparator(tagsSep string) FactoryOption {
return func(f *factory) {
f.tagsSep = tagsSep
}
}
This example shows a function with a GoDoc comment and a camelCase function name. The function returns a FactoryOption type, which is a function that modifies the factory struct.
Top-Level Directory Explanations
client/ - This directory contains the client-side code for the Jaeger Tracing library.
client/log/ - This subdirectory contains the logging implementation for the client-side code.
client/log/go-kit/ - This subdirectory of the logging implementation contains the Go-Kit logging adapter.
metrics/ - This directory contains the metrics implementation for the Jaeger Tracing library.
metrics/adapters/ - This subdirectory contains the various metric adapters for different backends.
metrics/expvar/ - This subdirectory contains the implementation for exposing metrics as HTTP endpoints using the expvar package.
metrics/fork/ - This subdirectory contains the implementation for forking metrics between processes.
metrics/go-kit/ - This subdirectory contains the Go-Kit integration for the Jaeger Tracing library.
metrics/go-kit/expvar/ - This subdirectory contains the expvar implementation for the Go-Kit integration.
metrics/go-kit/influx/ - This subdirectory contains the InfluxDB implementation for the Go-Kit integration.
metrics/metricstest/ - This subdirectory contains the testing implementation for the metrics.
metrics/multi/ - This subdirectory contains the implementation for collecting metrics from multiple sources.
metrics/prometheus/ - This subdirectory contains the Prometheus implementation for the Jaeger Tracing library.
metrics/tally/ - This subdirectory contains the implementation for counting metrics using the tally package.
sample/ - This directory contains a sample implementation for the Jaeger Tracing library.
scripts/ - This directory contains various scripts for the project.