Skip to content

Commit

Permalink
improve startup file handling of env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
pnickolov committed Feb 8, 2024
1 parent 125903a commit d4c0a18
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion startup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/sh
export OTEL_RESOURCE_ATTRIBUTES="$OTEL_RESOURCE_ATTRIBUTES","container.id="$(sed -rn "/\/sys\/fs\/cgroup\/devices/ s#.*/(cri-containerd-)?([0-9a-f]{64})(\.scope)? .*#\2#p" /proc/self/mountinfo)
if [[ -n "$OTEL_RESOURCE_ATTRIBUTES" ]]; then
OTEL_RESOURCE_ATTRIBUTES="$OTEL_RESOURCE_ATTRIBUTES,"
fi
export OTEL_RESOURCE_ATTRIBUTES="${OTEL_RESOURCE_ATTRIBUTES}container.id="$(sed -rn "/\/sys\/fs\/cgroup\/devices/ s#.*/(cri-containerd-)?([0-9a-f]{64})(\.scope)? .*#\2#p" /proc/self/mountinfo)
echo "Starting 'co-http $@' with the following environment variables:"
echo "OTEL_EXPORTER_OTLP_ENDPOINT=$OTEL_EXPORTER_OTLP_ENDPOINT"
echo "OTEL_EXPORTER_OTLP_INSECURE=$OTEL_EXPORTER_OTLP_INSECURE"
echo "OTEL_RESOURCE_ATTRIBUTES=$OTEL_RESOURCE_ATTRIBUTES"
echo "OTEL_TRACES_EXPORTER=$OTEL_TRACES_EXPORTER"
echo "OTEL_SERVICE_NAME=$OTEL_SERVICE_NAME"
exec /co-http "$@"

0 comments on commit d4c0a18

Please sign in to comment.