This repository was archived by the owner on Oct 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 103
feat: add otel operator and sample configurations #68
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| name: observability | ||
| runtime: | ||
| name: python | ||
| options: | ||
| virtualenv: ../venv | ||
| config: ../config | ||
| description: Deploys OTEL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import os | ||
|
|
||
| import pulumi | ||
| import pulumi_kubernetes as k8s | ||
| from pulumi_kubernetes.yaml import ConfigGroup | ||
|
|
||
| from kic_util import pulumi_config | ||
|
|
||
| # Removes the status field from the Nginx Ingress Helm Chart, so that i#t is | ||
| # compatible with the Pulumi Chart implementation. | ||
| def remove_status_field(obj): | ||
| if obj['kind'] == 'CustomResourceDefinition' and 'status' in obj: | ||
| del obj['status'] | ||
|
|
||
| def pulumi_eks_project_name(): | ||
| script_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| eks_project_path = os.path.join(script_dir, '..', 'eks') | ||
| return pulumi_config.get_pulumi_project_name(eks_project_path) | ||
|
|
||
|
|
||
| def pulumi_ingress_project_name(): | ||
| script_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| ingress_project_path = os.path.join(script_dir, '..', 'kic-helm-chart') | ||
| return pulumi_config.get_pulumi_project_name(ingress_project_path) | ||
|
|
||
|
|
||
| def otel_operator_location(): | ||
| script_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| otel_operator_path = os.path.join(script_dir, 'otel-operator', '*.yaml') | ||
| return otel_operator_path | ||
|
|
||
| def otel_deployment_location(): | ||
| script_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| otel_deployment_path = os.path.join(script_dir, 'otel-objects', '*.yaml') | ||
| return otel_deployment_path | ||
|
|
||
| def add_namespace(obj): | ||
| obj['metadata']['namespace'] = 'observability' | ||
|
|
||
|
|
||
| stack_name = pulumi.get_stack() | ||
| project_name = pulumi.get_project() | ||
| eks_project_name = pulumi_eks_project_name() | ||
| pulumi_user = pulumi_config.get_pulumi_user() | ||
|
|
||
| eks_stack_ref_id = f"{pulumi_user}/{eks_project_name}/{stack_name}" | ||
| eks_stack_ref = pulumi.StackReference(eks_stack_ref_id) | ||
| kubeconfig = eks_stack_ref.get_output('kubeconfig').apply(lambda c: str(c)) | ||
| eks_stack_ref.get_output('cluster_name').apply( | ||
| lambda s: pulumi.log.info(f'Cluster name: {s}')) | ||
|
|
||
| k8s_provider = k8s.Provider(resource_name=f'ingress-setup-sample', kubeconfig=kubeconfig) | ||
|
|
||
| # Create the namespace | ||
| ns = k8s.core.v1.Namespace(resource_name='observability', | ||
| metadata={'name': 'observability'}, | ||
| opts=pulumi.ResourceOptions(provider=k8s_provider)) | ||
|
|
||
| # Config Manifests: OTEL operator | ||
| otel_operator = otel_operator_location() | ||
|
|
||
| otel_op = ConfigGroup( | ||
| 'otel-op', | ||
| files=[otel_operator], | ||
| transformations=[remove_status_field], # Need to review w/ operator | ||
| opts=pulumi.ResourceOptions(depends_on=[ns]) | ||
| ) | ||
|
|
||
| # Config Manifests: OTEL components | ||
| otel_deployment = otel_deployment_location() | ||
|
|
||
| otel_dep = ConfigGroup( | ||
| 'otel-dep', | ||
| files=[otel_deployment], | ||
| transformations=[add_namespace, remove_status_field], # Need to review w/ operator | ||
| opts=pulumi.ResourceOptions(depends_on=[ns,otel_op]) | ||
| ) | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| ## Sample Configurations | ||
| This directory contains a number of sample configurations that can be used with the | ||
| [OTEL kubernetes operator](https://github.com/open-telemetry/opentelemetry-operator) that is installed as part of the | ||
| MARA project. | ||
|
|
||
| Each configuration currently uses the `simplest` deployment, which uses an in-memory store for data being processed. | ||
| This is obviously not suited to a production deployment, but it is intended to illustrate the steps required to work | ||
| with the OTEL deployment. | ||
|
|
||
| ## Commonality | ||
|
|
||
| ### Listening Ports | ||
| Each of the sample files is configured to listen on the | ||
| [OTLP protocol](https://opentelemetry.io/docs/reference/specification/protocol/otlp/). The listen ports configured are: | ||
| * grpc on port 9978 | ||
| * http on port 9979 | ||
|
|
||
| ### Logging | ||
| All of the examples log to the container's stdout. However, the basic configuration is configured to only show the | ||
| condensed version of the traces being received. In order to see the full traces, you need to set the logging level to | ||
| `DEBUG`. The basic-debug object is configured to do this automatically. | ||
|
|
||
| ## Configurations | ||
| ### `otel-collector.yaml.basic` | ||
| This is the default collector that only listens and logs summary spans to the container's stdout. | ||
|
|
||
| ### `otel-collector.yaml.basic` | ||
| This is a variant of the default collector that will output full spans to the container's stdout. | ||
|
|
||
| ### `otel-collector.yaml.full` | ||
| This is a more complex variant that contains multiple receivers, processors, and exporters. Please see the file for | ||
| details. | ||
|
|
||
| ### `otel-collector.yaml.lightstep` | ||
| This configuration file deploys lightstep as an ingester. Please note you will need to have a | ||
| [lightstep](https://lightstep.com/) account to use this option, and you will need to add your lightstep access token | ||
| to the file in the field noted. | ||
|
|
||
| ## Usage | ||
| By default, the `otel-collector.yaml.basic` configuration is copied into the live `otel-collector.yaml`. The logic for | ||
| this project runs all files ending in `.yaml` as part of the configuration so you simply need to either rename your | ||
| chosen file to `otel-collector.yaml` or add ensuring only the files you want to use have the `.yaml` extension. | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| apiVersion: opentelemetry.io/v1alpha1 | ||
| kind: OpenTelemetryCollector | ||
| metadata: | ||
| name: simplest | ||
| namespace: observability | ||
| spec: | ||
| config: | | ||
| receivers: | ||
| otlp: | ||
| protocols: | ||
| grpc: | ||
| endpoint: 0.0.0.0:9978 | ||
| http: | ||
| endpoint: 0.0.0.0:9979 | ||
|
|
||
| processors: | ||
| batch: | ||
|
|
||
| exporters: | ||
| logging: | ||
| logLevel: | ||
|
|
||
| service: | ||
| pipelines: | ||
| traces: | ||
| receivers: [otlp] | ||
| processors: [batch] | ||
| exporters: [logging] |
28 changes: 28 additions & 0 deletions
28
pulumi/aws/observability/otel-objects/otel-collector.yaml.basic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| apiVersion: opentelemetry.io/v1alpha1 | ||
| kind: OpenTelemetryCollector | ||
| metadata: | ||
| name: simplest | ||
| namespace: observability | ||
| spec: | ||
| config: | | ||
| receivers: | ||
| otlp: | ||
| protocols: | ||
| grpc: | ||
| endpoint: 0.0.0.0:9978 | ||
| http: | ||
| endpoint: 0.0.0.0:9979 | ||
|
|
||
| processors: | ||
| batch: | ||
|
|
||
| exporters: | ||
| logging: | ||
| logLevel: | ||
|
|
||
| service: | ||
| pipelines: | ||
| traces: | ||
| receivers: [otlp] | ||
| processors: [batch] | ||
| exporters: [logging] |
28 changes: 28 additions & 0 deletions
28
pulumi/aws/observability/otel-objects/otel-collector.yaml.basic-debug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| apiVersion: opentelemetry.io/v1alpha1 | ||
| kind: OpenTelemetryCollector | ||
| metadata: | ||
| name: simplest | ||
| namespace: observability | ||
| spec: | ||
| config: | | ||
| receivers: | ||
| otlp: | ||
| protocols: | ||
| grpc: | ||
| endpoint: 0.0.0.0:9978 | ||
| http: | ||
| endpoint: 0.0.0.0:9979 | ||
|
|
||
| processors: | ||
| batch: | ||
|
|
||
| exporters: | ||
| logging: | ||
| logLevel: debug | ||
|
|
||
| service: | ||
| pipelines: | ||
| traces: | ||
| receivers: [otlp] | ||
| processors: [batch] | ||
| exporters: [logging] |
65 changes: 65 additions & 0 deletions
65
pulumi/aws/observability/otel-objects/otel-collector.yaml.full
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| apiVersion: opentelemetry.io/v1alpha1 | ||
| kind: OpenTelemetryCollector | ||
| metadata: | ||
| name: simplest | ||
| namespace: observability | ||
| spec: | ||
| config: | | ||
| extensions: | ||
| health_check: | ||
| pprof: | ||
| endpoint: 0.0.0.0:1777 | ||
| zpages: | ||
| endpoint: 0.0.0.0:55679 | ||
|
|
||
| receivers: | ||
| otlp: | ||
| protocols: | ||
| grpc: | ||
| endpoint: 0.0.0.0:9978 | ||
| http: | ||
| endpoint: 0.0.0.0:9979 | ||
| opencensus: | ||
| jaeger: | ||
| protocols: | ||
| grpc: | ||
| thrift_binary: | ||
| thrift_compact: | ||
| thrift_http: | ||
| zipkin: | ||
|
|
||
| # Collect own metrics | ||
| prometheus: | ||
| config: | ||
| scrape_configs: | ||
| - job_name: 'otel-collector' | ||
| scrape_interval: 120s | ||
| static_configs: | ||
| - targets: [ '0.0.0.0:8080'] | ||
| metrics_path: '/z/prometheus' | ||
|
|
||
| processors: | ||
| batch: | ||
|
|
||
| exporters: | ||
| prometheus: | ||
| endpoint: "0.0.0.0:8889" | ||
|
|
||
| logging: | ||
| logLevel: debug | ||
|
|
||
| jaeger: | ||
| endpoint: "0.0.0.0:14250" | ||
|
|
||
| service: | ||
| pipelines: | ||
| traces: | ||
| receivers: [otlp, opencensus, jaeger, zipkin] | ||
| processors: [batch] | ||
| exporters: [logging, jaeger] | ||
| metrics: | ||
| receivers: [otlp, opencensus, prometheus] | ||
qdzlug marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| processors: [batch] | ||
| exporters: [logging] | ||
|
|
||
| extensions: [health_check, pprof, zpages] | ||
qdzlug marked this conversation as resolved.
Show resolved
Hide resolved
|
||
35 changes: 35 additions & 0 deletions
35
pulumi/aws/observability/otel-objects/otel-collector.yaml.lightstep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| apiVersion: opentelemetry.io/v1alpha1 | ||
| kind: OpenTelemetryCollector | ||
| metadata: | ||
| name: simplest | ||
| namespace: observability | ||
| spec: | ||
| config: | | ||
| receivers: | ||
| otlp: | ||
| protocols: | ||
| grpc: | ||
| endpoint: 0.0.0.0:9978 | ||
| http: | ||
| endpoint: 0.0.0.0:9979 | ||
|
|
||
| exporters: | ||
| logging: | ||
| otlp: | ||
| endpoint: ingest.lightstep.com:443 | ||
| headers: | ||
| "lightstep-access-token":"YOURTOKEN" | ||
|
|
||
| processors: | ||
| batch: | ||
|
|
||
| service: | ||
| pipelines: | ||
| traces: | ||
| receivers: [otlp] | ||
| processors: [batch] | ||
| exporters: [logging, otlp] | ||
| metrics: | ||
| receivers: [otlp] | ||
| processors: [batch] | ||
| exporters: [logging, otlp] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import pulumi | ||
| import pulumi_kubernetes as kubernetes | ||
|
|
||
| opentelemetry_operator_system_namespace = kubernetes.core.v1.Namespace("opentelemetry_operator_systemNamespace", | ||
| api_version="v1", | ||
| kind="Namespace", | ||
| metadata=kubernetes.meta.v1.ObjectMetaArgs( | ||
| labels={ | ||
| "control-plane": "controller-manager", | ||
| }, | ||
| name="opentelemetry-operator-system", | ||
| )) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.