Skip to content

Latest commit

 

History

History
108 lines (69 loc) · 2.88 KB

library-layout.md

File metadata and controls

108 lines (69 loc) · 2.88 KB

OpenTelemetry Project Package Layout

This documentation serves to document the "look and feel" of a basic layout for OpenTelemetry projects. This package layout is intentionally generic and it doesn't try to impose a language specific package structure.

API Package

Here is a proposed generic package structure for OpenTelemetry API package.

A typical top-level directory layout:

api
   ├── context
   │   └── propagation
   ├── metrics
   ├── trace
   │   └── propagation
   ├── distributedcontext
   │   └── propagation
   ├── internal
   └── logs

Use of lowercase, CamelCase or Snake Case (stylized as snake_case) names depends on the language.

/context

This directory describes the API that provides in-process context propagation.

This directory describes the Metrics API that can be used to record application metrics.

This directory describes the DistributedContext API that can be used to manage context propagation and metrics-related labeling.

This API consists of a few main classes:

  • Entry is used to label anything that is associated with a specific operation, such as an HTTP request.
  • An Entry consists of EntryMetadata, EntryKey, and EntryValue.

This API consist of a few main classes:

  • Tracer is used for all operations. See Tracer section.
  • Span is a mutable object storing information about the current operation execution. See Span section.

/internal (Optional)

Private application and library code.

/logs (In the future)

TODO: logs operations

SDK Package

Here is a proposed generic package structure for OpenTelemetry SDK package.

A typical top-level directory layout:

sdk
   ├── context
   ├── metrics
   ├── resource
   ├── trace
   ├── distributedcontext
   ├── internal
   └── logs

Use of lowercase, CamelCase or Snake Case (stylized as snake_case) names depends on the language.

/sdk/context

This directory describes the SDK implementation for api/context.

/sdk/metrics

This directory describes the SDK implementation for api/metrics.

The resource directory primarily defines a type Resource that captures information about the entity for which stats or traces are recorded. For example, metrics exposed by a Kubernetes container can be linked to a resource that specifies the cluster, namespace, pod, and container name.

/sdk/distributedcontext

This directory describes the SDK implementation for api/metrics.

/sdk/internal (Optional)

Private application and library code.

/sdk/logs (In the future)

TODO: logs operations