0.1.3 • Published 2 years ago

appium-otel-plugin v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

appium-otel-plugin

Appium plugin to export Appium server metrics and traces using OpenTelemetry.

Run

# install plugin
appium plugin install --source=npm appium-otel-plugin

# run appium with the plugin
export OTEL_SERVICE_NAME=appium
appium server --use-plugins=appium-otel-plugin

Tracing

This plugin has 2 modes for exporting traces, which can be switched with the environment variable APPIUM_OTEL_TRACE_SEMANTIC.

HTTP Semantic Tracing (by default)

The plugin hooks and exports incoming http requests and outgoing http requests in the Appium server. It can act as distributed tracing if you enabled OpenTelemetry http instruments in your appium client.

Command Semantic Tracing

The plugin hooks an Appium command and sends a command executino as a span. It also starts a parent span at the start of Appium session and links the commands associated with the session as child spans.

Metrics

The plugin collects the following metrics:

NameTypeDesciption
appium.command.responsesCounterIncremented each time one command is completed. Collected with a status attribute indicating whether the command is successful or not.
appium.sessions.totalGaugeNumber of active sessions.
appium.sessions.oldest_ageGaugeAge (in seconds) of the oldest active session.

Configuration

You can configure the plugin with environment variables.

EnvDefaultDesciption
APPIUM_OTEL_TRACE_ENABLEDtrueEnable tracing if true.
APPIUM_OTEL_METRICS_ENABLEDtrueEnable metrics if true.
APPIUM_OTEL_TRACE_SEMANTIChttpSpecify the tracing mode. One of the following http, command.
APPIUM_OTEL_TRACE_EXPORTERotlpOne of available trace exporter. The followings are supported: otlp zipkin console
APPIUM_OTEL_ATTRIBUTES_IN_CAPSplatformNameIf the keys specified by this exist in the capabilities, they are sent as attributes if the metrics/span is associated with a session. e.g. platformName,app,udid
APPIUM_OTEL_METRICS_EXPORTERotlpOne of available trace exporter. The followings are supported: otlp console
APPIUM_OTEL_METRICS_EXPORT_INTERVAL_MILLIS10000Some metrics are collected periodically. You can change the collection period with this value.
DEBUGfalseSet loglevel of opentelemetry API to DEBUG.
APPIUM_OTEL_AUTO_DETECT_RESOURCEStrueToggle whether to enable auto detect resources.
APPIUM_OTEL_ATTRIBUTESAttributes to be added to the metrics/spans. e.g. env=development,region=us-east-1

In addition to them, you would be able to use OpenTelemetry environment variables like OTEL_SERVICE_NAME when APPIUM_OTEL_AUTO_DETECT_RESOURCES is true.

Logs

This plugin doesn't support exporting logs. If you are a Datadog user and interested in exporting logs, you might be interested in appium-ddlog-plugin.