Menu
Grafana Cloud

Application Observability Kotlin quickstart

Note

This guide is identical to the Java quickstart guide, because the instrumentation agent also supports Kotlin libraries and frameworks, such as Ktor.

Follow these steps to get started quickly with Grafana Application Observability:

  1. Install the instrumentation library
  2. Configure an application
  3. Run the application
  4. Observe the service in Application Observability

This guide is intended for local development or evaluation setups and sends data directly to Grafana Cloud without a data collector.

Note

For a production setup with a data collector and troubleshooting information, consult the production documentation.

Application Observability - Quickstart architecture

Install the instrumentation library

First, download the latest JAR release of the instrumentation agent from the release page of the Grafana OpenTelemetry auto-instrumentation Distribution for Java.


Configure an application

Next, customize the following shell script to configure an application:

shell

<authentication environment variables from step 3> export OTEL_SERVICE_NAME=<Service Name>

java -javaagent:path/to/grafana-opentelemetry-java.jar -jar myapp.jar

Follow these steps to get necessary information for the shell script:

  1. Sign in to Grafana Cloud, register for a Free Grafana Cloud account if required, the browser will navigate to the Grafana Cloud Portal page https://grafana.com/profile/org.

    If the account has access to multiple Grafana Cloud Organizations, select an organization from the top left organization dropdown.

    If the organization has access to multiple Grafana Cloud Stacks, navigate to a stack from the left side bar or the main Stacks list.

  2. With a stack selected, or in the single stack scenario, below Manage your Grafana Cloud Stack, click Configure in the OpenTelemetry section:

  3. In the Password / API Token section, click on Generate now to create a new API token:

    • Give the API token a name, for example cart-service
    • Click on Create token
    • Click on Close without copying the token
    • Click on Copy to Clipboard to copy the environment variables to the clipboard

  1. Pick a Service Name to identify the service, for example cart
  1. Replace myapp.jar with the path to the application to instrument

Run the application

Finally, run the application with the shell script and make some requests to the service to send data to Grafana Cloud.

Observe the service in Application Observability

Open Application observability:

  1. Navigate to a stack https://<your-stack-name.>grafana.net
  2. Expand the top left menu below the Grafana logo
  3. Click on Application

Activate metrics generation

Application Observability relies on metrics generated from traces already sent to Grafana Cloud Traces.

Metrics generation is self-serve, and can be enabled during onboarding and disabled from Application Observability configuration.

To complete the setup, click Activate Application Observability to enable metrics generation.

Enable metrics generation

Note

After activating Application Observability and enabling metrics generation, it might take up to five minutes to generate metrics and show graphs.

Visualize and discover

Discover more about Application Observability in the documentation:

  • Service Inventory: filter, and search services and view RED metrics.
  • Service Overview: traces, logs, RED metrics, operations, and runtime information.
  • Service Map: graph of connected services, service dependencies, and data flow.

If you run into any issue, please consult the troubleshooting guide.

Example application

See the Grafana OpenTelemetry Java Spring PetClinic configuration for a complete example setup.