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

[docs] Prepare docs #328

Merged
merged 27 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9b38831
initial outline
colleenmcginnis Jul 10, 2024
e44e2a2
align with other distro docs
colleenmcginnis Jul 12, 2024
24a80bb
align with other languages
colleenmcginnis Jul 15, 2024
ca8fc23
clean up code comments, align with other distro docs
colleenmcginnis Jul 17, 2024
ce09010
reframe generated guide as migration guide
colleenmcginnis Jul 22, 2024
0ad5009
update intro, add questions
colleenmcginnis Jul 24, 2024
bcd7053
update getting started
colleenmcginnis Jul 25, 2024
16435f0
update configuration file
colleenmcginnis Jul 25, 2024
df5d7d2
lint content
colleenmcginnis Jul 25, 2024
b448968
address feedback from @bmorelli25
colleenmcginnis Jul 25, 2024
22c264d
translate from asciidoc to markdown
colleenmcginnis Jul 31, 2024
597a8a1
merge intro content and README content, link to docs from README
colleenmcginnis Aug 2, 2024
a7bea62
adjust for github audience
colleenmcginnis Aug 2, 2024
907bf1d
fix some formatting
colleenmcginnis Aug 2, 2024
c0b561c
update docs automation
colleenmcginnis Aug 2, 2024
14028dc
update reference to automation
colleenmcginnis Aug 2, 2024
be1578a
Update README.md
colleenmcginnis Aug 8, 2024
c651698
update naming
colleenmcginnis Aug 13, 2024
5118a24
address feedback from @mdbirnstiehl
colleenmcginnis Aug 13, 2024
0e35f17
Merge branch 'main' into prep-docs
colleenmcginnis Aug 13, 2024
e181c25
update link text
colleenmcginnis Aug 13, 2024
59685f5
one more for to of
colleenmcginnis Aug 13, 2024
7b4daff
fix ConfigurationExporterTest to generate markdown instead of asciidoc
jackshirazi Aug 14, 2024
603fdd3
apply suggestions from code review
colleenmcginnis Aug 14, 2024
b524161
update download section
colleenmcginnis Aug 14, 2024
08fbe23
apply suggestions from code review
colleenmcginnis Aug 15, 2024
419d641
Merge branch 'main' into prep-docs
colleenmcginnis Aug 15, 2024
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
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Elastic Distribution for OpenTelemetry Java
Elastic Distribution of OpenTelemetry Java
Copyright 2023-2024 Elasticsearch B.V.

This project is licensed under the Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0
Expand Down
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# Elastic Distribution for OpenTelemetry Java
# Elastic Distribution of OpenTelemetry Java

[![Snapshot status](https://badge.buildkite.com/e527255a5d6e7f5a940bc71911d8bc2be25d16702d7642c0d6.svg)](https://buildkite.com/elastic/elastic-otel-java-snapshot)
[![Release status](https://badge.buildkite.com/8bac74f475ea0d5d17ea3ea2ecf2c27a319414b97ce03dbd21.svg)](https://buildkite.com/elastic/elastic-otel-java-release)

This project is the Elastic distribution of the [OpenTelemetry Java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation).
> [!WARNING]
> The Elastic Distribution of OpenTelemetry Java is not yet recommended for production use. Functionality may be changed or removed in future releases. Alpha releases are not subject to the support SLA of official GA features.
>
> We welcome your feedback! You can reach us by [opening a GitHub issue](https://github.com/elastic/elastic-otel-java/issues) or starting a discussion thread on the [Elastic Discuss forum](https://discuss.elastic.co/tags/c/observability/apm/58/java).

This is currently an early alpha release and should be used mostly for testing.
The Elastic Distribution of OpenTelemetry Java (EDOT Java) is a customized version of the [OpenTelemetry Java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation). Use EDOT Java to start the OpenTelemetry SDK with your Java application, and automatically capture tracing data, performance metrics, and logs. Traces, metrics, and logs can be sent to any OpenTelemetry Protocol (OTLP) collector you choose.

With EDOT Java you have access to all the features of the OpenTelemetry Java agent plus:

* Access to SDK improvements and bug fixes contributed by the Elastic team _before_ the changes are available upstream in OpenTelemetry repositories.
* Access to optional features that can enhance OpenTelemetry data that is being sent to Elastic (for example, [inferred spans](#inferred-spans) and [span stacktrace](#span-stacktrace)).

**Ready to try out EDOT Java?** Follow the step-by-step instructions in [Get started](./docs/get-started.md).

## Download

Expand All @@ -21,6 +31,13 @@ Use the `-javaagent:` JVM argument with the path to agent jar.
java -javaagent:/path/to/agent.jar \
-jar myapp.jar
```
colleenmcginnis marked this conversation as resolved.
Show resolved Hide resolved

## Read the docs

* [Get started](./docs/get-started.md)
* [Configure the Elastic Distribution of OpenTelemetry Java](./docs/configure.md)
* [Migrate to the Elastic Distribution of OpenTelemetry Java](./docs/migrate.md) from the Elastic APM Java agent

colleenmcginnis marked this conversation as resolved.
Show resolved Hide resolved
## Build and Test

Execute `./gradlew assemble`, the agent binary will be in `./agent/build/libs/elastic-otel-javaagent-${VERSION}.jar`
Expand Down Expand Up @@ -111,5 +128,5 @@ if(ctx.numeric_labels != null && ctx.numeric_labels.elastic_span_self_time != nu

# License

The Elastic Distribution for OpenTelemetry Java is licensed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html).
The Elastic Distribution of OpenTelemetry Java is licensed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html).
colleenmcginnis marked this conversation as resolved.
Show resolved Hide resolved

4 changes: 2 additions & 2 deletions agent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
alias(catalog.plugins.licenseReport)
}

description = "Elastic Distribution for OpenTelemetry Java Agent"
description = "Elastic Distribution of OpenTelemetry Java Agent"

base.archivesName.set("elastic-otel-javaagent")

Expand Down Expand Up @@ -92,7 +92,7 @@ tasks {
var year = Calendar.getInstance().get(Calendar.YEAR)
var lines = ArrayList<String>(
listOf(
"Elastic Distribution for OpenTelemetry Java",
"Elastic Distribution of OpenTelemetry Java",
"Copyright 2023-${year} Elasticsearch B.V.",
"",
"This project is licensed under the Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0",
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Properties versionProperties = new Properties()
versionProperties.load(new FileInputStream(file('version.properties')))
version = versionProperties.get("version")

description = "Elastic Distribution for OpenTelemetry Java"
description = "Elastic Distribution of OpenTelemetry Java"

defaultTasks("agent:assemble")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,31 @@ public LegacyConfigurations() {
private void addAllOptions() {
addDocumentationOption(
"server_url",
"The Elastic https://www.elastic.co/guide/en/apm/agent/java/current/config-reporter.html#config-server-url[`server_url`] option corresponds to the OpenTelemetry https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_endpoint[`OTEL_EXPORTER_OTLP_ENDPOINT`] option.");
"The Elastic [`server_url`](https://www.elastic.co/guide/en/apm/agent/java/current/config-reporter.html#config-server-url) option corresponds to the OpenTelemetry [`OTEL_EXPORTER_OTLP_ENDPOINT`](https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_endpoint) option.");
addDocumentationOption(
"server_urls",
"The Elastic https://www.elastic.co/guide/en/apm/agent/java/current/config-reporter.html#config-server-urls[`server_urls`] option has no equivalent OpenTelemetry option - you can only specify one endpoint. Use https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_endpoint[OTEL_EXPORTER_OTLP_ENDPOINT] instead.");
"The Elastic [`server_urls`](https://www.elastic.co/guide/en/apm/agent/java/current/config-reporter.html#config-server-urls) option has no equivalent OpenTelemetry option - you can only specify one endpoint. Use [OTEL_EXPORTER_OTLP_ENDPOINT](https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_endpoint) instead.");
addDocumentationOption(
"secret_token",
"The Elastic https://www.elastic.co/guide/en/apm/agent/java/current/config-reporter.html#config-secret-token[`secret_token`] option corresponds to the OpenTelemetry https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_headers[OTEL_EXPORTER_OTLP_HEADERS] option. For example: `OTEL_EXPORTER_OTLP_HEADERS=\"Authorization=Bearer an_apm_secret_token\"`.");
"The Elastic [`secret_token`](https://www.elastic.co/guide/en/apm/agent/java/current/config-reporter.html#config-secret-token) option corresponds to the OpenTelemetry [OTEL_EXPORTER_OTLP_HEADERS](https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_headers) option. For example: `OTEL_EXPORTER_OTLP_HEADERS=\"Authorization=Bearer an_apm_secret_token\"`.");
addDocumentationOption(
"api_key",
"The Elastic https://www.elastic.co/guide/en/apm/agent/java/current/config-reporter.html#config-api-key[`api_key`] option corresponds to the OpenTelemetry https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_headers[OTEL_EXPORTER_OTLP_HEADERS] option. For example:`OTEL_EXPORTER_OTLP_HEADERS=\"Authorization=ApiKey an_api_key\"`.");
"The Elastic [`api_key`](https://www.elastic.co/guide/en/apm/agent/java/current/config-reporter.html#config-api-key) option corresponds to the OpenTelemetry [OTEL_EXPORTER_OTLP_HEADERS](https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_headers) option. For example:`OTEL_EXPORTER_OTLP_HEADERS=\"Authorization=ApiKey an_api_key\"`.");
addDocumentationOption(
"service_name",
"The Elastic https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-service-name[`service_name`] option corresponds to the OpenTelemetry https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_service_name[OTEL_SERVICE_NAME] option. The service name value can also be set using https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_resource_attributes[OTEL_RESOURCE_ATTRIBUTES], for example, `OTEL_RESOURCE_ATTRIBUTES=service.name=myservice`. If `OTEL_SERVICE_NAME` is set, it takes precedence over the resource attribute.");
"The Elastic [`service_name`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-service-name) option corresponds to the OpenTelemetry [OTEL_SERVICE_NAME](https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_service_name) option. The service name value can also be set using [OTEL_RESOURCE_ATTRIBUTES](https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_resource_attributes). For example: `OTEL_RESOURCE_ATTRIBUTES=service.name=myservice`. If `OTEL_SERVICE_NAME` is set, it takes precedence over the resource attribute.");
addDocumentationOption(
"enabled",
"The Elastic https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-enabled[`enabled`] option corresponds to the OpenTelemetry https://opentelemetry.io/docs/languages/java/automatic/agent-config/#suppressing-specific-auto-instrumentation[OTEL_JAVAAGENT_ENABLED] option.");
"The Elastic [`enabled`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-enabled) option corresponds to the OpenTelemetry [OTEL_JAVAAGENT_ENABLED](https://opentelemetry.io/docs/languages/java/automatic/agent-config/#suppressing-specific-auto-instrumentation) option.");
addDocumentationOption(
"service_version",
"The Elastic https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-service-version[`service_version`] option corresponds to setting the `service.version` key in https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_resource_attributes[OTEL_RESOURCE_ATTRIBUTES]. For example: `OTEL_RESOURCE_ATTRIBUTES=service.version=1.2.3`.");
"The Elastic [`service_version`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-service-version) option corresponds to setting the `service.version` key in [OTEL_RESOURCE_ATTRIBUTES](https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_resource_attributes). For example: `OTEL_RESOURCE_ATTRIBUTES=service.version=1.2.3`.");
addDocumentationOption(
"environment",
"The Elastic https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-environment[`environment`] option corresponds to setting the `deployment.environment` key in https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_resource_attributes[OTEL_RESOURCE_ATTRIBUTES]. For example: `OTEL_RESOURCE_ATTRIBUTES=deployment.environment=testing`.");
"The Elastic [`environment`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-environment) option corresponds to setting the `deployment.environment` key in [OTEL_RESOURCE_ATTRIBUTES](https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_resource_attributes). For example: `OTEL_RESOURCE_ATTRIBUTES=deployment.environment=testing`.");
addDocumentationOption(
"global_labels",
"The Elastic https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-global-labels[`global_labels`] option corresponds to adding `key=value` comma separated pairs in https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_resource_attributes[OTEL_RESOURCE_ATTRIBUTES]. For example: `OTEL_RESOURCE_ATTRIBUTES=alice=first,bob=second`. Such labels will result in labels.key=value attributes on the server, eg labels.alice=first");
"The Elastic [`global_labels`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-global-labels) option corresponds to adding `key=value` comma separated pairs in [OTEL_RESOURCE_ATTRIBUTES](https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_resource_attributes). For example: `OTEL_RESOURCE_ATTRIBUTES=alice=first,bob=second`. Such labels will result in labels.key=value attributes on the server, e.g. labels.alice=first");
addUnspecifiedOption("log_level");
addUnspecifiedOption("log_file");
addUnspecifiedOption("log_file_size");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class ConfigurationExporterTest {

@BeforeEach
void setUp() {
currentDocumentationPath = Paths.get("../docs/configure.asciidoc");
currentDocumentationPath = Paths.get("../docs/migrate.md");
}

/**
Expand All @@ -69,7 +69,7 @@ void testGeneratedConfigurationDocsAreUpToDate() throws IOException, TemplateExc

assertThat(renderedDocumentation)
.withFailMessage(
"The rendered configuration documentation (/docs/configure.asciidoc) is not up-to-date.\n"
"The rendered configuration documentation (/docs/migrate.md) is not up-to-date.\n"
+ "If you see this error, it means you have to execute the tests locally with overwrite enabled "
+ "(gradlew.bat clean :custom:test --tests \"*ConfigurationExporterTest\" -Pelastic.otel.overwrite.config.docs=true) "
+ "which will update the rendered docs (and then you probably need to commit the change).\n")
Expand All @@ -84,14 +84,13 @@ static String renderDocumentation(List<ConfigurationOption> configurationRegistr
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setLogTemplateExceptions(false);

Template temp = cfg.getTemplate("configure.asciidoc.ftl");
Template temp = cfg.getTemplate("migrate.md.ftl");
StringWriter tempRenderedFile = new StringWriter();
tempRenderedFile.write(
"[[configure]]\n"
+ "== Configure\n\n"
+ "////\n"
+ "This file is auto generated. Please only make changes in `configure.asciidoc.ftl`\n"
+ "////\n");
"# Migrate to the Elastic distribution\n\n"
+ "<!--\n"
+ "This file is auto generated. Please only make changes in `migrate.md.ftl`\n"
+ "-->\n");
final Map<String, List<ConfigurationOption>> optionsByCategory = new HashMap<>();
optionsByCategory.put("Elastic to OpenTelemetry mapping", configurationRegistry);
Map<String, Object> map = new HashMap<>();
Expand Down
46 changes: 0 additions & 46 deletions custom/src/test/resources/configure.asciidoc.ftl

This file was deleted.

38 changes: 38 additions & 0 deletions custom/src/test/resources/migrate.md.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<#-- @ftlvariable name="config" type="java.util.Map<java.lang.String,java.util.List<co.elastic.otel.config.ConfigurationOption>>" -->
<#-- @ftlvariable name="keys" type="java.util.Collection<java.lang.String>" -->

This documentation describes how to update applications using the [Elastic APM Java agent](https://www.elastic.co/guide/en/apm/agent/java/current/index.html) to use the Elastic Distribution of OpenTelemetry Java (EDOT Java).

Start by installing EDOT Java following the steps outlined in [Get started](./get-started.md). Then update existing APM Java agent configuration options in your application with the equivalent [OpenTelemetry SDK configuration variables](https://opentelemetry.io/docs/languages/sdk-configuration/general/) (listed below).

## Option reference

This is a list of all APM Java agent configuration options grouped by their category.
Select one of the following for more information.

<#list config as category, options>
<#list options as option>
* [${option.key}](#${option.key})
</#list>
</#list>

<#list config as category, options>
## ${category}

<#list options as option>
### `${option.key}`${option.tags?has_content?then(" (${option.tags?join(' ')})", '')}

${option.description}

<!--
This file is auto-generated. Please make changes in *Configuration.java (for example, CoreConfiguration.java) and execute ConfigurationExporter.
-->

</#list>
</#list>

<#macro defaultValue option>${option.defaultValueAsString?has_content?then("${option.defaultValueAsString?replace(',([^\\\\s])', ', $1', 'r')}", '<none>')}</#macro>

<#list config as category, options>
<!-- ${category} -->
</#list>
Loading
Loading