-
Notifications
You must be signed in to change notification settings - Fork 139
[WIP] observability with bootc example (kepler & opentelemetry-collector) #666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sallyom
wants to merge
1
commit into
containers:main
Choose a base branch
from
sallyom:kepler-option
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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,26 @@ | ||
# Embed Kepler systemd service | ||
# and opentelemetry-collector systemd service with collector config. | ||
# | ||
# This is meant to be built as an add-on build to any other bootc/Containerfile or bootc/Containerfile.nocache | ||
# See common/README_bootc_observability.md | ||
|
||
FROM quay.io/replace/centos-bootc:replace | ||
|
||
# Add Kepler service and opentelemetry-collector | ||
RUN curl -L -O https://github.com/sustainable-computing-io/kepler/releases/download/v0.7.10/kepler.rpm.tar.gz && \ | ||
tar xvzf kepler.rpm.tar.gz && \ | ||
dnf -y install RPMS/noarch/container-kepler-0.7.10-1.noarch.rpm && \ | ||
sudo systemctl enable container-kepler | ||
|
||
# See common/observability/mTLS for example files or adjust as necessary | ||
COPY mTLS /usr/share/mTLS | ||
|
||
# Add OpenTelemetry Collector with configuration file | ||
RUN sudo dnf copr enable -y frzifus/redhat-opentelemetry-collector-main && \ | ||
sudo dnf install -y opentelemetry-collector && \ | ||
sudo mkdir /etc/otelcol-logs && \ | ||
sudo chown -R observability:observability /etc/otelcol-logs && \ | ||
sudo systemctl enable opentelemetry-collector | ||
|
||
# See common/observability/kepler for example opentelemetry-collector config and adjust as necessary | ||
COPY kepler/otelcol-config.yaml /etc/opentelemetry-collector/configs/10-custom.yaml |
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,26 @@ | ||
# Bootc image with Kepler and OpenTelemetry Collector | ||
|
||
Follow this to build a bootc image with a chatbot, kepler, and opentelemetry-collector systemd services. | ||
This example assumes mTLS authentication. The Containerfile assumes certificate and keys | ||
are in `./mTLS` directory. Adjust the Containerfile accordingly. For an example setting up mTLS to send OTLP data to | ||
an OpenTelemetry Collector running in OpenShift, see | ||
[redhat-et/edge-ocp-observability](https://github.com/redhat-et/edge-ocp-observability/blob/main/observability-hub/mtls/generate_certs.sh). | ||
[kepler/otelcol-config.yaml](./kepler/otelcol-config.yaml) is an example collector configuration. Replace the OTLP_EXPORT_ENDPOINT with a real value and | ||
uncomment the otlphttp exporter in the metrics pipeline to export the data if sending to an external endpoint. | ||
As is, OTLP metrics from Kepler will be visible in opentelemetry-collector logs with `systemctl status opentelemetry-collector`. | ||
|
||
Before running the below, update the Containerfile or populate a `mTLS` directory with expected files. | ||
Also, update the opentelemetry collector configuration file to match your needs. | ||
|
||
```bash | ||
cd recipes/natural_language_processing/chatbot | ||
make BOOTC_IMAGE=quay.io/sallyom/centos-bootc:chatbot ARCH=x86_64 CONTAINERFILE=bootc/Containerfile.nocache bootc | ||
|
||
cd ../../../observability | ||
podman build \ | ||
--from quay.io/sallyom/centos-bootc:chatbot \ | ||
--arch x86_64 \ | ||
--security-opt label=disable \ | ||
--cap-add SYS_ADMIN \ | ||
-t quay.io/sallyom/centos-bootc:chatbot-kepler . | ||
``` |
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,57 @@ | ||
--- | ||
extensions: | ||
file_storage: | ||
# this dir must exist on filesystem where otelcollector is running | ||
directory: /etc/otelcol-logs | ||
timeout: 10s | ||
receivers: | ||
journald: | ||
units: | ||
- container-kepler | ||
- opentelemetry-collector | ||
#- ovn-kubernetes | ||
#- crio | ||
priority: info | ||
prometheus: | ||
config: | ||
scrape_configs: | ||
- job_name: 'rhel-kepler-local' | ||
scrape_interval: 5s | ||
static_configs: | ||
- targets: ['0.0.0.0:8888'] # container-kepler service | ||
processors: | ||
batch: | ||
memory_limiter: | ||
check_interval: 5s | ||
limit_percentage: 95 | ||
spike_limit_percentage: 25 | ||
exporters: | ||
otlphttp: | ||
endpoint: OTLP_EXPORT_ENDPOINT | ||
tls: | ||
insecure: false | ||
cert_file: /usr/share/mTLS/server.crt | ||
key_file: /usr/share/mTLS/server.key | ||
ca_file: /usr/share/mTLS/ca.crt | ||
otlp: | ||
endpoint: OTLP_EXPORT_ENDPOINT | ||
tls: | ||
insecure: false | ||
cert_file: /usr/share/mTLS/server.crt | ||
key_file: /usr/share/mTLS/server.key | ||
ca_file: /usr/share/mTLS/ca.crt | ||
debug: | ||
verbosity: detailed | ||
service: | ||
extensions: [file_storage] | ||
telemetry: | ||
metrics: | ||
address: 0.0.0.0:9999 | ||
pipelines: | ||
logs: | ||
receivers: [journald] | ||
exporters: [debug] | ||
metrics: | ||
receivers: [prometheus] | ||
#exporters: [otlphttp] | ||
exporters: [debug] |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isnt there a better place for cached data? AFAIK
/var
should be mutable? Maybe we can use something like/var/cache/opentelemetry-collector/
? wdyt?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes lets treat /usr and /etc as read-only from apps point of view.