Getting started with Monium
Monium is a platform made to collect telemetry data (metrics, logs, and traces) from Yandex Cloud, other clouds, or your local infrastructure.
Follow this guide to send telemetry data from your app or demo app via OTel Collector
To get started:
-
Set up telemetry data transfer from your app or demo app.
If OTLP telemetry is already configured, specify Monium connection settings.
Get your cloud ready
-
Log in to the management console
or sign up. If not signed up yet, navigate to the management console and follow the instructions. -
On the Yandex Cloud Billing page
, make sure you have a linked billing account with theACTIVEorTRIAL_ACTIVEstatus. If you do not have a billing account yet, create one.If you have an active billing account, you can navigate to the cloud page
to create or select a folder for your infrastructure.
Create a service account and API key
- In the management console
, navigate to the folder where you want to store your telemetry. - Go to Identity and Access Management.
- Click Create service account.
- Enter a name for the service account, e.g.,
monium-ca. - Click
Add role and addmonium.telemetry.writer.
If you want to transfer only a specific data type, you can select other roles:monium.metrics.writer,monium.logs.writer, ormonium.traces.writer. - Click Create.
- Select the account you created from the list.
- In the top panel, click
Create new key and select Create API key. - Select Scope:
yc.monitoring.manage,yc.monium.telemetry.write. - Optionally, specify Expires at.
- Click Create.
- Save the secret key for the next step.
Set up telemetry data transfer from your app
If you do not have a ready-to-use application, configure a demo app.
In Monium, telemetry follows this hierarchy: project → cluster → service. The data is distributed among shards for each service-cluster pair.
-
Set these environment variables:
MONIUM_PROJECT: Monium project name infolder__<folder_ID>format, e.g.,folder__b1g86q4m5vej********.MONIUM_API_KEY: API key.
-
Set up telemetry from your application in OTLP format:
- Install the auto-instrumentation
agent to automatically collect some telemetry data and send it to OTLP. - Add the OpenTelemetry SDK
to your app.
- Install the auto-instrumentation
-
Install
OTel Collector.You can send data to Monium directly from the OpenTelemetry SDK, without using the agent.
-
In the
otel-collector.yamlconfiguration file, configure data transfer to Monium.Example of a minimal
otel-collector.yamlconfiguration:receivers: otlp: # Target type: OTLP protocols: # Protocols that OTel Collector listens to grpc: # gRPC, default port 4317 http: # HTTP, default port 4318 processors: cumulativetodelta: batch: exporters: # Connecting to Monium otlp/monium: compression: zstd endpoint: ingest.monium.yandex.cloud:443 headers: Authorization: "Api-Key ${env:MONIUM_API_KEY}" x-monium-project: "${env:MONIUM_PROJECT}" service: pipelines: metrics: # Transferring metrics receivers: [ otlp ] processors: [ batch, cumulativetodelta ] exporters: [ otlp/monium ] traces: # Transferring traces receivers: [ otlp ] processors: [ batch ] exporters: [ otlp/monium ] logs: # Transferring logs receivers: [ otlp ] processors: [ batch ] exporters: [ otlp/monium ]otel-collector.yaml section description
-
receivers: Setsotlp(OpenTelemetry Protocol) as receiver type, andgrpcandhttpas receiving protocols. You can specify ports if using non-default ones. -
processors: Enablescumulativetodeltaprocessorto provide monotonically increasing sums as aRATEtype metric. -
exporters: Monium settings:endpoint: Data endpoint,ingest.monium.yandex.cloud:443.Authorization: API key from theMONIUM_API_KEYvariable.x-monium-project: Project name from theMONIUM_PROJECTvariable.compression:zstddata compression type to reduce CPU consumption compared to the defaultgzipmethod. This is an optional setting.
-
service>pipelines: Properties of the channels for receiving and sending each data type to Monium:metrics,logs, andtraces. You can specify only the data types you need.
-
-
Set the environment variables to distribute data across shards in Monium:
OTEL_SERVICE_NAME: Name of your application or service.OTEL_RESOURCE_ATTRIBUTES="cluster=my-cluster": Name of the installation the application operates in, e.g., production or test environment. This is an optional setting. The default value iscluster=default.
-
Run your app and start sending telemetry.
Monium connection settings and data distribution
If your application is already configured to send telemetry data, specify these settings:
- Authentication: API key.
- Endpoint:
ingest.monium.yandex.cloud:443. - In the header:
x-monium-project=folder__<folder_ID>parameter. - In
OTEL_RESOURCE_ATTRIBUTES:clusterordeployment.nameandserviceorservice.name.
Monium stores data in shards with the project, cluster, and service keys. The shard key is selected based on a priority table, with priority decreasing from left to right.
| header | resource attribute | resource attribute | constant |
|---|---|---|---|
x-monium-project |
— | — | — |
x-monium-cluster |
cluster |
deployment.name |
default |
x-monium-service |
service |
service.name |
default |
View the data in Monium
-
On the Monium
home page, select Shards on the left. -
In the list, select the shard with your service name.
The shard name follows the
<project_name>_<cluster_name>_<service_name>format, e.g.,folder__b1g86q4m5vej********_default_spring-petclinic. -
To view a specific data type, on the left, select:
-
Metrics.
In the query string, select
project,cluster, andservicein succession and click Execute query.
Learn more about using metrics. -
Logs.
In the query string, select
project,cluster, andservicein succession and click Execute query.
Learn more about using logs. -
Traces.
In the query string, select
projectandservicein succession and click Execute.
Learn more about using traces.
-
To use telemetry data, create a dashboard and alerts.
Example of demo app setup
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 for your OS.
We recommend to install OTel Collector version 0.144.0
.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: processors: cumulativetodelta: batch: exporters: otlp/monium: compression: zstd endpoint: ingest.monium.yandex.cloud:443 headers: Authorization: "Api-Key ${env:MONIUM_API_KEY}" x-monium-project: "${env:MONIUM_PROJECT}" service: pipelines: metrics: receivers: [ otlp ] processors: [ batch, cumulativetodelta ] exporters: [ otlp/monium ] traces: receivers: [ otlp ] processors: [ batch ] exporters: [ otlp/monium ] logs: receivers: [ otlp ] processors: [ batch ] exporters: [ otlp/monium ] -
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 -
Set this environment variable:
export OTEL_SERVICE_NAME=spring-petclinic -
Run the application with the Java agent to send telemetry to OTel Collector:
java -javaagent:./opentelemetry-javaagent.jar -jar target/*.jar -
Open the Spring PetClinic website at
http://localhost:8080and simulate user actions.