Skip to content

Commit

Permalink
[Otel Onboarding] Adjust snippet and switch to proper release (#187480)
Browse files Browse the repository at this point in the history
This PR does three things:
* Try to download agent from the central repository (expected to fail
for now as 8.15.0 agent isn't released yet
* Adjust snippet to also set up local data dir correctly
* Update k8s manifest via
elastic/opentelemetry-dev#299

(cherry picked from commit 322248b)
  • Loading branch information
flash1293 committed Jul 4, 2024
1 parent 2f4f5ff commit e74d58e
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ export const OtelLogsPanel: React.FC = () => {
services: {
share,
http,
// context: { isServerless, stackVersion },
context: { isServerless, stackVersion },
},
} = useKibana<ObservabilityOnboardingAppServices>();

const AGENT_CDN_BASE_URL = 'snapshots.elastic.co/8.15.0-2088c97b/downloads/beats/elastic-agent';
const agentVersion = '8.15.0-SNAPSHOT';
// TODO uncomment before merge
// const AGENT_CDN_BASE_URL = 'artifacts.elastic.co/downloads/beats/elastic-agent';
const AGENT_CDN_BASE_URL = isServerless
? 'snapshots.elastic.co/8.15.0-90bfa704/downloads/beats/elastic-agent'
: 'artifacts.elastic.co/downloads/beats/elastic-agent';
// TODO change once otel flow is shown on serverless
// const agentVersion = isServerless ? setup?.elasticAgentVersion : stackVersion;
const agentVersion = isServerless ? '8.15.0-SNAPSHOT' : stackVersion;

const allDatasetsLocator =
share.url.locators.get<AllDatasetsLocatorParams>(ALL_DATASETS_LOCATOR_ID);
Expand Down Expand Up @@ -184,14 +185,11 @@ data:
otel.yaml: |
exporters:
debug:
verbosity: normal
verbosity: basic
elasticsearch:
endpoints:
- \${env:ES_ENDPOINT}
api_key: \${env:ES_API_KEY}
#logs_index: logs-otel.generic-default
# Metrics are not supported yet
#metrics_index: metrics-otel.generic-default
mapping:
mode: ecs
processors:
Expand Down Expand Up @@ -388,8 +386,8 @@ data:
collection_interval: 20s
endpoint: \${env:K8S_NODE_NAME}:10250
node: '\${env:K8S_NODE_NAME}'
# Verify if this can be removed for all CSPs
#insecure_skip_verify: true
# Required to work for all CSPs without an issue
insecure_skip_verify: true
k8s_api_config:
auth_type: serviceAccount
metric_groups:
Expand Down Expand Up @@ -553,7 +551,7 @@ spec:
curl --output elastic-distro-${agentVersion}-linux-$arch.tar.gz --url https://${AGENT_CDN_BASE_URL}/elastic-agent-${agentVersion}-linux-$arch.tar.gz --proto '=https' --tlsv1.2 -fOL && mkdir elastic-distro-${agentVersion}-linux-$arch && tar -xvf elastic-distro-${agentVersion}-linux-$arch.tar.gz -C "elastic-distro-${agentVersion}-linux-$arch" --strip-components=1 && cd elastic-distro-${agentVersion}-linux-$arch
rm ./otel.yml && cp ./otel_samples/platformlogs_hostmetrics.yml ./otel.yml && sed -i 's#\\\${env:ELASTIC_ENDPOINT}#${setup?.elasticsearchUrl}#g' ./otel.yml && sed -i 's/\\\${env:ELASTIC_API_KEY}/${apiKeyData?.apiKeyEncoded}/g' ./otel.yml`,
rm ./otel.yml && cp ./otel_samples/platformlogs_hostmetrics.yml ./otel.yml && mkdir -p ./data/otelcol && sed -i 's#\\\${env:STORAGE_DIR}#'"$PWD"/data/otelcol'#g' ./otel.yml && sed -i 's#\\\${env:ELASTIC_ENDPOINT}#${setup?.elasticsearchUrl}#g' ./otel.yml && sed -i 's/\\\${env:ELASTIC_API_KEY}/${apiKeyData?.apiKeyEncoded}/g' ./otel.yml`,
start: './otelcol --config otel.yml',
type: 'copy',
},
Expand All @@ -565,7 +563,7 @@ rm ./otel.yml && cp ./otel_samples/platformlogs_hostmetrics.yml ./otel.yml && se
curl --output elastic-distro-${agentVersion}-darwin-$arch.tar.gz --url https://${AGENT_CDN_BASE_URL}/elastic-agent-${agentVersion}-darwin-$arch.tar.gz --proto '=https' --tlsv1.2 -fOL && mkdir "elastic-distro-${agentVersion}-darwin-$arch" && tar -xvf elastic-distro-${agentVersion}-darwin-$arch.tar.gz -C "elastic-distro-${agentVersion}-darwin-$arch" --strip-components=1 && cd elastic-distro-${agentVersion}-darwin-$arch
rm ./otel.yml && cp ./otel_samples/platformlogs_hostmetrics.yml ./otel.yml && sed -i '' 's#\\\${env:ELASTIC_ENDPOINT}#${setup?.elasticsearchUrl}#g' ./otel.yml && sed -i '' 's/\\\${env:ELASTIC_API_KEY}/${apiKeyData?.apiKeyEncoded}/g' ./otel.yml`,
rm ./otel.yml && cp ./otel_samples/platformlogs_hostmetrics.yml ./otel.yml && mkdir -p ./data/otelcol && sed -i '' 's#\\\${env:STORAGE_DIR}#'"$PWD"/data/otelcol'#g' ./otel.yml && sed -i '' 's#\\\${env:ELASTIC_ENDPOINT}#${setup?.elasticsearchUrl}#g' ./otel.yml && sed -i '' 's/\\\${env:ELASTIC_API_KEY}/${apiKeyData?.apiKeyEncoded}/g' ./otel.yml`,
start: './otelcol --config otel.yml',
type: 'copy',
},
Expand Down

0 comments on commit e74d58e

Please sign in to comment.