Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
EddeCCC committed Jul 1, 2024
1 parent f7f2c9f commit d062de8
Showing 1 changed file with 26 additions and 48 deletions.
74 changes: 26 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# inspectIT Gepard Extension
Extension for the OpenTelemetry Java agent.
Use `./gradlew extendedAgent` (no tests) or `./gradlew build` to build an agent jar with your current
changes.

# Original Readme
The following is the original content from which this work is derived.
Source: https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/examples/extension
## Introduction

Extensions add new features and capabilities to the agent without having to create a separate distribution (for examples and ideas, see [Use cases for extensions](#sample-use-cases)).

The contents in this folder demonstrate how to create an extension for the OpenTelemetry Java instrumentation agent, with examples for every extension point.
Extension for the OpenTelemetry Java agent.

> Read both the source code and the Gradle build script, as they contain documentation that explains the purpose of all the major components.
inspectIT Gepard is the further development of [inspectIT Ocelot](https://github.com/inspectIT/inspectit-ocelot).
While the inspectIT Ocelot Java agent is self-made, inspectIT Gepard uses the OpenTelemetry Java agent as basis
and extends it with features from inspectIT Ocelot.

## Build and add extensions
## Installation

To build this extension project, run `./gradlew build`. You can find the resulting jar file in `build/libs/`.
To build this extension project, run `./gradlew build` or `./gradlew extendedAgent` (no tests).
You can find the resulting jar file in `build/libs/`.

To add the extension to the instrumentation agent:

Expand All @@ -25,52 +18,37 @@ To add the extension to the instrumentation agent:

```bash
java -javaagent:path/to/opentelemetry-javaagent.jar \
-Dotel.javaagent.extensions=build/libs/opentelemetry-java-instrumentation-extension-demo-1.0-all.jar
-Dotel.javaagent.extensions=build/libs/opentelemetry-javaagent.jar
-jar myapp.jar
```

Note: to load multiple extensions, you can specify a comma-separated list of extension jars or directories (that
contain extension jars) for the `otel.javaagent.extensions` value.

## Embed extensions in the OpenTelemetry Agent

To simplify deployment, you can embed extensions into the OpenTelemetry Java Agent to produce a single jar file. With an integrated extension, you no longer need the `-Dotel.javaagent.extensions` command line option.

For more information, see the `extendedAgent` task in [build.gradle](build.gradle).

## Extensions examples

* Custom `IdGenerator`: [DemoIdGenerator](src/main/java/com/example/javaagent/DemoIdGenerator.java)
* Custom `TextMapPropagator`: [DemoPropagator](src/main/java/com/example/javaagent/DemoPropagator.java)
* Custom `Sampler`: [DemoSampler](src/main/java/com/example/javaagent/DemoSampler.java)
* Custom `SpanProcessor`: [DemoSpanProcessor](src/main/java/com/example/javaagent/DemoSpanProcessor.java)
* Custom `SpanExporter`: [DemoSpanExporter](src/main/java/com/example/javaagent/DemoSpanExporter.java)
* Additional instrumentation: [DemoServlet3InstrumentationModule](src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java)
## Network communication

## Sample use cases
The extension contains a client, who is able to communicate with other servers via HTTPS.
To configure TLS

Extensions are designed to override or customize the instrumentation provided by the upstream agent without having to create a new OpenTelemetry distribution or alter the agent code in any way.
1. Provide a local keystore, which contains the certificate of your server
2. Modify the startup command to add the path to the keystore as well as the password. For example:

Consider an instrumented database client that creates a span per database call and extracts data from the database connection to provide span attributes. The following are sample use cases for that scenario that can be solved by using extensions.

### "I don't want this span at all"

Create an extension to disable selected instrumentation by providing new default settings.

### "I want to edit some attributes that don't depend on any db connection instance"

Create an extension that provide a custom `SpanProcessor`.

### "I want to edit some attributes and their values depend on a specific db connection instance"
```bash
java -javaagent:path/to/opentelemetry-javaagent.jar \
-Dotel.javaagent.extensions=build/libs/opentelemetry-javaagent.jar \
-Djavax.net.ssl.trustStore="path\to\keystore\agent-keystore.jks" \
-Djavax.net.ssl.trustStorePassword="password"
-jar myapp.jar
```

Create an extension with new instrumentation which injects its own advice into the same method as the original one. You can use the `order` method to ensure it runs after the original instrumentation and augment the current span with new information.
## Further Information

For example, see [DemoServlet3InstrumentationModule](src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java).
The repository was build upon this example project: https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/examples/extension

### "I want to remove some attributes"
### Why Gepard?
Gepard the German name for the animal cheetah as well as an acronym for

Create an extension with a custom exporter or use the attribute filtering functionality in the OpenTelemetry Collector.
"**G**anzheitliche, **e**ffizienz-orientierte, **P**erformance **A**nwendungsüberwachung mit **R**eporting und **D**iagnose"

### "I don't like the OTel spans. I want to modify them and their lifecycle"
meaning: holistic, efficiency-orientated, performance application monitoring with reporting and diagnostics.

Create an extension that disables existing instrumentation and replace it with new one that injects `Advice` into the same (or a better) method as the original instrumentation. You can write your `Advice` for this and use the existing `Tracer` directly or extend it. As you have your own `Advice`, you can control which `Tracer` you use.

0 comments on commit d062de8

Please sign in to comment.