Skip to content

Commit

Permalink
feat: add otel distribution concept with initial metadata per distro (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
blumamir authored Feb 2, 2025
1 parent 1707716 commit aa34496
Show file tree
Hide file tree
Showing 14 changed files with 344 additions and 0 deletions.
19 changes: 19 additions & 0 deletions distros/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module github.com/odigos-io/odigos/distros

require (
github.com/odigos-io/odigos/common v0.0.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/go-logr/logr v1.4.2 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
go.opentelemetry.io/otel v1.34.0 // indirect
go.opentelemetry.io/otel/trace v1.34.0 // indirect
)

replace github.com/odigos-io/odigos/common => ../common

go 1.23.0

toolchain go1.23.5
27 changes: 27 additions & 0 deletions distros/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
77 changes: 77 additions & 0 deletions distros/oteldistributions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package distros

import "github.com/odigos-io/odigos/common"

type RuntimeEnvironment struct {
// the runtime environment this distribution targets.
// examples: nodejs, JVM, CPython, etc.
// while java-script can run in both nodejs and browser, the distribution should specify where it is intended to run.
RuntimeEnvironmentName string `json:"runtimeEnvironmentName"`

// semconv range of the runtime versions supported by this distribution.
RuntimeEnvironmentVersion string `json:"runtimeEnvironmentVersion"`
}

type Framework struct {
// the framework this distribution targets.
FrameworkName string `json:"frameworkName"`

// semconv range of the framework versions supported by this distribution.
FrameworkVersion string `json:"frameworkVersion"`
}

// this struct describes environment variables that needs to be set in the application runtime
// to enable the distribution.
type EnvironmentVariable struct {

// The name of the environment variable to set or patch.
EnvName string `json:"envName"`

// The value of the environment variable to set or patch.
// One special value can be used in this text which is substituted by the actual value at runtime.
// The special value is: `{{ODIGOS_AGENTS_DIR}}` which is replaced by `/var/odigos`, for k8s and with other values for other platforms.
EnvValue string `json:"envValue"`

// In case the environment variable needs to be appended to an existing value,
// this field specifies the delimiter to use.
// e.g. `:` for PYTHONPATH=/path/to/lib1:/path/to/lib2
Delimiter string `json:"delimiter"`
}

// OtelDistro (Short for OpenTelemetry Distribution) is a collection of OpenTelemetry components,
// including instrumentations, SDKs, and other components that are distributed together.
// Each distribution includes a unique name, and metadata about the ways it is implemented.
// The metadata includes the tiers of the distribution, the instrumentations, and the SDKs used.
// Multiple distributions can co-exist with the same properties but different names.
type OtelDistro struct {

// a unique name for this distribution, which helps to identify it.
// should be a single word, lowercase, and may include hyphens (nodejs-community, dotnet-legacy-instrumentation).
Name string `json:"name"`

// the programming language this distribution targets.
// each distribution must target a single language.
Language common.ProgrammingLanguage `json:"language"`

// the runtime environments this distribution targets.
// examples: nodejs, JVM, CPython, etc.
// while java-script can run in both nodejs and browser, the distribution should specify where it is intended to run.
RuntimeEnvironments []RuntimeEnvironment `json:"runtimeEnvironments"`

// A list of frameworks this distribution targets (can be left empty)
Frameworks []Framework `json:"frameworks"`

// a human-friendly name for this distribution, which can be displayed in the UI and documentation.
// may include spaces and special characters.
DisplayName string `json:"displayName"`

// Free text description of the distribution, what it includes, it's use cases, etc.
Description string `json:"description"`

// Specifies the odigos tiers which includes this distribution
Tiers []common.OdigosTier `json:"tiers"`

// a list of environment variables that needs to be set in the application runtime
// to enable the distribution.
EnvironmentVariables []EnvironmentVariable `json:"environmentVariables,omitempty"`
}
18 changes: 18 additions & 0 deletions distros/yamls/dotnet-community.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: dotnet-community
spec:
name: dotnet-community
language: dotnet
runtimeEnvironments:
- name: dotnet-version
version: '>= 6.0'
framework:
- name: dotnet-framework
version: '>= 4.6.2'
displayName: Dotnet Community Native Instrumentation
description: |
This distribution is for Dotnet applications using OpenTelemetry Native SDK and instrumentation libraries from the OpenTelemetry community.
tiers:
- community
15 changes: 15 additions & 0 deletions distros/yamls/golang-community.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: golang-community
spec:
name: golang-community
language: go
runtimeEnvironments:
- name: go-runtime
version: '>= 1.17'
displayName: Golang Community eBPF Instrumentation
description: |
This distribution is for Golang applications using OpenTelemetry eBPF-based SDK and eBPF-based instrumentation libraries from the OpenTelemetry community.
tiers:
- community
15 changes: 15 additions & 0 deletions distros/yamls/golang-enterprise.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: golang-enterprise
spec:
name: golang-enterprise
language: go
runtimeEnvironments:
- name: go-runtime
version: '>= 1.17'
displayName: Golang Enterprise eBPF Instrumentation
description: |
This distribution is for Golang applications using Odigos enterprise version, with ebpf-based SDK and instrumentation libraries, additional features and libraries coverage.
tiers:
- onprem
23 changes: 23 additions & 0 deletions distros/yamls/java-community.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: java-community
spec:
name: java-community
language: java
runtimeEnvironments:
- name: java-virtual-machine
version: '>= 8'
displayName: Java Community Native Instrumentation
description: |
This distribution is for JVM-based applications (Java, Scala, Kotlin, etc.) using OpenTelemetry Native SDK and instrumentation libraries from the OpenTelemetry community.
tiers:
- community
environmentVariables:
- envName: JAVA_OPTS
envValue: '-javaagent:{{ODIGOS_AGENTS_DIR}}/java/javaagent.jar'
delimiter: ' '
- envName: JAVA_TOOL_OPTIONS
envValue: '-javaagent:{{ODIGOS_AGENTS_DIR}}/java/javaagent.jar'
delimiter: ' '

22 changes: 22 additions & 0 deletions distros/yamls/java-ebpf-instrumentations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: java-ebpf-instrumentations
spec:
name: java-ebpf-instrumentations
language: java
runtimeEnvironments:
- name: java-virtual-machine
version: '>= 8'
displayName: Java Enterprise eBPF Instrumentation
description: |
This distribution is for JVM-based applications (Java, Scala, Kotlin, etc.) using eBPF based SDK and eBPF enterprise instrumentation libraries.
tiers:
- onprem
environmentVariables:
- envName: JAVA_OPTS
envValue: '-javaagent:{{ODIGOS_AGENTS_DIR}}/java-ebpf/dtrace-injector.jar'
delimiter: ' '
- envName: JAVA_TOOL_OPTIONS
envValue: '-javaagent:{{ODIGOS_AGENTS_DIR}}/java-ebpf/dtrace-injector.jar'
delimiter: ' '
22 changes: 22 additions & 0 deletions distros/yamls/java-enterprise.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: java-enterprise
spec:
name: java-enterprise
language: java
runtimeEnvironments:
- name: java-virtual-machine
version: '>= 8'
displayName: Java Enterprise eBPF Processing
description: |
This distribution is for JVM-based applications (Java, Scala, Kotlin, etc.) using eBPF based SDK and native instrumentation libraries from the OpenTelemetry community.
tiers:
- onprem
environmentVariables:
- envName: JAVA_OPTS
envValue: "-javaagent:{{ODIGOS_AGENTS_DIR}}/java-ext-ebpf/javaagent.jar -Dotel.javaagent.extensions={{ODIGOS_AGENTS_DIR}}/java-ext-ebpf/otel_agent_extension.jar"
delimiter: ' '
- envName: JAVA_TOOL_OPTIONS
envValue: "-javaagent:{{ODIGOS_AGENTS_DIR}}/java-ext-ebpf/javaagent.jar -Dotel.javaagent.extensions={{ODIGOS_AGENTS_DIR}}/java-ext-ebpf/otel_agent_extension.jar"
delimiter: ' '
19 changes: 19 additions & 0 deletions distros/yamls/nodejs-community.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: nodejs-community
spec:
name: nodejs-community
language: javascript
runtimeEnvironments:
- name: nodejs
version: '>= 14'
displayName: Node.js Community Native Instrumentation
description: |
This distribution is for Node.js applications using OpenTelemetry Native SDK and instrumentation libraries from the OpenTelemetry community.
tiers:
- community
environmentVariables:
- envName: NODE_OPTIONS
envValue: '--require {{ODIGOS_AGENTS_DIR}}/nodejs/autoinstrumentation.js'
delimiter: ' '
19 changes: 19 additions & 0 deletions distros/yamls/nodejs-enterprise.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: nodejs-enterprise
spec:
name: nodejs-enterprise
language: javascript
runtimeEnvironments:
- name: nodejs
version: '>= 14'
displayName: Node.js Enterprise eBPF Processing
description: |
This distribution is for Node.js applications using an efficient eBPF-based SDK, and native instrumentation libraries from the OpenTelemetry community.
tiers:
- onprem
environmentVariables:
- envName: NODE_OPTIONS
envValue: '--require {{ODIGOS_AGENTS_DIR}}/nodejs-ebpf/autoinstrumentation.js'
delimiter: ' '
19 changes: 19 additions & 0 deletions distros/yamls/python-community.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: python-community
spec:
name: python-community
language: javascript
runtimeEnvironments:
- name: python-runtime
version: '>= 3.8'
displayName: Python Community Native Instrumentation
description: |
This distribution is for Python applications using OpenTelemetry Native SDK and instrumentation libraries from the OpenTelemetry community.
tiers:
- community
environmentVariables:
- envName: PYTHONPATH
envValue: '{{ODIGOS_AGENTS_DIR}}/python:{{ODIGOS_AGENTS_DIR}}/python/opentelemetry/instrumentation/auto_instrumentation'
delimiter: ':'
20 changes: 20 additions & 0 deletions distros/yamls/python-enterprise.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: python-enterprise
spec:
name: python-enterprise
language: javascript
runtimeEnvironments:
- name: python-runtime
version: '>= 3.8'
displayName: Python Enterprise eBPF Processing
description: |
This distribution is for Python applications using OpenTelemetry native instrumentation libraries and eBPF SDK with enterprise features and capabilities.
tiers:
- onprem
environmentVariables:
- envName: PYTHONPATH
envValue: '{{ODIGOS_AGENTS_DIR}}/python-ebpf:{{ODIGOS_AGENTS_DIR}}/python/opentelemetry/instrumentation/auto_instrumentation:{{ODIGOS_AGENTS_DIR}}/python'
delimiter: ':'

29 changes: 29 additions & 0 deletions distros/yamls/render.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package yamls

import (
"embed"
"fmt"

"github.com/odigos-io/odigos/distros"
"gopkg.in/yaml.v3"
)

//go:embed *.yaml
var embeddedFiles embed.FS

func ReadDistroFromYamlManifest(distroName string) (*distros.OtelDistro, error) {
// TODO: allow multiple files per profiles with any name (not just profileName.yaml)
filename := fmt.Sprintf("%s.yaml", distroName)
yamlBytes, err := embeddedFiles.ReadFile(filename)
if err != nil {
return nil, err
}

otelDistro := distros.OtelDistro{}
err = yaml.Unmarshal(yamlBytes, &otelDistro)
if err != nil {
return nil, err
}

return &otelDistro, nil
}

0 comments on commit aa34496

Please sign in to comment.