Skip to content

Commit d5638d4

Browse files
committed
[distributions/paas] New PaaS distribution
1 parent fd75933 commit d5638d4

File tree

9 files changed

+320
-0
lines changed

9 files changed

+320
-0
lines changed

.chloggen/paas.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: new_component
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: paas
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Add a new distribution for PaaS platforms.
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [459]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: []
26+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: 2
2+
project_name: opentelemetry-collector-releases
3+
env:
4+
- COSIGN_YES=true
5+
- LD_FLAGS=-s -w
6+
- CGO_ENABLED=0
7+
- BUILD_FLAGS=-trimpath
8+
builds:
9+
- id: otelcol-paas-linux
10+
goos:
11+
- linux
12+
goarch:
13+
- amd64
14+
- arm64
15+
dir: _build
16+
binary: otelcol-paas
17+
ldflags:
18+
- '{{ .Env.LD_FLAGS }}'
19+
flags:
20+
- '{{ .Env.BUILD_FLAGS }}'
21+
archives:
22+
- id: otelcol-paas
23+
builds:
24+
- otelcol-paas-linux
25+
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}'
26+
checksum:
27+
name_template: '{{ .ProjectName }}_otelcol-paas_checksums.txt'
28+
sboms:
29+
- id: archive
30+
artifacts: archive
31+
- id: package
32+
artifacts: package
33+
monorepo:
34+
tag_prefix: v
35+
partial:
36+
by: target
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# OpenTelemetry Collector PaaS Distro
2+
3+
This distribution is made specifically to be used in a PaaS environment. It contains a subset of components from [OpenTelemetry Collector Core](https://github.com/open-telemetry/opentelemetry-collector) and [OpenTelemetry Collector Contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib).
4+
5+
## Components
6+
7+
The full list of components is available in the [manifest](manifest.yaml).
8+
9+
### Rules for Component Inclusion
10+
11+
- Only includes components from Contrib and Core.
12+
- Only components that are Alpha or higher.
13+
- All receivers must facilitate the collection of data that is generated by the application running in the PaaS environment or enriching the data by introspecting the PaaS platform.
14+
- All components must be vendor-neutral.
15+
- Only exporters that use OTLP are allowed.
16+
- To facilitate troubleshooting, the nop and debug exporters are present as exceptions.
17+
18+
## Heroku buildpack
19+
20+
This distribution works as a Heroku buildpack.
21+
22+
### Installation
23+
24+
[Install the Heroku CLI, login, and create an
25+
app](https://devcenter.heroku.com/articles/heroku-cli). Add and configure the
26+
buildpack:
27+
28+
```
29+
# cd into the Heroku project directory
30+
# WARNING: running `heroku` command outside of project directories
31+
# will result in unexpected behavior
32+
cd <HEROKU_APP_DIRECTORY>
33+
34+
# Configure Heroku App to expose Dyno metadata
35+
# This metadata is required by the OpenTelemetry Collector to
36+
# set global dimensions such as `app_name`, `app_id` and `dyno_id`.
37+
# See [here](https://devcenter.heroku.com/articles/dyno-metadata) for more information.
38+
heroku labs:enable runtime-dyno-metadata
39+
40+
# Add buildpack for OpenTelemetry Collector
41+
# Note both lines are required together
42+
# TODO check URI works
43+
heroku buildpacks:add https://github.com/open-telemetry/opentelemetry-collector-releases.git/distributions/otelcol-paas#\
44+
$(curl -s https://api.github.com/repos/open-telemetry/opentelemetry-collector-releases/releases | grep '"tag_name"' | head -n 1 | cut -d'"' -f4)
45+
# For production environment using an explict version number is advised
46+
#heroku buildpacks:add https://github.com/open-telemetry/opentelemetry-collector-releases.git#<TAG_NAME>
47+
48+
# Set required environment variables
49+
heroku config:set OTLP_ENDPOINT=<YOUR OTLP ENDPOINT>
50+
51+
# Optionally define custom configuration file in your Heroku project directory
52+
#heroku config:set CONFIG=/app/mydir/myconfig.yaml
53+
54+
# Create an emptycommit and deploy your app (assumes `main` branch exists)
55+
git commit --allow-empty -m "empty commit"
56+
git push heroku main
57+
58+
# Check logs
59+
#heroku logs -a <app-name> --tail
60+
```
61+
62+
## Advanced Configuration
63+
64+
Use the following environment variables to configure this buildpack:
65+
66+
67+
| Environment Variable | Required | Default | Description |
68+
|----------------------|----------|------------------------------|---------------------------------------|
69+
| `OTLP_ENDPOINT` | Yes | | OTLP exporter endpoint |
70+
| `CONFIG` | No | $BUILD_DIR/.otel/config.yaml | Collector configuration file location |
71+
| `LOG_FILE` | No | `/dev/stdout` | Optional log file location |
72+
| `MEMORY_LIMIT_MIB` | No | `512` | Memory limit |
73+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh
2+
3+
// Copyright The OpenTelemetry Authors
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
BUILD_DIR=$1
7+
CACHE_DIR=$2
8+
ENV_DIR=$3
9+
BUILDPACK_DIR=$(cd "$(dirname "$0")"; cd ..; pwd)
10+
11+
# Use the latest version of the Collector PaaS distribution if none is specified
12+
OTEL_VERSION=$(curl -s https://api.github.com/repos/open-telemetry/opentelemetry-collector-releases/releases/latest | grep tarball_url | cut -d'"' -f4 | cut -d'/' -f8 | cut -d'v' -f2)
13+
# Get OpenTelemetry Collector version from the environment if available
14+
if [ -f "$ENV_DIR/OTEL_VERSION" ]; then
15+
OTEL_VERSION=$(cat "$ENV_DIR/OTEL_VERSION")
16+
fi
17+
otel_collector="otelcol-paas-linux"
18+
19+
CONFIG_DIR="$BUILD_DIR/.otel"
20+
cp "$BUILDPACK_DIR/setup/config.yaml" "$CONFIG_DIR"
21+
22+
echo "-----> Downloading OpenTelemetry Collector $OTEL_VERSION ($otel_collector)"
23+
wget -P "$CONFIG_DIR/" "https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v$OTEL_VERSION/$otel_collector" -o $otel_collector > /dev/null 2>&1
24+
if [ $? -ne 0 ]; then
25+
echo "Downloading OpenTelemetry Collector tarball failed"
26+
echo "$OTEL_VERSION may not be a valid version of the OpenTelemetry Collector."
27+
echo "Find valid versions here: https://github.com/open-telemetry/opentelemetry-collector-releases/tags"
28+
exit 1;
29+
fi
30+
31+
mkdir -p "$BUILD_DIR/.profile.d"
32+
cp "$BUILDPACK_DIR/setup/otel-collector.sh" "$BUILD_DIR/.profile.d/"
33+
34+
chmod a+x $CONFIG_DIR/$otel_collector
35+
chmod +x "$BUILD_DIR/.profile.d/otel-collector.sh"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
// Copyright The OpenTelemetry Authors
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
echo "OpenTelemetry Collector installation" && exit 0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
// Copyright The OpenTelemetry Authors
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
cat <<EOF
7+
---
8+
EOF
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
extensions:
2+
health_check:
3+
endpoint: 0.0.0.0:13133
4+
zpages:
5+
6+
receivers:
7+
otlp:
8+
protocols:
9+
grpc:
10+
endpoint: 0.0.0.0:4317
11+
http:
12+
endpoint: 0.0.0.0:4318
13+
# This section is used to collect the OpenTelemetry Collector metrics
14+
prometheus/internal:
15+
config:
16+
scrape_configs:
17+
- job_name: 'otel-collector'
18+
scrape_interval: 10s
19+
static_configs:
20+
- targets: ['0.0.0.0:8888']
21+
metric_relabel_configs:
22+
- source_labels: [ __name__ ]
23+
regex: '.*grpc_io.*'
24+
action: drop
25+
zipkin:
26+
endpoint: 0.0.0.0:9411
27+
28+
processors:
29+
batch:
30+
memory_limiter:
31+
check_interval: 2s
32+
limit_mib: ${env:MEMORY_LIMIT_MIB:-512}
33+
resourcedetection:
34+
detectors:
35+
- heroku
36+
37+
exporters:
38+
otlp:
39+
endpoint: ${env:OTLP_ENDPOINT}
40+
#otlphttp:
41+
# endpoint: ${env:OTLP_HTTP_ENDPOINT}
42+
43+
# Debug. Add this to the pipeline you want to debug.
44+
logging:
45+
loglevel: debug
46+
47+
service:
48+
extensions:
49+
- health_check
50+
- zpages
51+
pipelines:
52+
traces:
53+
receivers:
54+
- otlp
55+
- zipkin
56+
processors:
57+
- memory_limiter
58+
- batch
59+
- resourcedetection
60+
exporters:
61+
- otlp
62+
metrics:
63+
receivers:
64+
- otlp
65+
processors:
66+
- memory_limiter
67+
- batch
68+
- resourcedetection
69+
exporters:
70+
- otlp
71+
metrics/internal:
72+
receivers:
73+
- prometheus/internal
74+
processors:
75+
- memory_limiter
76+
- batch
77+
- resourcedetection
78+
exporters:
79+
- otlp
80+
logs:
81+
receivers:
82+
- otlp
83+
processors:
84+
- memory_limiter
85+
- batch
86+
exporters:
87+
- otlp
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
// Copyright The OpenTelemetry Authors
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
if [ "$DYNOTYPE" == "run" ]; then
7+
exit 0
8+
fi
9+
10+
# Set configuration file
11+
export CONFIG_DIR="$HOME/.otel"
12+
13+
if [[ -z "$CONFIG" ]]; then
14+
export CONFIG="${$CONFIG_DIR/config.yaml}"
15+
fi
16+
17+
# Set log file
18+
if [[ -z "$LOG_FILE" ]]; then
19+
export LOG_FILE=/dev/stdout
20+
else
21+
mkdir -p $(dirname $LOG_FILE)
22+
fi
23+
24+
$CONFIG_DIR/otelcol-paas-linux --config $CONFIG > $LOG_FILE 2>&1 &
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
dist:
2+
module: github.com/open-telemetry/opentelemetry-collector-releases/paas
3+
name: otelcol-paas
4+
description: OpenTelemetry Collector PaaS
5+
version: 0.120.1
6+
output_path: ./_build
7+
otelcol_version: 0.120.1
8+
9+
receivers:
10+
- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.120.1
11+
12+
exporters:
13+
- gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.120.1
14+
- gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.120.1
15+
- gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.120.1
16+
17+
extensions:
18+
- gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.120.1
19+
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.120.1
20+
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.120.1
21+
22+
processors:
23+
- gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.120.1
24+
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.120.1
25+
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.120.1

0 commit comments

Comments
 (0)