diff --git a/README.md b/README.md index 40408a8..83f8754 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,6 @@ Use the following environment variables to configure this buildpack | Environment Variable | Required | Default | Description | |---------------------------|----------|-----------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| -| `SFX_AGENT_DISABLED` | No | `false` | Whether to disable installing the smart agent as part of the buildpack. | | `SPLUNK_ACCESS_TOKEN` | Yes | | [Splunk access token](https://docs.splunk.com/Observability/admin/authentication-tokens/org-tokens.html#admin-org-tokens). | | `SPLUNK_REALM` | Yes | | [Splunk realm](https://dev.splunk.com/observability/docs/realms_in_endpoints/). | | `SPLUNK_API_URL` | No | `https://api.SPLUNK_REALM.signalfx.com` | The Splunk API base URL. | diff --git a/bin/compile b/bin/compile index 36474ac..40be225 100644 --- a/bin/compile +++ b/bin/compile @@ -31,20 +31,6 @@ if [ -f "$ENV_DIR/SPLUNK_OTEL_VERSION" ]; then fi splunk_otel_collector="otelcol_linux_amd64" -# Use the latest version of the SignalFx Agent if none is specified -SFX_AGENT_VERSION=$(curl -s https://api.github.com/repos/signalfx/signalfx-agent/releases/latest | grep tarball_url | cut -d'"' -f4 | cut -d'/' -f8 | cut -d'v' -f2) -# Get SignalFx Agent version from the environment if available -if [ -f "$ENV_DIR/SFX_AGENT_VERSION" ]; then - SFX_AGENT_VERSION=$(cat "$ENV_DIR/SFX_AGENT_VERSION") -fi -signalfx_agent_tar="signalfx-agent-$SFX_AGENT_VERSION.tar.gz" - -# Check if the SignalFx Agent download is explicitly disabled -SFX_AGENT_DISABLED=false -if [ -f "$ENV_DIR/SFX_AGENT_DISABLED" ]; then - SFX_AGENT_DISABLED=$(cat "$ENV_DIR/SFX_AGENT_DISABLED") -fi - SPLUNK_CONFIG_DIR="$BUILD_DIR/.splunk" cp "$BUILDPACK_DIR/setup/config.yaml" "$SPLUNK_CONFIG_DIR" @@ -58,25 +44,6 @@ if [ $? -ne 0 ]; then exit 1; fi -if [ "${SFX_AGENT_DISABLED}" = "true" ]; then - echo "-----> Skipping installing the SignalFx Agent Bundle" -else - echo "-----> Downloading SignalFx Agent Bundle $SFX_AGENT_VERSION ($signalfx_agent_tar)" - wget -P "$SPLUNK_CONFIG_DIR/" "https://github.com/signalfx/signalfx-agent/releases/download/v$SFX_AGENT_VERSION/$signalfx_agent_tar" -o $signalfx_agent_tar > /dev/null 2>&1 - #curl -L "https://github.com/signalfx/signalfx-agent/releases/download/v$SFX_AGENT_VERSION/$signalfx_agent_tar" -o $SPLUNK_CONFIG_DIR/$signalfx_agent_tar > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "Downloading agent tarball failed" | indent - echo "$SFX_AGENT_VERSION may not be a valid version of the SignalFx Agent." | indent - echo "Find valid versions here: https://github.com/signalfx/signalfx-agent/tags" | indent - exit 1; - fi - - echo "-----> Extracting SignalFx Agent Bundle" - tar -xf "$SPLUNK_CONFIG_DIR/$signalfx_agent_tar" -C "$SPLUNK_CONFIG_DIR" - rm -f "$SPLUNK_CONFIG_DIR/$signalfx_agent_tar" -fi - - mkdir -p "$BUILD_DIR/.profile.d" cp "$BUILDPACK_DIR/setup/agent.sh" "$BUILD_DIR/.profile.d/" chmod +x "$BUILD_DIR/.profile.d/agent.sh" diff --git a/setup/agent.sh b/setup/agent.sh index daba7b4..6ba7b73 100644 --- a/setup/agent.sh +++ b/setup/agent.sh @@ -21,14 +21,8 @@ fi # Set configuration file export SPLUNK_CONFIG_DIR="$HOME/.splunk" -if [[ "${SFX_AGENT_DISABLED}" == "true" ]]; then - export FALLBACK_AGENT_CONFIG="$SPLUNK_CONFIG_DIR/config_without_sa.yaml" -else - export SPLUNK_COLLECTD_CONFIG_DIR="$SPLUNK_CONFIG_DIR/signalfx-agent/var/run/collectd" - mkdir -p "$SPLUNK_COLLECTD_CONFIG_DIR" - export FALLBACK_AGENT_CONFIG="$SPLUNK_CONFIG_DIR/config.yaml" -fi +export FALLBACK_AGENT_CONFIG="$SPLUNK_CONFIG_DIR/config.yaml" export DEFAULT_APP_CONFIG="$HOME/config.yaml" @@ -62,12 +56,5 @@ else mkdir -p $(dirname $SPLUNK_LOG_FILE) fi -if [[ "${SFX_AGENT_DISABLED}" != "true" ]]; then - - export SPLUNK_BUNDLE_DIR="$SPLUNK_CONFIG_DIR/signalfx-agent" - - (cd $SPLUNK_CONFIG_DIR/signalfx-agent/ && bin/patch-interpreter $SPLUNK_CONFIG_DIR/signalfx-agent/) -fi - chmod a+x $SPLUNK_CONFIG_DIR/otelcol_linux_amd64 $SPLUNK_CONFIG_DIR/otelcol_linux_amd64 > $SPLUNK_LOG_FILE 2>&1& diff --git a/setup/config.yaml b/setup/config.yaml index 254dbfa..559b837 100644 --- a/setup/config.yaml +++ b/setup/config.yaml @@ -1,10 +1,3 @@ -config_sources: - env: - defaults: - HEROKU_DYNO_ID: "unset" - HEROKU_APP_ID: "unset" - HEROKU_APP_NAME: "unset" - extensions: health_check: endpoint: 0.0.0.0:13133 @@ -15,10 +8,6 @@ extensions: endpoint: "${SPLUNK_API_URL}" # Use instead when sending to gateway #endpoint: "${SPLUNK_GATEWAY_URL}" - smartagent: - bundleDir: "${SPLUNK_BUNDLE_DIR}" - collectd: - configDir: "${SPLUNK_COLLECTD_DIR}" zpages: #endpoint: 0.0.0.0:55679 memory_ballast: @@ -54,8 +43,6 @@ receivers: - source_labels: [ __name__ ] regex: '.*grpc_io.*' action: drop - smartagent/heroku-metadata: - type: heroku-metadata smartagent/signalfx-forwarder: type: signalfx-forwarder listenAddress: 0.0.0.0:9080 @@ -69,40 +56,8 @@ processors: memory_limiter: check_interval: 2s limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB} - attributes/heroku: - actions: - - action: insert - key: dyno_id - value: ${env:HEROKU_DYNO_ID} - - action: insert - key: app_id - value: ${env:HEROKU_APP_ID} - - action: insert - key: app_name - value: ${env:HEROKU_APP_NAME} - metricstransform/heroku: - transforms: - - include: .* - match_type: regexp - action: update - operations: - - action: add_label - new_label: dyno_id - new_value: ${env:HEROKU_DYNO_ID} - - action: add_label - new_label: app_id - new_value: ${env:HEROKU_APP_ID} - - action: add_label - new_label: app_name - new_value: ${env:HEROKU_APP_NAME} - # Optional: The following processor can be used to add a default "deployment.environment" attribute to the logs and - # traces when it's not populated by instrumentation libraries. - # If enabled, make sure to enable this processor in the pipeline below. - #resource/add_environment: - #attributes: - #- action: insert - #key: deployment.environment - #value: staging/production/... + resourcedetection: + detectors: [heroku] exporters: # Traces @@ -135,16 +90,15 @@ service: processors: - memory_limiter - batch - - attributes/heroku - #- resource/add_environment + - resourcedetection exporters: [sapm, signalfx] metrics: receivers: [otlp, signalfx, smartagent/heroku-metadata, smartagent/signalfx-forwarder] - processors: [memory_limiter, batch, metricstransform/heroku] + processors: [memory_limiter, batch, resourcedetection] exporters: [signalfx] metrics/internal: receivers: [prometheus/internal] - processors: [memory_limiter, batch, metricstransform/heroku] + processors: [memory_limiter, batch, resourcedetection] exporters: [signalfx] logs/profiling: receivers: [otlp] diff --git a/setup/config_without_sa.yaml b/setup/config_without_sa.yaml deleted file mode 100644 index df9c10d..0000000 --- a/setup/config_without_sa.yaml +++ /dev/null @@ -1,142 +0,0 @@ -config_sources: - env: - defaults: - HEROKU_DYNO_ID: "unset" - HEROKU_APP_ID: "unset" - HEROKU_APP_NAME: "unset" - -extensions: - health_check: - endpoint: 0.0.0.0:13133 - http_forwarder: - ingress: - endpoint: 0.0.0.0:6060 - egress: - endpoint: "${SPLUNK_API_URL}" - # Use instead when sending to gateway - #endpoint: "${SPLUNK_GATEWAY_URL}" - zpages: - #endpoint: 0.0.0.0:55679 - memory_ballast: - size_mib: ${SPLUNK_BALLAST_SIZE_MIB} - -receivers: - jaeger: - protocols: - grpc: - endpoint: 0.0.0.0:14250 - thrift_binary: - endpoint: 0.0.0.0:6832 - thrift_compact: - endpoint: 0.0.0.0:6831 - thrift_http: - endpoint: 0.0.0.0:14268 - otlp: - protocols: - grpc: - endpoint: 0.0.0.0:4317 - http: - endpoint: 0.0.0.0:4318 - # This section is used to collect the OpenTelemetry Collector metrics - # Even if just a Splunk APM customer, these metrics are included - prometheus/internal: - config: - scrape_configs: - - job_name: 'otel-collector' - scrape_interval: 10s - static_configs: - - targets: ['0.0.0.0:8888'] - metric_relabel_configs: - - source_labels: [ __name__ ] - regex: '.*grpc_io.*' - action: drop - signalfx: - endpoint: 0.0.0.0:9943 - zipkin: - endpoint: 0.0.0.0:9411 - -processors: - batch: - memory_limiter: - check_interval: 2s - limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB} - attributes/heroku: - actions: - - action: insert - key: dyno_id - value: ${env:HEROKU_DYNO_ID} - - action: insert - key: app_id - value: ${env:HEROKU_APP_ID} - - action: insert - key: app_name - value: ${env:HEROKU_APP_NAME} - metricstransform/heroku: - transforms: - - include: .* - match_type: regexp - action: update - operations: - - action: add_label - new_label: dyno_id - new_value: ${env:HEROKU_DYNO_ID} - - action: add_label - new_label: app_id - new_value: ${env:HEROKU_APP_ID} - - action: add_label - new_label: app_name - new_value: ${env:HEROKU_APP_NAME} - # Optional: The following processor can be used to add a default "deployment.environment" attribute to the logs and - # traces when it's not populated by instrumentation libraries. - # If enabled, make sure to enable this processor in the pipeline below. - #resource/add_environment: - #attributes: - #- action: insert - #key: deployment.environment - #value: staging/production/... - -exporters: - # Traces - sapm: - access_token: "${SPLUNK_ACCESS_TOKEN}" - endpoint: "${SPLUNK_TRACE_URL}" - # Metrics + Events - signalfx: - access_token: "${SPLUNK_ACCESS_TOKEN}" - api_url: "${SPLUNK_API_URL}" - ingest_url: "${SPLUNK_INGEST_URL}" - splunk_hec/profiling: - token: "${SPLUNK_ACCESS_TOKEN}" - endpoint: "${SPLUNK_PROFILING_URL}" - # Send to gateway - #otlp: - # endpoint: "${SPLUNK_GATEWAY_URL}:4317" - # insecure: true - - # Debug. Add this to the pipeline you want to debug. - logging: - loglevel: debug - -service: - extensions: [health_check, http_forwarder, zpages, memory_ballast] - pipelines: - traces: - receivers: [jaeger, otlp, zipkin] - processors: - - memory_limiter - - batch - - attributes/heroku - #- resource/add_environment - exporters: [sapm, signalfx] - metrics: - receivers: [otlp, signalfx] - processors: [memory_limiter, batch, metricstransform/heroku] - exporters: [signalfx] - metrics/internal: - receivers: [prometheus/internal] - processors: [memory_limiter, batch, metricstransform/heroku] - exporters: [signalfx] - logs/profiling: - receivers: [otlp] - processors: [memory_limiter, batch, attributes/heroku] - exporters: [splunk_hec/profiling]