Skip to content
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

Spacetime: Add traces into elastic-package commands using OTel #2247

Closed
wants to merge 28 commits into from

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented Nov 29, 2024

This PR makes use of OTel instrumentation to send traces to a target cluster using the autoexport package from OTEL.

It has been added a global span for each command, but just the following commands have been instrumented with specific spans:

  • elastic-package install
  • elastic-package profiles list
  • elastic-package test
  • elastic-package test [asset,pipeline,policy,static,system]

If there is no environment variable defined, the telemetry is disabled by setting the following environment variables in the code:

export OTEL_METRICS_EXPORTER=none
export OTEL_TRACES_EXPORTER=none
export OTEL_LOGS_EXPORTER=none

Pending:

  • Manage errors to set the status of each span accordingly
  • Continue adding traces to all the others commands

Screenshots

Example of the trace got running elastic-package test system:
test_system_apache_access

How to test locally

Steps to start a local cluster with the required features (APM):

  1. Add this setting to the configuration profile: stack.apm_enabled: true
    • Path to the default profile: ~/.elastic-package/profiles/default/config.yml
    echo "stack.apm_enabled: true" >> ~/.elastic-package/profiles/default/config.yml
  2. Set the following environment variables to be able to send the telemetry data to the Elastic cluster:
    • These variables can be retrieved from the APM integration configuration
    export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:8200
    export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer \"\""
  3. Run some of the commands and check the elastic-package service under APM view
    cd /path/to/package
    elastic-package profiles list
    elastic-package test system -v
    elastic-package test pipeline -v
  4. If you try to run elastic-package in a shell session without the environment variables there should not be any failure.

@mrodm mrodm self-assigned this Nov 29, 2024
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mrodm

@mrodm mrodm closed this Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants