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

add user-agent spec + gherkin spec #514

Merged
merged 5 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions specs/agents/transport.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

Agents send data to the APM Server as JSON (application/json) or ND-JSON (application/x-ndjson) over HTTP. We describe here various details to guide transport implementation.

### User-Agent

In order to help debugging and gathering usage statistics, agents should use one following values for the `User-Agent` HTTP header:
trentm marked this conversation as resolved.
Show resolved Hide resolved

- Header value should start with `elasticapm-${language}/${agent.version}`.
- If both `service.name` and `service.version` are set, append ` ${service.name}/${service.version}`
- If only `service.name` is set, append `${service.name}`

Examples:
- `elasticapm-java/v1.25.0`
- `elasticapm-ruby/4.4.0 myservice`
- `elasticapm-python/6.4.0 myservice/v42.7`

trentm marked this conversation as resolved.
Show resolved Hide resolved
### Background sending

In order to avoid impacting application performance and behaviour, agents should (where possible) send data in a non-blocking manner, e.g. via a background thread/goroutine/process/what-have-you, or using asynchronous I/O.
Expand Down
19 changes: 19 additions & 0 deletions tests/agents/gherkin-specs/user_agent.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature: Agent Transport User agent Header

Scenario: Default user-agent
Given an agent
When service name is not set
When service version is not set
Then the User-Agent header matches regex 'elasticapm-(java|ruby|python|dotnet|nodejs|go|php)/[^ ]*'
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved

Scenario: User-agent with service name only
Given an agent
When service name is set to 'myService'
When service version is not set
Then the User-Agent header matches regex 'elasticapm-(java|ruby|python|dotnet|nodejs|go|php)/[^ ]* myService'

Scenario: User-agent with service name and service version
Given an agent
When service name is set to 'myService'
When service version is set to 'v42'
Then the User-Agent header matches regex 'elasticapm-(java|ruby|python|dotnet|nodejs|go|php)/[^ ]* myService/v42'