From 9b79c7cd41ed9792966c6fe503913ed7542549d0 Mon Sep 17 00:00:00 2001 From: NTTechnicalUser Date: Fri, 15 Nov 2024 11:12:22 +0000 Subject: [PATCH] Publish documentation for release 2.6.6 --- .../configuration/configuration-sources.md | 97 +++++++++++ .../open-census-configuration.md | 35 ++++ .../open-telemetry-configuration.md | 37 ++++ .../getting-started/installation.md | 159 ++++++++++++++++++ .../getting-started/quick-start.md | 22 +++ .../version-2.6.6/instrumentation/process.md | 97 +++++++++++ .../website/versions.json | 1 + 7 files changed, 448 insertions(+) create mode 100644 inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/configuration-sources.md create mode 100644 inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/open-census-configuration.md create mode 100644 inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/open-telemetry-configuration.md create mode 100644 inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/getting-started/installation.md create mode 100644 inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/getting-started/quick-start.md create mode 100644 inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/instrumentation/process.md diff --git a/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/configuration-sources.md b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/configuration-sources.md new file mode 100644 index 0000000000..2e4e3f319e --- /dev/null +++ b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/configuration-sources.md @@ -0,0 +1,97 @@ +--- +id: version-2.6.6-configuration-sources +title: Configuration Sources +original_id: configuration-sources +--- + +inspectIT Ocelot tries to implement the zero-configuration approach but lets you externalize the configuration and influence every bit of its configuration if this is required. +Internally it uses the Spring-based `PropertySource` order to allow overriding of configuration values. +Configuration properties are considered in inspectIT Ocelot in the following order: + +1. [Java Agent Arguments](#java-agent-arguments) +1. [Java System Properties](#java-system-properties) +1. [OS environment Variables](#os-environment-variables) +1. External Configuration Sources: + * [File-based Configuration](configuration/external-configuration-sources.md#file-based-configuration) +1. inspectIT Ocelot Defaults + +When an invalid configuration is given to inspectIT on startup, the agent will use a fallback configuration. +In this fallback configuration, the agent is inactive with the exception of listening for configuration updates. + +When giving an invalid configuration through a runtime update to the agent, the agent will simply retain the previous configuration. + +## Available Configuration Sources + +### Java Agent Arguments + +You can pass a JSON object as string to the agent via its command line arguments. +For example, to override the service name used to identify your application reporting the performance data, +you can change the `inspectit.service-name` property as follows: + +```bash +$ java -javaagent:/path/to/inspectit-ocelot-agent-2.6.6.jar="{ \"inspectit\": { \"service-name\": \"My Custom Service\" }}" -jar my-java-program.jar +``` + +Note that you have to escape the quotes within your JSON string. On linux you can just use the more readable single quotes notation: + +```bash +$ java -javaagent:/path/to/inspectit-ocelot-agent-2.6.6.jar='{ "inspectit": { "service-name": "My Custom Service" }}' -jar my-java-program.jar +``` + +### Java System Properties + +You can pass any configuration property as the Java System property to the Java command that you use to start your Java application. +Using this approach you can change the `inspectit.service-name` property as follows: + +```bash +$ java -Dinspectit.service-name="My Custom Service" -javaagent:/path/to/inspectit-ocelot-agent-2.6.6.jar -jar my-java-program.jar +``` + +### OS Environment Variables + +Similar to the Java System properties, inspectIT Ocelot will also consider all the available operating system environment variables. +Due to the relaxed bindings, you can use upper case format, which is recommended when using system environment variables. + +```bash +$ INSPECTIT_SERVICE_NAME="My Custom Service" java -javaagent:/path/to/inspectit-ocelot-agent-2.6.6.jar -jar my-java-program.jar +``` + +## Relaxed Bindings + +Note that due to the Spring-powered configuration approach, the inspectIT Ocelot agent uses Spring support for relaxed bindings. +This means that a property can be specified in different formats depending on the property source. +As suggested by Spring, the allowed formats are: + +| Property | Note | +| --- | --- | +| `inspectit.service-name` | Kebab-case, which is recommended for use in `.properties` and `.yml` files. | +| `inspectit.serviceName` | Standard camelCase syntax. | +| `inspectit.service_name` | Underscore notation (snake_case), which is an alternative format for use in `.properties` and `.yml` files. | +| `INSPECTIT_SERVICE_NAME` | UPPER_CASE format, which is recommended when using system environment variables. | + +The formats should be used in the following way, based on the type of property source: + +| Property Source | Format | +| --- | --- | +| System properties | Camel case, kebab case, or underscore notation. | +| Environment Variables | Upper case format with the underscore as the delimiter. | +| Property files (`.properties`) | Camel case, kebab case, or underscore notation. | +| YAML files (`.yaml`, `.yml`) | Camel case, kebab case, or underscore notation. | + +## Environment Information + +Each agent stores the following information about its runtime environment: + +| Property | Note | +| --- | --- | +| `inspectit.env.agent-dir` | Resolves to the path where the agent-jar is stored. | +| `inspectit.env.hostname` | The hostname where the agent is running. | +| `inspectit.env.pid` | The process id of the JVM process. | + +They are used to define the default behavior when writing the configuration persistence file and will be sent +as attributes to the configuration server when fetching the configuration. + +You can reference these properties within the configuration using e.g. `${inspectit.env.agent-dir}` +as shown in the default configuration for +[HTTP-based configuration](configuration/external-configuration-sources.md#http-based-configuration). +Referencing every other property follows the same schema. \ No newline at end of file diff --git a/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/open-census-configuration.md b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/open-census-configuration.md new file mode 100644 index 0000000000..db96fbfe41 --- /dev/null +++ b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/open-census-configuration.md @@ -0,0 +1,35 @@ +--- +id: version-2.6.6-open-census-configuration +title: Using OpenCensus Library with inspectIT Ocelot +sidebar_label: OpenCensus Configuration +original_id: open-census-configuration +--- + +If you plan to use the OpenCensus library in an application which will be instrumented later on with inspectIT Ocelot, some special rules do apply. +Following these rules will make sure that there are no run-time problems in your application. +Furthermore, a correct configuration will make it possible to combine metrics and traces that you manually collect using the OpenCensus instrumentation library with the ones collected by the inspectIT Ocelot agent. + +1. Make sure you are using the same version of OpenCensus as inspectIT Ocelot. + + The inspectIT Ocelot agent in version 2.6.6 internally uses OpenCensus in version 0.31.1. Please adapt any OpenCensus dependency in your application to this version to avoid run-time conflicts. + ```XML + + io.opencensus + opencensus-api + 0.31.1 + + ``` + +2. Set the JVM property `inspectit.publishOpenCensusToBootstrap` to `true`. + + ``` + -Dinspectit.publishOpenCensusToBootstrap=true + ``` + + Setting the above property to `true` tells inspectIT Ocelot that you plan to use the OpenCensus library in combination with the agent. Note that this property must be specified with this exact name. The flexibility offered for all other config options does not apply here. The inspectIT Ocelot agent will make sure that all OpenCensus classes are then loaded by the bootstrap class loader. This ensures that OpenCensus implementation is shared between your manual instrumentation and the agent instrumentation, making the combination of data possible. + +3. Add the agent to the start of a JVM + + In this scenario, it is required that you add the agent via [the `javaagent` JVM argument](getting-started/installation.md#adding-the-agent-to-a-jvm). If the agent is successfully added to the JVM, it will log that the OpenCensus classes pushed to the bootstrap classloader will be used. + + It is important to state that the agent will *not* publish the OpenCensus classes to the bootstrap classloader if it is attached during runtime – even if the previously mentioned JVM argument is set! In this case, metrics and traces of *manual OpenCensus instrumentations* will *not* be collected by the inspectIT Ocelot agent. \ No newline at end of file diff --git a/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/open-telemetry-configuration.md b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/open-telemetry-configuration.md new file mode 100644 index 0000000000..4f94ece33d --- /dev/null +++ b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/configuration/open-telemetry-configuration.md @@ -0,0 +1,37 @@ +--- +id: version-2.6.6-open-telemetry-configuration +title: Using OpenTelemetry Library with inspectIT Ocelot +sidebar_label: OpenTelemetry Configuration +original_id: open-telemetry-configuration +--- + +> TODO: finish the configuration documentation when the migration to OTEL (with the OTEL bridge) is finished, i.e., when all exporters (including OTLP exporters) are supported + +If you plan to use the OpenTelemetry library in an application which will be instrumented later on with inspectIT Ocelot, some special rules do apply. +Following these rules will make sure that there are no run-time problems in your application. +Furthermore, a correct configuration will make it possible to combine metrics and traces that you manually collect using the OpenTelemetry instrumentation library with the ones collected by the inspectIT Ocelot agent. + +1. Make sure you are using the same version of OpenTelemetry as inspectIT Ocelot. + + The inspectIT Ocelot agent in version 2.6.6 internally uses OpenTelemetry in version {opentelemetry-version}. Please adapt any OpenTelemetry dependency in your application to this version to avoid run-time conflicts. + ```XML + + io.opentelemetry + opentelemetry-api + {opentelemetry-version} + + ``` + +2. Set the JVM property `inspectit.publishOpenTelemetryToBootstrap` to `true`. + + ``` + -Dinspectit.publishOpenTelemetryToBootstrap=true + ``` + + Setting the above property to `true` tells inspectIT Ocelot that you plan to use the OpenTelemetry library in combination with the agent. Note that this property must be specified with this exact name. The flexibility offered for all other config options does not apply here. The inspectIT Ocelot agent will make sure that all OpenTelemetry classes are then loaded by the bootstrap class loader. This ensures that OpenTelemetry implementation is shared between your manual instrumentation and the agent instrumentation, making the combination of data possible. + +3. Add the agent to the start of a JVM + + In this scenario, it is required that you add the agent via [the `javaagent` JVM argument](getting-started/installation.md#adding-the-agent-to-a-jvm). If the agent is successfully added to the JVM, it will log that the OpenTelemetry classes pushed to the bootstrap classloader will be used. + + It is important to state that the agent will *not* publish the OpenTelemetry classes to the bootstrap classloader if it is attached during runtime – even if the previously mentioned JVM argument is set! In this case, metrics and traces of *manual OpenTelemetry instrumentations* will *not* be collected by the inspectIT Ocelot agent. \ No newline at end of file diff --git a/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/getting-started/installation.md b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/getting-started/installation.md new file mode 100644 index 0000000000..52a8b10301 --- /dev/null +++ b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/getting-started/installation.md @@ -0,0 +1,159 @@ +--- +id: version-2.6.6-installation +title: Installation +original_id: installation +--- + +This section describes the installation details for the inspectIT Ocelot agent. + +## Supported Java Runtime Environments + +The inspectIT Ocelot supports Java Runtime Environments in version 1.8.0 and above. You will not be able to use the agent with the lower Java versions. +The agent works with different JRE distributions including Oracle, openJDK, Azul, etc. + +It is recommended to always use the latest minor release of your current Java Runtime Environment version in order to ensure straightforward operation. + +## Adding the Agent to a JVM + +The best option for using the inspectIT Ocelot is to include it to the start of the JVM by using the `-javaagent` command-line option. +This way the agent will be initialized before your application starts. + +```bash +$ java -javaagent:"/path/to/inspectit-ocelot-agent-2.6.6.jar" -jar my-java-program.jar +``` + +> Some application servers have dedicated scripts that are used to launch the actual JVM that runs the application. In such cases, you must alter the start-up scripts in order to instrument the correct JVM. + +## Attaching the Agent to a Running JVM + +inspectIT Ocelot also supports attaching the agent to an already running JVM. +In such a scenario the collection of metrics and traces will start from the point of the attachment. + +The attaching can easily be done using the agent itself and executing the following command: + +```bash +$ java -jar inspectit-ocelot-agent-2.6.6.jar [] +``` + +In the following example, we are attaching the agent to the JVM process `1337` and passing some [additional arguments](configuration/configuration-sources.md#java-agent-arguments) to it: +```bash +$ java -jar inspectit-ocelot-agent-2.6.6.jar 1337 '{"inspectit":{"service-name":"my-agent"}}' +``` + +> The agent is internally using the utility [jattach](https://github.com/apangin/jattach) for attaching itself to a running JVM. + +In order to find the process ID of a running JVM, you can use the `jcmd` to list all the running Java processes on your machine: + +```bash +$ jcmd -l +``` + +### Attaching Using jattach + +Another way of attaching the agent to a running JVM is to use the utility [jattach](https://github.com/apangin/jattach): + +```bash +$ ./jattach.sh load instrument false /path/to/inspectit-ocelot-agent-2.6.6.jar='{"inspectit.service-name" : "MyService"}' +``` +In this example we're also passing [JSON arguments](configuration/configuration-sources.md#java-agent-arguments) to the agent in order to configure its service name. + +> Using the attach options has some limitations with respect to using the OpenCensus instrumentation library in combination with the inspectIT Ocelot agent. Please refer to [OpenCensus Configuration](configuration/open-census-configuration.md) section to understand these limitations. + +## Using the Agent With a Security Manager + +If a Java Security Manager is enabled, the agent needs to be granted additional permissions to work. +For this, add the following to your policy file: + +``` +grant codeBase "file:" { + permission java.security.AllPermission; +}; +``` + +The correct policy file location depends on different factors. +See the [official Java documentation](https://docs.oracle.com/en/java/javase/17/security/permissions-jdk1.html#GUID-789089CA-8557-4017-B8B0-6899AD3BA18D) for further information. + +## Using the Agent with Kubernetes + +There are several ways to use the agent in a Kubernetes cluster. +For example, you could integrate the agent directly into the application container images, but this requires customizing all images. + +Another possibility is that the agent is automatically injected into the application containers using an **operator** and attached to the JVM processes. +For this purpose, the [OpenTelemetry K8s Operator](https://github.com/open-telemetry/opentelemetry-operator) can be used, with which it is possible to automatically roll out the inspectIT Ocelot Java Agent. +It is still under development, so it is not feature-complete, but depending on your needs the current version could already provide everything needed. + +:::warning Up-to-dateness of the Documentation +Since the OpenTelemetry K8s operator is currently under heavy development, the installation steps described below **may be outdated**. +They may nevertheless be helpful in navigating the OpenTelemetry Operator installation documentation by showing you which parts you need. +::: + +### Installing the Operator + +Install the OpenTelemetry Operator as described in its [official readme file](https://github.com/open-telemetry/opentelemetry-operator#getting-started). This includes the following steps: + +1. Install the [cert-manager](https://cert-manager.io/docs/installation/) in your cluster if you have not done it already. +2. Install the operator using the following command. Please note that this will install the latest version of it: + + ```shell + kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml + ``` + + By adjusting the URL to a different GitHub release, a specific version of the operator can be used: + + ```shell + kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/download/v{version}/opentelemetry-operator.yaml + ``` + +### Using the Operator + +1. Create an `Instrumentation` object as shown below. Set the `spec.java.image` to the inspectIT Ocelot agent container image you would like to use: + + :::note + Please note that only container images of the inspectIT Ocelot Agent starting from version `1.15.2` are compatible and work with the OpenTelemetry K8s Operator. + ::: + + ```yaml + apiVersion: opentelemetry.io/v1alpha1 + kind: Instrumentation + metadata: + name: my-instrumentation + spec: + java: + image: inspectit/inspectit-ocelot-agent:1.15.2 + ``` + +2. Annotate namespaces or containers that should receive the agent as described in the [official readme file](https://github.com/open-telemetry/opentelemetry-operator#getting-started). The possible values for the annotation can be: + + - `true` - inject the `Instrumentation` resource from the namespace. + - `my-instrumentation` - name of Instrumentation CR instance. + - `false` - do not inject + + The following annotation can be used for this: + ```yaml + instrumentation.opentelemetry.io/inject-java: "true" + ``` + + :::warning Ensure Correct Referencing + If the operator cannot find the instrumentation object, e.g. because none was created or the name was written incorrectly in the annotation, the containers will not be started! + ::: + +3. (Optional) Add environment variables to the containers to configure the agent. See the following section for using [environment variables to configure](configuration/configuration-sources.md#os-environment-variables) the inspectIT Ocelot agent. + + For example, to set a service-name for the agent and connect it to a specific configuration-server, you could set the `INSPECTIT_CONFIG_HTTP_URL` and `INSPECTIT_SERVICE_NAME` environment variable like in the following: + + ```yaml + containers: + - image: my-app-image + name: my-app + env: + - name: INSPECTIT_CONFIG_HTTP_URL + value: http://my-ocelot-config-server:8090/api/v1/agent/configuration + - name: INSPECTIT_SERVICE_NAME + value: my-service-name + ``` + + You can also take a look at the [deployment file](https://github.com/inspectIT/trading-demo-application/blob/main/k8s/deployment.yaml) of the [trading demo application](https://github.com/inspectIT/trading-demo-application) where exactly this is set up. + +4. Start or restart the containers to trigger the injection and attachment of the agent. + + Currently, the operator **will not automatically restart running containers** in case changes are made to the `Instrumentation` objects. However, there are plans to provide the ability to restart containers in order to roll out changes of the configurable `Instrumentation` objects automatically (see [issue #553](https://github.com/open-telemetry/opentelemetry-operator/issues/553)). diff --git a/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/getting-started/quick-start.md b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/getting-started/quick-start.md new file mode 100644 index 0000000000..05fe924deb --- /dev/null +++ b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/getting-started/quick-start.md @@ -0,0 +1,22 @@ +--- +id: version-2.6.6-quick-start +title: Quick Start +original_id: quick-start +--- + +You can find and download all released versions of inspectIT Ocelot in our [GitHub](https://github.com/inspectIT/inspectit-ocelot/releases) repository. +You can get the current version on the following link: + +```bash +$ wget https://github.com/inspectIT/inspectit-oce/releases/download/2.6.6/inspectit-ocelot-agent-2.6.6.jar +``` + +The best way to start using inspectIT Ocelot is to attach the Java agent when starting your Java program. +Use the `-javaagent` command-line option to reference the inspectIT Ocelot jar: + +```bash +$ java -javaagent:"/path/to/inspectit-ocelot-agent-2.6.6.jar" -jar my-java-program.jar +``` + +The [Installation](installation.md) section further describes what options are available for installing the agent, as well as how you can attach the agent to an already started JVM. +In the [Configuration](configuration/configuration-sources.md) section you can find more details on how to configure the inspectIT Ocelot agent. \ No newline at end of file diff --git a/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/instrumentation/process.md b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/instrumentation/process.md new file mode 100644 index 0000000000..58b090ae79 --- /dev/null +++ b/inspectit-ocelot-documentation/website/versioned_docs/version-2.6.6/instrumentation/process.md @@ -0,0 +1,97 @@ +--- +id: version-2.6.6-process +title: Instrumentation Process +original_id: process +--- + +The approach inspectIT Ocelot takes for instrumenting is fundamentally different from the approach of most other JVM instrumentation agents. +InspectIT Ocelot does *not* instrument classes when they are loaded, the instrumentation is performed purely asynchronous in the background. + +In this background task inspectIT Ocelot essentially looks at every loaded class and performs an instrumentation if required by the active configuration. Hereby, the agent manages the classes he has to analyze in a queue. This queue is processed in batches to ensure that no CPU resources are blocked if they are required by the instrumented application. The batching is configurable using the `internal` settings: + +```yaml +inspectit: + instrumentation: + # settings for fine-tuning the instrumentation process + internal: + # the time to pause between executing batches of class instrumentation updates + inter-batch-delay: 50ms + # defines how many classes are checked at once for updates of their configuration per batch + class-configuration-check-batch-size: 1000 + # defines the maximum number of classes which are instrumented per batch + class-retransform-batch-size: 10 + + # defines how often the agent should check if new classes have been defined. + new-class-discovery-interval: 10s + # defines how often the new class discovery is performed after a new class has been loaded + num-class-discovery-trials: 2 + + # defines whether orphan action classes are recycled or new classes should be injected instead + recyclingOldActionClasses: true +``` + +In addition, the size of the instrumentation queue can be used as an indicator for the instrumentation progress. +It is accessible via the [self-monitoring](metrics/self-monitoring.md) of the agent. + +InspectIT allows you to perform instrumentation by injecting custom code into your application. +If your JVM has a `SecurityManager` enabled, you might also want to control the `ProtectionDomain` of these injected classes. + +By default, inspectIT will use its own `ProtectionDomain` for injected classes. +Alternatively, you can make inspectIT to use the `ProtectionDomain` for which the action is being created using the following configuration: + +```yaml +inspectit: + instrumentation: + internal: + use-inspectit-protection-domain: false +``` + +## Synchronous instrumentation (BETA!) +:::caution +Enabling synchronous instrumentation in Java 8 environments will result in significant boot time performance degradation! +See See: JDK-7018422 +::: + +By default, all instrumentation is performed purely asynchronously in the background. There may be situations where this is not appropriate and a class must be instrumented directly at the first load, +e.g. in batch processes. + +InspectIT can be configured to instrumented classes on first class load by updating the following configuration: +```yaml +inspectit: + instrumentation: + internal: + async: false +``` + +## Delayed instrumentation +Despite instrumenting asynchronously or synchronously, inspectIT always starts the instrumentation process as soon as +the agent is attached to a JVM. There are cases in which it is desirable to postpone the start of the instrumentation +process. Although this is rarely necessary inspectIT provides the possibility to do so via system property +`inspectit.start.delay` or OS environment variable `INSPECTIT_START_DELAY`. + +You provide a value interpreted as milliseconds the agent shall wait before the instrumentation process starts. If you +do not provide a value the instrumentation process will start immediately. + +The Agent expects positive integers excluding zero. For all other values the agent will print an error message on stderr +and continue as if there was no value supplied. + +If you specify both system property and OS environment variable, the system property will take precedence. + +Since this option has an impact before the agent fetches any configuration from the +[Configuration Server](config-server/overview.md) you cannot specify that value like any other inspectIT configuration +property. It is only available as system property or OS environment variable. + +Example using system property: +```bash +# this will delay the instrumentation process by 10 minutes +$ java -javaagent:"/path/to/inspectit-ocelot-agent-2.6.6.jar" \ + -Dinspectit.start.delay=600000 \ + -jar my-java-program.jar +``` + +Example using OS environment variable (using bash): +```bash +# this will delay the instrumentation process by 5 minutes +$ export INSPECTIT_START_DELAY=300000 +$ java -javaagent:"/path/to/inspectit-ocelot-agent-2.6.6.jar" -jar my-java-program.jar +``` diff --git a/inspectit-ocelot-documentation/website/versions.json b/inspectit-ocelot-documentation/website/versions.json index 57e5a0d068..2cbac1f8d6 100644 --- a/inspectit-ocelot-documentation/website/versions.json +++ b/inspectit-ocelot-documentation/website/versions.json @@ -1,4 +1,5 @@ [ + "2.6.6", "2.6.5", "2.6.4", "2.6.3",