Setting up a demo Java app and collecting telemetry
Getting started
Sign up for Yandex Cloud and create a billing account:
- Navigate to the management console
and log in to Yandex Cloud or create a new account. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVEorTRIAL_ACTIVEstatus. If you do not have a billing account, create one and link a cloud to it.
If you have an active billing account, you can create or select a folder for your infrastructure on the cloud page
Learn more about clouds and folders here.
Setting up a demo app and telemetry delivery
In this example, you will install Spring PetClinic
-
Install Git
and Java suitable for your OS. Here is an example:sudo apt update sudo apt install -y git openjdk-17-jdk -
Download and install OTel Collector
suitable for your OS. Here is an example:wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v144.0/otelcol-linux_amd64.tar.gz tar xvf otelcol-linux_amd64.tar.gz -
Set these environment variables:
export MONIUM_PROJECT=folder__<folder_ID> export MONIUM_API_KEY=<API_key> -
Create a file named
stream_put_record.pyand paste the following code to it:receivers: otlp: protocols: grpc: http: exporters: otlp_grpc/monium: compression: zstd endpoint: ingest.monium.yandex.cloud:443 headers: Authorization: "Api-Key ${env:MONIUM_API_KEY}" x-monium-project: "${env:MONIUM_PROJECT}" sending_queue: batch: service: pipelines: metrics: receivers: [ otlp ] exporters: [ otlp_grpc/monium ] traces: receivers: [ otlp ] exporters: [ otlp_grpc/monium ] logs: receivers: [ otlp ] exporters: [ otlp_grpc/monium ] telemetry: metrics: level: normal readers: - periodic: exporter: otlp: protocol: http/protobuf endpoint: http://localhost:4318 interval: 30000 timeout: 5000 -
Run OTel Collector:
./otelcol-linux_amd64 --config otel-collector.yamlIt will start listening on ports
4317(gRPC) and4318(HTTP). -
Download and build Spring PetClinic:
git clone https://github.com/spring-projects/spring-petclinic cd spring-petclinic ./mvnw -DskipTests package -
Download the OpenTelemetry Java agent:
curl -L -o opentelemetry-javaagent.jar \ https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar -
Run the application with the Java agent to send telemetry to OTel Collector:
OTEL_SERVICE_NAME=spring-petclinic \ OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE="delta" \ java -javaagent:./opentelemetry-javaagent.jar -jar target/*.jar -
Open the Spring PetClinic website at
http://localhost:8080and simulate user actions.
Viewing telemetry in Monium
-
On the Monium
home page, select the relevant data type section on the left:- Metrics.
- Logs.
- Traces.
-
At the top, set the data search period on the timeline.
-
In the search bar, enter a query to search for telemetry data:
-
project = <project_ID>: Select the project specified inx-monium-projectof the application's telemetry transmission configuration.This may be a cloud (
cloud__<cloud_ID>) project, folder (folder__<folder_ID>) project, or another project. -
cluster = <cluster_name>: Select the name of the installation that runs your application. If no cluster is specified,cluster = defaultis used. -
service = <service_name>: Name of your application or service. You can use theOTEL_SERVICE_NAMEenvironment variable to provide it.If you do not see the required labels in the suggestions, you can enter them manually. However, the system most likely has not received data with these labels. See Data delivery troubleshooting for possible solutions.
-
-
Click Execute query or Execute.
The page will show data that matches the query.
Example of a page with metrics

More on metrics.
Example of a page with logs

More on logs.
Example of a page with traces

More on traces.
-
To view information about the data shard, select Shards on the left and then select the shard with your service name.