Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ $(HELM_SCHEMA_BIN):
helm-schema-clean:
rm -f $(HELM_SCHEMA_BIN)

# Pass DOCKER_BUILD_OPTS=--no-cache to force a clean build (e.g. when go.mod replace changes and cache is stale).
build-image/%:
docker build $(TARGET_FLAG) \
docker build $(DOCKER_BUILD_OPTS) $(TARGET_FLAG) \
Comment thread
damemi marked this conversation as resolved.
-t $(ORG)/odigos-$*$(IMG_SUFFIX):$(TAG) $(BUILD_DIR) -f $(DOCKERFILE) \
--build-arg SERVICE_NAME="$*" \
--build-arg ODIGOS_VERSION=$(TAG) \
Expand Down Expand Up @@ -177,7 +178,7 @@ build-images-rhel:
$(MAKE) build-images RHEL=true TAG=$(TAG) ORG=$(ORG)

push-image/%:
docker buildx build $(TARGET_FLAG) \
docker buildx build $(DOCKER_BUILD_OPTS) $(TARGET_FLAG) \
--platform linux/amd64,linux/arm64/v8 -t $(ORG)/odigos-$*$(IMG_SUFFIX):$(TAG) $(BUILD_DIR) -f $(DOCKERFILE) \
$(if $(filter true,$(PUSH_IMAGE)),--push,) \
$(if $(filter true,$(GCP_MARKETPLACE)),--annotation="index:com.googleapis.cloudmarketplace.product.service.name=services/odigos.endpoints.odigos-public.cloud.goog",) \
Expand Down
2 changes: 2 additions & 0 deletions api/config/crd/bases/odigos.io_actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
regexReplacements:
description: |-
Expand Down Expand Up @@ -683,6 +684,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
workloadName:
type: string
Expand Down
3 changes: 3 additions & 0 deletions api/config/crd/bases/odigos.io_instrumentationconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
libCType:
enum:
Expand Down Expand Up @@ -945,6 +946,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
payloadCollection:
properties:
Expand Down Expand Up @@ -1481,6 +1483,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
libCType:
enum:
Expand Down
1 change: 1 addition & 0 deletions api/config/crd/bases/odigos.io_instrumentationrules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
name:
description: The name of the instrumentation library
Expand Down
3 changes: 3 additions & 0 deletions api/config/crd/bases/odigos.io_samplings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
workloadName:
type: string
Expand Down Expand Up @@ -295,6 +296,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
workloadName:
type: string
Expand Down Expand Up @@ -431,6 +433,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
workloadName:
type: string
Expand Down
1 change: 1 addition & 0 deletions api/config/crd/bases/odigos.io_sources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
libCType:
enum:
Expand Down
10 changes: 9 additions & 1 deletion common/lang_detection.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package common

import (
"fmt"
"strings"

"github.com/hashicorp/go-version"
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
Expand All @@ -12,10 +13,12 @@ type ProgramLanguageDetails struct {
RuntimeVersion string
}

// +kubebuilder:validation:Enum=java;python;go;dotnet;javascript;php;ruby;rust;cplusplus;mysql;nginx;redis;postgres;unknown;ignored
// +kubebuilder:validation:Enum=java;python;go;dotnet;javascript;php;ruby;rust;cplusplus;mysql;nginx;redis;postgres;unknown;ignored;*
type ProgrammingLanguage string

const (
// ProgrammingLanguageWildcard means the distribution accepts any container programming language (see distro YAML).
ProgrammingLanguageWildcard ProgrammingLanguage = "*"
JavaProgrammingLanguage ProgrammingLanguage = "java"
PythonProgrammingLanguage ProgrammingLanguage = "python"
GoProgrammingLanguage ProgrammingLanguage = "go"
Expand All @@ -38,6 +41,11 @@ const (
UnknownProgrammingLanguage ProgrammingLanguage = "unknown"
)

// IsProgrammingLanguageWildcard reports whether lang is the distro wildcard meaning "any language".
func IsProgrammingLanguageWildcard(lang ProgrammingLanguage) bool {
return strings.TrimSpace(string(lang)) == string(ProgrammingLanguageWildcard)
}
Comment on lines +44 to +47
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for other languages we compare directly with == instead of adding a a util function. why is it different for the * language?


// MapOdigosToSemConv maps odigos programming language to OpenTelemetry semantic conventions
// It is supported only for the languages that are supported by OpenTelemetry [not for mysql, nginx, etc.]
func MapOdigosToSemConv(odigosPrograminglang ProgrammingLanguage) string {
Expand Down
5 changes: 3 additions & 2 deletions distros/distro/oteldistribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ type RuntimeEnvironment struct {
// while java-script can run in both nodejs and browser, the distribution should specify where it is intended to run.
Name string `yaml:"name"`

// semconv range of the runtime versions supported by this distribution.
// semconv range of the runtime versions supported by this distribution (hashicorp/go-version constraint).
// May be '*' in YAML for distros that skip runtime version checks in the instrumentor (e.g. wildcard language).
Comment thread
damemi marked this conversation as resolved.
SupportedVersions string `yaml:"supportedVersions,omitempty"`
}

Expand Down Expand Up @@ -222,7 +223,7 @@ type OtelDistro struct {
Name string `yaml:"name"`

// the programming language this distribution targets.
// each distribution must target a single language.
// Use common.ProgrammingLanguageWildcard ("*") for distributions that accept any language (see supportedVersions wildcard pattern).
Language common.ProgrammingLanguage `yaml:"language"`

// List of distribution parameters that are required to be set by the user.
Expand Down
17 changes: 17 additions & 0 deletions distros/yamls/opentelemetry-ebpf-instrumentation.yaml
Comment thread
damemi marked this conversation as resolved.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also have java-ebpf-instrumentations in enterprise. should we use the same here (instrumentations with an s at the end) to keep things consistent?

also, since the mechanism is a bit different, I wonder if this can cause confusion for users

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, I named this literally after OBI "opentelemetry-ebpf-instrumentation" the project itself for clarity https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: internal.odigos.io/v1beta1
kind: OtelDistribution
metadata:
name: opentelemetry-ebpf-instrumentation
spec:
name: opentelemetry-ebpf-instrumentation
language: '*'
isEbpf: true
runtimeEnvironments:
- name: multi-runtime
supportedVersions: '*'
Comment thread
damemi marked this conversation as resolved.
displayName: OpenTelemetry eBPF Instrumentation (OBI)
description: |
Language-agnostic eBPF-based instrumentation using the OpenTelemetry eBPF Instrumentation (OBI) SDK.
Supports any language without code changes. Not enabled by default.
runtimeAgent:
noRestartRequired: true
7 changes: 4 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ Simply merge in this PR and your documentation will be connected!
The documentation is build on [Mintlify](https://www.npmjs.com/package/mintlify). To preview the documentation changes locally:

```
# make sure you're in `/docs` folder, where `mint.json` and `package.json` files are
yarn install
yarn dev
# make sure you're in `/docs` folder, where `docs.json` and `package.json` files are
# install the mintlify npm package (if you don't already have it)
npm i -g mint
mint dev
```

### 😎 Publishing Changes
Expand Down
3 changes: 2 additions & 1 deletion docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@
"pages": [
"oss/instrumentations/configuration/mount-method"
]
}
},
"oss/instrumentations/obi"
]
},
{
Expand Down
10 changes: 10 additions & 0 deletions docs/oss/instrumentations/obi.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "OpenTelemetry eBPF Instrumentation (OBI)"
description: "OBI is OpenTelemetry’s eBPF-based auto-instrumentation."
sidebarTitle: "OBI"
icon: "telescope"
---

import Content from "/snippets/oss/instrumentations/obi.mdx";

<Content />
49 changes: 49 additions & 0 deletions docs/snippets/oss/instrumentations/obi.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Odigos can run **[OpenTelemetry eBPF Instrumentation (OBI)](https://opentelemetry.io/docs/zero-code/obi)** for workloads where the `opentelemetry-ebpf-instrumentation` distro is selected.

<CardGroup cols={2}>
<Card
title="OpenTelemetry OBI"
icon="telescope"
href="https://opentelemetry.io/docs/zero-code/obi"
>
Upstream concepts, requirements, and capabilities.
</Card>
<Card
title="OBI on GitHub"
icon="code"
href="https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation"
>
Source, releases, and issues.
</Card>
</CardGroup>

## OBI Support

OBI can be enabled by selecting it as a container override for specific workloads. If editing a [Source object](/oss/pipeline/sources/introduction),
this is done through the `containerOverrides` field. For example:

```yaml
apiVersion: odigos.io/v1alpha1
kind: Source
metadata:
name: my-workload
namespace: default
spec:
workload:
kind: DaemonSet
name: sample-app
namespace: default
containerOverrides:
- containerName: foo
otelDistroName: opentelemetry-ebpf-instrumentation
```

In this case, `containerName` is the name of the container to instrument in this workload, and the required
`otelDistroName` is **`opentelemetry-ebpf-instrumentation`**.

Or through the **Container Overrides** field in the UI.

### Limitations

OBI's instrumentation is based on HTTP header propagation. For encrypted traffic, context propagation will not work unless both
workloads (client and server) are instrumented with OBI as explained in [the official OBI docs](https://opentelemetry.io/docs/zero-code/obi/distributed-traces/#context-propagation-at-network-level).
2 changes: 1 addition & 1 deletion docs/snippets/shared/permissions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Below are the ClusterRoles used by Odigos components.

| APIGroups | Resources | Resource Names | Verbs |
|---|---|---|---|
| \* | pods | \* | get<br />list<br />watch |
| \* | pods<br />services | \* | get<br />list<br />watch |
| \* | pods/status | \* | get |
| \* | pods/finalizers | \* | update |
| \* | nodes | \* | get<br />list<br />watch<br />patch<br />update |
Expand Down
3 changes: 2 additions & 1 deletion frontend/graph/loaders/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ func isDistroExpectingInstrumentationInstances(otelDistroName *string) bool {
"java-enterprise",
"mysql-enterprise",
"nodejs-enterprise",
"python-enterprise":
"python-enterprise",
"opentelemetry-ebpf-instrumentation": // OBI
return true
default:
return false
Expand Down
2 changes: 2 additions & 0 deletions helm/odigos/templates/crds/odigos.io_actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
regexReplacements:
description: |-
Expand Down Expand Up @@ -683,6 +684,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
workloadName:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
libCType:
enum:
Expand Down Expand Up @@ -945,6 +946,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
payloadCollection:
properties:
Expand Down Expand Up @@ -1481,6 +1483,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
libCType:
enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
name:
description: The name of the instrumentation library
Expand Down
3 changes: 3 additions & 0 deletions helm/odigos/templates/crds/odigos.io_samplings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
workloadName:
type: string
Expand Down Expand Up @@ -295,6 +296,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
workloadName:
type: string
Expand Down Expand Up @@ -431,6 +433,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
workloadName:
type: string
Expand Down
1 change: 1 addition & 0 deletions helm/odigos/templates/crds/odigos.io_sources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ spec:
- postgres
- unknown
- ignored
- '*'
type: string
libCType:
enum:
Expand Down
1 change: 1 addition & 0 deletions helm/odigos/templates/odiglet/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ rules:
- ''
resources:
- pods
- services
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this required?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OBI uses service discovery out of the box, not sure if it's specifically for trace decoration or just cluster wide discovery. I'll check if it's configurable, otherwise the odiglet logs a bunch of permission errors from OBI

verbs:
- get
- list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ func resolveDistroByOverride(overwriteDistroName string, distroGetter *distros.G
}
}

// Wildcard-language distros skip container language match when explicitly selected.
if common.IsProgrammingLanguageWildcard(distro.Language) {
return distro, nil
}

// verify the distro matches the language, since it might be overridden by the container override.
if distro.Language != containerLanguage {
return nil, &odigosv1.AgentDisabledInfo{
Expand Down Expand Up @@ -79,6 +84,9 @@ func CalculateDefaultDistroPerLanguage(defaultDistros map[common.ProgrammingLang
if distro == nil {
continue
}
if common.IsProgrammingLanguageWildcard(distro.Language) {
continue
}
Comment on lines +87 to +89
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be nice to add support for this in the rule someday in the duture


lang := distro.Language
distrosPerLanguage[lang] = distroName
Expand Down Expand Up @@ -133,8 +141,9 @@ func ResolveDistroForContainer(
return nil, disabledInfo
}

// check if the runtime version is in supported range if it is provided
if runtimeDetails.RuntimeVersion != "" && len(d.RuntimeEnvironments) == 1 {
// check if the runtime version is in supported range if it is provided.
// Wildcard-language distros (e.g. OBI) skip semver checks; supportedVersions may be '*'.
if runtimeDetails.RuntimeVersion != "" && len(d.RuntimeEnvironments) == 1 && !common.IsProgrammingLanguageWildcard(d.Language) {
constraint, err := version.NewConstraint(d.RuntimeEnvironments[0].SupportedVersions)
if err != nil {
return nil, &odigosv1.AgentDisabledInfo{
Expand Down
Loading
Loading