mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-18 03:01:32 +08:00
feat: onboarding flows for rust swift and elixir (#4507)
* feat: onboarding flows for rust swift and elixir * fix: fixed some issues * fix: spellcheck done * fix: feedback incorporated * chore: fixed swift docs * chore: minor fixes * fix: lint errors --------- Co-authored-by: Yunus M <myounis.ar@live.com>
This commit is contained in:
parent
ad8924ed13
commit
1ee672c020
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 16 KiB |
BIN
frontend/public/Logos/swift.png
Normal file
BIN
frontend/public/Logos/swift.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,24 @@
|
||||
## Install otel-collector in your Kubernetes infra
|
||||
|
||||
|
||||
Add the SigNoz Helm Chart repository
|
||||
```bash
|
||||
helm repo add signoz https://charts.signoz.io
|
||||
```
|
||||
|
||||
|
||||
If the chart is already present, update the chart to the latest using:
|
||||
```bash
|
||||
helm repo update
|
||||
```
|
||||
|
||||
|
||||
Install the Kubernetes Infrastructure chart provided by SigNoz
|
||||
```bash
|
||||
helm install my-release signoz/k8s-infra \
|
||||
--set otelCollectorEndpoint=ingest.{{REGION}}.signoz.cloud:443 \
|
||||
--set otelInsecure=false \
|
||||
--set signozApiKey={{SIGNOZ_INGESTION_KEY}} \
|
||||
--set global.clusterName=<CLUSTER_NAME>
|
||||
```
|
||||
- Replace `<CLUSTER_NAME>` with the name of the Kubernetes cluster or a unique identifier of the cluster.
|
@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Elixir (Phoenix + Ecto) Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Install dependencies related to OpenTelemetry by adding them to `mix.exs` file
|
||||
|
||||
```bash
|
||||
{:opentelemetry_exporter, "~> 1.6"},
|
||||
{:opentelemetry_api, "~> 1.2"},
|
||||
{:opentelemetry, "~> 1.3"},
|
||||
{:opentelemetry_semantic_conventions, "~> 0.2"},
|
||||
{:opentelemetry_cowboy, "~> 0.2.1"},
|
||||
{:opentelemetry_phoenix, "~> 1.1"},
|
||||
{:opentelemetry_ecto, "~> 1.1"}
|
||||
```
|
||||
|
||||
|
||||
In your application start, usually the `application.ex` file, setup the telemetry handlers
|
||||
|
||||
```bash
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:{{MYAPP}}, :repo])
|
||||
```
|
||||
|
||||
|
||||
As an example, this is how you can setup the handlers in your application.ex file for an application called demo :
|
||||
|
||||
```bash
|
||||
# application.ex
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:demo, :repo])
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Configure Application
|
||||
You need to configure your application to send telemetry data by adding the following config to your `runtime.exs` file:
|
||||
|
||||
```bash
|
||||
config :opentelemetry, :resource, service: %{name: "{{MYAPP}}"}
|
||||
|
||||
config :opentelemetry, :processors,
|
||||
otel_batch_processor: %{
|
||||
exporter:
|
||||
{:opentelemetry_exporter,
|
||||
%{endpoints: ["http://localhost:4318"]}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -0,0 +1,6 @@
|
||||
### Running your Elixir application
|
||||
Once you are done instrumenting your Elixir (Phoenix + Ecto) application with OpenTelemetry, you should install the dependencies needed to run your application and run it as you normally would.
|
||||
|
||||
|
||||
|
||||
To see some examples for instrumented applications, you can checkout [this link](https://signoz.io/docs/instrumentation/elixir/#sample-examples)
|
@ -0,0 +1,62 @@
|
||||
|
||||
|
||||
Follow the steps below to instrument your Elixir (Phoenix + Ecto) Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Install dependencies related to OpenTelemetry by adding them to `mix.exs` file
|
||||
|
||||
```bash
|
||||
{:opentelemetry_exporter, "~> 1.6"},
|
||||
{:opentelemetry_api, "~> 1.2"},
|
||||
{:opentelemetry, "~> 1.3"},
|
||||
{:opentelemetry_semantic_conventions, "~> 0.2"},
|
||||
{:opentelemetry_cowboy, "~> 0.2.1"},
|
||||
{:opentelemetry_phoenix, "~> 1.1"},
|
||||
{:opentelemetry_ecto, "~> 1.1"}
|
||||
```
|
||||
|
||||
|
||||
In your application start, usually the `application.ex` file, setup the telemetry handlers
|
||||
|
||||
```bash
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:{{MYAPP}}, :repo])
|
||||
```
|
||||
|
||||
|
||||
As an example, this is how you can setup the handlers in your application.ex file for an application called demo :
|
||||
|
||||
```bash
|
||||
# application.ex
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:demo, :repo])
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Configure Application
|
||||
You need to configure your application to send telemetry data by adding the following config to your `runtime.exs` file:
|
||||
|
||||
```bash
|
||||
config :opentelemetry, :resource, service: %{name: "{{MYAPP}}"}
|
||||
|
||||
config :opentelemetry, :processors,
|
||||
otel_batch_processor: %{
|
||||
exporter: {
|
||||
:opentelemetry_exporter,
|
||||
%{
|
||||
endpoints: ["https://ingest.{{REGION}}.signoz.cloud:443"],
|
||||
headers: [
|
||||
{"signoz-access-token", {{SIGNOZ_ACCESS_TOKEN}} }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -0,0 +1,6 @@
|
||||
### Running your Elixir application
|
||||
Once you are done instrumenting your Elixir (Phoenix + Ecto) application with OpenTelemetry, you should install the dependencies needed to run your application and run it as you normally would.
|
||||
|
||||
|
||||
|
||||
To see some examples for instrumented applications, you can checkout [this link](https://signoz.io/docs/instrumentation/elixir/#sample-examples)
|
@ -0,0 +1,96 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_linux_amd64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_linux_amd64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Elixir (Phoenix + Ecto) Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Install dependencies related to OpenTelemetry by adding them to `mix.exs` file
|
||||
|
||||
```bash
|
||||
{:opentelemetry_exporter, "~> 1.6"},
|
||||
{:opentelemetry_api, "~> 1.2"},
|
||||
{:opentelemetry, "~> 1.3"},
|
||||
{:opentelemetry_semantic_conventions, "~> 0.2"},
|
||||
{:opentelemetry_cowboy, "~> 0.2.1"},
|
||||
{:opentelemetry_phoenix, "~> 1.1"},
|
||||
{:opentelemetry_ecto, "~> 1.1"}
|
||||
```
|
||||
|
||||
|
||||
In your application start, usually the `application.ex` file, setup the telemetry handlers
|
||||
|
||||
```bash
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:{{MYAPP}}, :repo])
|
||||
```
|
||||
|
||||
|
||||
As an example, this is how you can setup the handlers in your application.ex file for an application called demo :
|
||||
|
||||
```bash
|
||||
# application.ex
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:demo, :repo])
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Configure Application
|
||||
You need to configure your application to send telemetry data by adding the following config to your `runtime.exs` file:
|
||||
|
||||
```bash
|
||||
config :opentelemetry, :resource, service: %{name: "{{MYAPP}}"}
|
||||
|
||||
config :opentelemetry, :processors,
|
||||
otel_batch_processor: %{
|
||||
exporter:
|
||||
{:opentelemetry_exporter,
|
||||
%{endpoints: ["http://localhost:4318"]}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -0,0 +1,29 @@
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Elixir application
|
||||
|
||||
Once you are done instrumenting your Elixir (Phoenix + Ecto) application with OpenTelemetry, you should install the dependencies needed to run your application and run it as you normally would.
|
||||
|
||||
|
||||
|
||||
To see some examples for instrumented applications, you can checkout [this link](https://signoz.io/docs/instrumentation/elixir/#sample-examples)
|
||||
```
|
@ -0,0 +1,62 @@
|
||||
|
||||
|
||||
Follow the steps below to instrument your Elixir (Phoenix + Ecto) Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Install dependencies related to OpenTelemetry by adding them to `mix.exs` file
|
||||
|
||||
```bash
|
||||
{:opentelemetry_exporter, "~> 1.6"},
|
||||
{:opentelemetry_api, "~> 1.2"},
|
||||
{:opentelemetry, "~> 1.3"},
|
||||
{:opentelemetry_semantic_conventions, "~> 0.2"},
|
||||
{:opentelemetry_cowboy, "~> 0.2.1"},
|
||||
{:opentelemetry_phoenix, "~> 1.1"},
|
||||
{:opentelemetry_ecto, "~> 1.1"}
|
||||
```
|
||||
|
||||
|
||||
In your application start, usually the `application.ex` file, setup the telemetry handlers
|
||||
|
||||
```bash
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:{{MYAPP}}, :repo])
|
||||
```
|
||||
|
||||
|
||||
As an example, this is how you can setup the handlers in your application.ex file for an application called demo :
|
||||
|
||||
```bash
|
||||
# application.ex
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:demo, :repo])
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Configure Application
|
||||
You need to configure your application to send telemetry data by adding the following config to your `runtime.exs` file:
|
||||
|
||||
```bash
|
||||
config :opentelemetry, :resource, service: %{name: "{{MYAPP}}"}
|
||||
|
||||
config :opentelemetry, :processors,
|
||||
otel_batch_processor: %{
|
||||
exporter: {
|
||||
:opentelemetry_exporter,
|
||||
%{
|
||||
endpoints: ["https://ingest.{{REGION}}.signoz.cloud:443"],
|
||||
headers: [
|
||||
{"signoz-access-token", {{SIGNOZ_ACCESS_TOKEN}} }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -0,0 +1,6 @@
|
||||
### Running your Elixir application
|
||||
Once you are done instrumenting your Elixir (Phoenix + Ecto) application with OpenTelemetry, you should install the dependencies needed to run your application and run it as you normally would.
|
||||
|
||||
|
||||
|
||||
To see some examples for instrumented applications, you can checkout [this link](https://signoz.io/docs/instrumentation/elixir/#sample-examples)
|
@ -0,0 +1,96 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_linux_arm64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_linux_arm64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Elixir (Phoenix + Ecto) Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Install dependencies related to OpenTelemetry by adding them to `mix.exs` file
|
||||
|
||||
```bash
|
||||
{:opentelemetry_exporter, "~> 1.6"},
|
||||
{:opentelemetry_api, "~> 1.2"},
|
||||
{:opentelemetry, "~> 1.3"},
|
||||
{:opentelemetry_semantic_conventions, "~> 0.2"},
|
||||
{:opentelemetry_cowboy, "~> 0.2.1"},
|
||||
{:opentelemetry_phoenix, "~> 1.1"},
|
||||
{:opentelemetry_ecto, "~> 1.1"}
|
||||
```
|
||||
|
||||
|
||||
In your application start, usually the `application.ex` file, setup the telemetry handlers
|
||||
|
||||
```bash
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:{{MYAPP}}, :repo])
|
||||
```
|
||||
|
||||
|
||||
As an example, this is how you can setup the handlers in your application.ex file for an application called demo :
|
||||
|
||||
```bash
|
||||
# application.ex
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:demo, :repo])
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Configure Application
|
||||
You need to configure your application to send telemetry data by adding the following config to your `runtime.exs` file:
|
||||
|
||||
```bash
|
||||
config :opentelemetry, :resource, service: %{name: "{{MYAPP}}"}
|
||||
|
||||
config :opentelemetry, :processors,
|
||||
otel_batch_processor: %{
|
||||
exporter:
|
||||
{:opentelemetry_exporter,
|
||||
%{endpoints: ["http://localhost:4318"]}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Elixir application
|
||||
Once you are done instrumenting your Elixir (Phoenix + Ecto) application with OpenTelemetry, you should install the dependencies needed to run your application and run it as you normally would.
|
||||
|
||||
|
||||
|
||||
To see some examples for instrumented applications, you can checkout [this link](https://signoz.io/docs/instrumentation/elixir/#sample-examples)
|
||||
```
|
@ -0,0 +1,62 @@
|
||||
|
||||
|
||||
Follow the steps below to instrument your Elixir (Phoenix + Ecto) Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Install dependencies related to OpenTelemetry by adding them to `mix.exs` file
|
||||
|
||||
```bash
|
||||
{:opentelemetry_exporter, "~> 1.6"},
|
||||
{:opentelemetry_api, "~> 1.2"},
|
||||
{:opentelemetry, "~> 1.3"},
|
||||
{:opentelemetry_semantic_conventions, "~> 0.2"},
|
||||
{:opentelemetry_cowboy, "~> 0.2.1"},
|
||||
{:opentelemetry_phoenix, "~> 1.1"},
|
||||
{:opentelemetry_ecto, "~> 1.1"}
|
||||
```
|
||||
|
||||
|
||||
In your application start, usually the `application.ex` file, setup the telemetry handlers
|
||||
|
||||
```bash
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:{{MYAPP}}, :repo])
|
||||
```
|
||||
|
||||
|
||||
As an example, this is how you can setup the handlers in your application.ex file for an application called demo :
|
||||
|
||||
```bash
|
||||
# application.ex
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:demo, :repo])
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Configure Application
|
||||
You need to configure your application to send telemetry data by adding the following config to your `runtime.exs` file:
|
||||
|
||||
```bash
|
||||
config :opentelemetry, :resource, service: %{name: "{{MYAPP}}"}
|
||||
|
||||
config :opentelemetry, :processors,
|
||||
otel_batch_processor: %{
|
||||
exporter: {
|
||||
:opentelemetry_exporter,
|
||||
%{
|
||||
endpoints: ["https://ingest.{{REGION}}.signoz.cloud:443"],
|
||||
headers: [
|
||||
{"signoz-access-token", {{SIGNOZ_ACCESS_TOKEN}} }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -0,0 +1,6 @@
|
||||
### Running your Elixir application
|
||||
Once you are done instrumenting your Elixir (Phoenix + Ecto) application with OpenTelemetry, you should install the dependencies needed to run your application and run it as you normally would.
|
||||
|
||||
|
||||
|
||||
To see some examples for instrumented applications, you can checkout [this link](https://signoz.io/docs/instrumentation/elixir/#sample-examples)
|
@ -0,0 +1,96 @@
|
||||
### Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_darwin_amd64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_darwin_amd64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Elixir (Phoenix + Ecto) Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Install dependencies related to OpenTelemetry by adding them to `mix.exs` file
|
||||
|
||||
```bash
|
||||
{:opentelemetry_exporter, "~> 1.6"},
|
||||
{:opentelemetry_api, "~> 1.2"},
|
||||
{:opentelemetry, "~> 1.3"},
|
||||
{:opentelemetry_semantic_conventions, "~> 0.2"},
|
||||
{:opentelemetry_cowboy, "~> 0.2.1"},
|
||||
{:opentelemetry_phoenix, "~> 1.1"},
|
||||
{:opentelemetry_ecto, "~> 1.1"}
|
||||
```
|
||||
|
||||
|
||||
In your application start, usually the `application.ex` file, setup the telemetry handlers
|
||||
|
||||
```bash
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:{{MYAPP}}, :repo])
|
||||
```
|
||||
|
||||
|
||||
As an example, this is how you can setup the handlers in your application.ex file for an application called demo :
|
||||
|
||||
```bash
|
||||
# application.ex
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:demo, :repo])
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Configure Application
|
||||
You need to configure your application to send telemetry data by adding the following config to your `runtime.exs` file:
|
||||
|
||||
```bash
|
||||
config :opentelemetry, :resource, service: %{name: "{{MYAPP}}"}
|
||||
|
||||
config :opentelemetry, :processors,
|
||||
otel_batch_processor: %{
|
||||
exporter:
|
||||
{:opentelemetry_exporter,
|
||||
%{endpoints: ["http://localhost:4318"]}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Elixir application
|
||||
Once you are done instrumenting your Elixir (Phoenix + Ecto) application with OpenTelemetry, you should install the dependencies needed to run your application and run it as you normally would.
|
||||
|
||||
|
||||
|
||||
To see some examples for instrumented applications, you can checkout [this link](https://signoz.io/docs/instrumentation/elixir/#sample-examples)
|
||||
```
|
@ -0,0 +1,62 @@
|
||||
|
||||
|
||||
Follow the steps below to instrument your Elixir (Phoenix + Ecto) Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Install dependencies related to OpenTelemetry by adding them to `mix.exs` file
|
||||
|
||||
```bash
|
||||
{:opentelemetry_exporter, "~> 1.6"},
|
||||
{:opentelemetry_api, "~> 1.2"},
|
||||
{:opentelemetry, "~> 1.3"},
|
||||
{:opentelemetry_semantic_conventions, "~> 0.2"},
|
||||
{:opentelemetry_cowboy, "~> 0.2.1"},
|
||||
{:opentelemetry_phoenix, "~> 1.1"},
|
||||
{:opentelemetry_ecto, "~> 1.1"}
|
||||
```
|
||||
|
||||
|
||||
In your application start, usually the `application.ex` file, setup the telemetry handlers
|
||||
|
||||
```bash
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:{{MYAPP}}, :repo])
|
||||
```
|
||||
|
||||
|
||||
As an example, this is how you can setup the handlers in your application.ex file for an application called demo :
|
||||
|
||||
```bash
|
||||
# application.ex
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:demo, :repo])
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Configure Application
|
||||
You need to configure your application to send telemetry data by adding the following config to your `runtime.exs` file:
|
||||
|
||||
```bash
|
||||
config :opentelemetry, :resource, service: %{name: "{{MYAPP}}"}
|
||||
|
||||
config :opentelemetry, :processors,
|
||||
otel_batch_processor: %{
|
||||
exporter: {
|
||||
:opentelemetry_exporter,
|
||||
%{
|
||||
endpoints: ["https://ingest.{{REGION}}.signoz.cloud:443"],
|
||||
headers: [
|
||||
{"signoz-access-token", {{SIGNOZ_ACCESS_TOKEN}} }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -0,0 +1,6 @@
|
||||
### Running your Elixir application
|
||||
Once you are done instrumenting your Elixir (Phoenix + Ecto) application with OpenTelemetry, you should install the dependencies needed to run your application and run it as you normally would.
|
||||
|
||||
|
||||
|
||||
To see some examples for instrumented applications, you can checkout [this link](https://signoz.io/docs/instrumentation/elixir/#sample-examples)
|
@ -0,0 +1,96 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_darwin_arm64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_darwin_arm64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Elixir (Phoenix + Ecto) Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Install dependencies related to OpenTelemetry by adding them to `mix.exs` file
|
||||
|
||||
```bash
|
||||
{:opentelemetry_exporter, "~> 1.6"},
|
||||
{:opentelemetry_api, "~> 1.2"},
|
||||
{:opentelemetry, "~> 1.3"},
|
||||
{:opentelemetry_semantic_conventions, "~> 0.2"},
|
||||
{:opentelemetry_cowboy, "~> 0.2.1"},
|
||||
{:opentelemetry_phoenix, "~> 1.1"},
|
||||
{:opentelemetry_ecto, "~> 1.1"}
|
||||
```
|
||||
|
||||
|
||||
In your application start, usually the `application.ex` file, setup the telemetry handlers
|
||||
|
||||
```bash
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:{{MYAPP}}, :repo])
|
||||
```
|
||||
|
||||
|
||||
As an example, this is how you can setup the handlers in your application.ex file for an application called demo :
|
||||
|
||||
```bash
|
||||
# application.ex
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
:opentelemetry_cowboy.setup()
|
||||
OpentelemetryPhoenix.setup(adapter: :cowboy2)
|
||||
OpentelemetryEcto.setup([:demo, :repo])
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Configure Application
|
||||
You need to configure your application to send telemetry data by adding the following config to your `runtime.exs` file:
|
||||
|
||||
```bash
|
||||
config :opentelemetry, :resource, service: %{name: "{{MYAPP}}"}
|
||||
|
||||
config :opentelemetry, :processors,
|
||||
otel_batch_processor: %{
|
||||
exporter:
|
||||
{:opentelemetry_exporter,
|
||||
%{endpoints: ["http://localhost:4318"]}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Elixir application
|
||||
Once you are done instrumenting your Elixir (Phoenix + Ecto) application with OpenTelemetry, you should install the dependencies needed to run your application and run it as you normally would.
|
||||
|
||||
|
||||
|
||||
To see some examples for instrumented applications, you can checkout [this link](https://signoz.io/docs/instrumentation/elixir/#sample-examples)
|
||||
```
|
@ -20,8 +20,8 @@ This will create and activate a virtual environment named `.venv`
|
||||
### Step 2 : Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
pip install opentelemetry-distro==0.43b0
|
||||
pip install opentelemetry-exporter-otlp==1.22.0
|
||||
```
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ This will create and activate a virtual environment named `.venv`
|
||||
### Step 2 : Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
pip install opentelemetry-distro==0.43b0
|
||||
pip install opentelemetry-exporter-otlp==1.22.0
|
||||
```
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ This will create and activate a virtual environment named `.venv`
|
||||
### Step 2 : Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
pip install opentelemetry-distro==0.43b0
|
||||
pip install opentelemetry-exporter-otlp==1.22.0
|
||||
```
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ This will create and activate a virtual environment named `.venv`
|
||||
### Step 2 : Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
pip install opentelemetry-distro==0.43b0
|
||||
pip install opentelemetry-exporter-otlp==1.22.0
|
||||
```
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ This will create and activate a virtual environment named `.venv`
|
||||
### Step 2 : Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
pip install opentelemetry-distro==0.43b0
|
||||
pip install opentelemetry-exporter-otlp==1.22.0
|
||||
```
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ This will create and activate a virtual environment named `.venv`
|
||||
### Step 2 : Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
pip install opentelemetry-distro==0.43b0
|
||||
pip install opentelemetry-exporter-otlp==1.22.0
|
||||
```
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ This will create and activate a virtual environment named `.venv`
|
||||
### Step 2 : Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
pip install opentelemetry-distro==0.43b0
|
||||
pip install opentelemetry-exporter-otlp==1.22.0
|
||||
```
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ This will create and activate a virtual environment named `.venv`
|
||||
### Step 2 : Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
pip install opentelemetry-distro==0.43b0
|
||||
pip install opentelemetry-exporter-otlp==1.22.0
|
||||
```
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ This will create and activate a virtual environment named `.venv`
|
||||
### Step 2 : Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
pip install opentelemetry-distro==0.43b0
|
||||
pip install opentelemetry-exporter-otlp==1.22.0
|
||||
```
|
||||
|
||||
|
||||
|
@ -0,0 +1,24 @@
|
||||
## Install otel-collector in your Kubernetes infra
|
||||
|
||||
|
||||
Add the SigNoz Helm Chart repository
|
||||
```bash
|
||||
helm repo add signoz https://charts.signoz.io
|
||||
```
|
||||
|
||||
|
||||
If the chart is already present, update the chart to the latest using:
|
||||
```bash
|
||||
helm repo update
|
||||
```
|
||||
|
||||
|
||||
Install the Kubernetes Infrastructure chart provided by SigNoz
|
||||
```bash
|
||||
helm install my-release signoz/k8s-infra \
|
||||
--set otelCollectorEndpoint=ingest.{{REGION}}.signoz.cloud:443 \
|
||||
--set otelInsecure=false \
|
||||
--set signozApiKey={{SIGNOZ_INGESTION_KEY}} \
|
||||
--set global.clusterName=<CLUSTER_NAME>
|
||||
```
|
||||
- Replace `<CLUSTER_NAME>` with the name of the Kubernetes cluster or a unique identifier of the cluster.
|
@ -0,0 +1,95 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Rust Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
|
||||
|
||||
```rust
|
||||
opentelemetry = { version = "0.18.0", features = ["rt-tokio", "metrics", "trace"] }
|
||||
opentelemetry-otlp = { version = "0.11.0", features = ["trace", "metrics"] }
|
||||
opentelemetry-semantic-conventions = { version = "0.10.0" }
|
||||
opentelemetry-proto = { version = "0.1.0"}
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tonic = { version = "0.8.2", features = ["tls-roots"] }
|
||||
```
|
||||
|
||||
|
||||
Use the above crates in entry point of your Rust application, which is generally your `main.rs` file
|
||||
|
||||
```rust
|
||||
use opentelemetry::global::shutdown_tracer_provider;
|
||||
use opentelemetry::sdk::Resource;
|
||||
use opentelemetry::trace::TraceError;
|
||||
use opentelemetry::{
|
||||
global, sdk::trace as sdktrace,
|
||||
trace::{TraceContextExt, Tracer},
|
||||
Context, Key, KeyValue,
|
||||
};
|
||||
use opentelemetry_otlp::WithExportConfig;
|
||||
use tonic::metadata::{MetadataMap, MetadataValue};
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Add `init_tracer` function to your `main.rs` file. It initializes an OpenTelemetry tracer with the OpenTelemetry OTLP exporter which is sending data to SigNoz Cloud.
|
||||
|
||||
```rust
|
||||
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
|
||||
opentelemetry_otlp::new_pipeline()
|
||||
.tracing()
|
||||
.with_exporter(opentelemetry_otlp::new_exporter().tonic().with_env())
|
||||
.with_trace_config(
|
||||
sdktrace::config().with_resource(Resource::default()),
|
||||
)
|
||||
.install_batch(opentelemetry::runtime::Tokio)
|
||||
}
|
||||
```
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
Call the `init_tracer` function inside `main()` at starting so that as soon as your rust application starts, tracer will be available globally.
|
||||
|
||||
```rust
|
||||
let _ = init_tracer();
|
||||
```
|
||||
|
||||
Modify your `main()` function from
|
||||
|
||||
```rust
|
||||
fn main(){
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
to
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
Add the below code block within a function or a section of your code where you're setting up and using the tracer for distributed tracing. After adding the below code block you can send traces to SigNoz Cloud
|
||||
|
||||
```rust
|
||||
let tracer = global::tracer("global_tracer");
|
||||
let _cx = Context::new();
|
||||
|
||||
tracer.in_span("operation", |cx| {
|
||||
let span = cx.span();
|
||||
span.set_attribute(Key::new("KEY").string("value"));
|
||||
|
||||
span.add_event(
|
||||
format!("Operations"),
|
||||
vec![
|
||||
Key::new("SigNoz is").string("working!"),
|
||||
],
|
||||
);
|
||||
});
|
||||
shutdown_tracer_provider()
|
||||
```
|
||||
|
||||
The above code block will create a span named operation which sets an attribute and an event to it saying "SigNoz is working!".
|
@ -0,0 +1,7 @@
|
||||
### Running your Rust application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}} cargo run
|
||||
```
|
@ -0,0 +1,133 @@
|
||||
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
|
||||
|
||||
```rust
|
||||
opentelemetry = { version = "0.18.0", features = ["rt-tokio", "metrics", "trace"] }
|
||||
opentelemetry-otlp = { version = "0.11.0", features = ["trace", "metrics"] }
|
||||
opentelemetry-semantic-conventions = { version = "0.10.0" }
|
||||
opentelemetry-proto = { version = "0.1.0"}
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tonic = { version = "0.8.2", features = ["tls-roots"] }
|
||||
dotenv = "0.15.0"
|
||||
```
|
||||
|
||||
|
||||
Use the above crates in entry point of your Rust application, which is generally your `main.rs` file
|
||||
|
||||
```rust
|
||||
use dotenv::dotenv;
|
||||
use opentelemetry::global::shutdown_tracer_provider;
|
||||
use opentelemetry::sdk::Resource;
|
||||
use opentelemetry::trace::TraceError;
|
||||
use opentelemetry::{
|
||||
global, sdk::trace as sdktrace,
|
||||
trace::{TraceContextExt, Tracer},
|
||||
Context, Key, KeyValue,
|
||||
};
|
||||
use opentelemetry_otlp::WithExportConfig;
|
||||
use tonic::metadata::{MetadataMap, MetadataValue};
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Initialize tracer and create env file
|
||||
Add `init_tracer` function to your `main.rs` file. It initializes an OpenTelemetry tracer with the OpenTelemetry OTLP exporter which is sending data to SigNoz Cloud.
|
||||
|
||||
```rust
|
||||
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
|
||||
let signoz_access_token = std::env::var("SIGNOZ_ACCESS_TOKEN").expect("SIGNOZ_ACCESS_TOKEN not set");
|
||||
let mut metadata = MetadataMap::new();
|
||||
metadata.insert(
|
||||
"signoz-access-token",
|
||||
MetadataValue::from_str(&signoz_access_token).unwrap(),
|
||||
);
|
||||
opentelemetry_otlp::new_pipeline()
|
||||
.tracing()
|
||||
.with_exporter(
|
||||
opentelemetry_otlp::new_exporter()
|
||||
.tonic()
|
||||
.with_metadata(metadata)
|
||||
.with_endpoint(std::env::var("SIGNOZ_ENDPOINT").expect("SIGNOZ_ENDPOINT not set")),
|
||||
)
|
||||
.with_trace_config(
|
||||
sdktrace::config().with_resource(Resource::new(vec![
|
||||
KeyValue::new(
|
||||
opentelemetry_semantic_conventions::resource::SERVICE_NAME,
|
||||
std::env::var("APP_NAME").expect("APP_NAME not set"),
|
||||
),
|
||||
])),
|
||||
)
|
||||
.install_batch(opentelemetry::runtime::Tokio)
|
||||
}
|
||||
```
|
||||
|
||||
After adding the above function in your `main.rs` file, create an `.env` file in root of your app. The structure could look like this :
|
||||
|
||||
```bash
|
||||
project_root/
|
||||
|-- Cargo.toml
|
||||
|-- src/
|
||||
| |-- main.rs
|
||||
|-- .env
|
||||
```
|
||||
|
||||
In your environment file, paste the below variables which will be used in the next steps.
|
||||
|
||||
```rust
|
||||
PORT=3000 // If it is a web app pass port or else you can ignore this variable
|
||||
APP_NAME={{MYAPP}}
|
||||
SIGNOZ_ENDPOINT=https://ingest.{{REGION}}.signoz.cloud:443/v1/traces
|
||||
SIGNOZ_ACCESS_TOKEN={{SIGNOZ_INGESTION_KEY}}
|
||||
```
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
|
||||
Call the `init_tracer` function inside `main()` at starting so that as soon as your rust application starts, tracer will be available globally.
|
||||
|
||||
```rust
|
||||
dotenv().ok();
|
||||
let _ = init_tracer();
|
||||
```
|
||||
|
||||
Modify your `main()` function from
|
||||
|
||||
```rust
|
||||
fn main(){
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
to
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
Add the below code block within a function or a section of your code where you're setting up and using the tracer for distributed tracing. After adding the below code block you can send traces to SigNoz Cloud
|
||||
|
||||
```rust
|
||||
let tracer = global::tracer("global_tracer");
|
||||
let _cx = Context::new();
|
||||
|
||||
tracer.in_span("operation", |cx| {
|
||||
let span = cx.span();
|
||||
span.set_attribute(Key::new("KEY").string("value"));
|
||||
|
||||
span.add_event(
|
||||
format!("Operations"),
|
||||
vec![
|
||||
Key::new("SigNoz is").string("working!"),
|
||||
],
|
||||
);
|
||||
});
|
||||
shutdown_tracer_provider()
|
||||
```
|
||||
|
||||
The above code block will create a span named operation which sets an attribute and an event to it saying "SigNoz is working!".
|
@ -0,0 +1,7 @@
|
||||
### Running your Rust application
|
||||
|
||||
Since your variables are set in the `.env` file, you can run your Rust application using the below command:
|
||||
|
||||
```bash
|
||||
cargo run
|
||||
```
|
@ -0,0 +1,96 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_linux_amd64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_linux_amd64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,95 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Rust Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
|
||||
|
||||
```rust
|
||||
opentelemetry = { version = "0.18.0", features = ["rt-tokio", "metrics", "trace"] }
|
||||
opentelemetry-otlp = { version = "0.11.0", features = ["trace", "metrics"] }
|
||||
opentelemetry-semantic-conventions = { version = "0.10.0" }
|
||||
opentelemetry-proto = { version = "0.1.0"}
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tonic = { version = "0.8.2", features = ["tls-roots"] }
|
||||
```
|
||||
|
||||
|
||||
Use the above crates in entry point of your Rust application, which is generally your `main.rs` file
|
||||
|
||||
```rust
|
||||
use opentelemetry::global::shutdown_tracer_provider;
|
||||
use opentelemetry::sdk::Resource;
|
||||
use opentelemetry::trace::TraceError;
|
||||
use opentelemetry::{
|
||||
global, sdk::trace as sdktrace,
|
||||
trace::{TraceContextExt, Tracer},
|
||||
Context, Key, KeyValue,
|
||||
};
|
||||
use opentelemetry_otlp::WithExportConfig;
|
||||
use tonic::metadata::{MetadataMap, MetadataValue};
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Add `init_tracer` function to your `main.rs` file. It initializes an OpenTelemetry tracer with the OpenTelemetry OTLP exporter which is sending data to SigNoz Cloud.
|
||||
|
||||
```rust
|
||||
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
|
||||
opentelemetry_otlp::new_pipeline()
|
||||
.tracing()
|
||||
.with_exporter(opentelemetry_otlp::new_exporter().tonic().with_env())
|
||||
.with_trace_config(
|
||||
sdktrace::config().with_resource(Resource::default()),
|
||||
)
|
||||
.install_batch(opentelemetry::runtime::Tokio)
|
||||
}
|
||||
```
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
Call the `init_tracer` function inside `main()` at starting so that as soon as your rust application starts, tracer will be available globally.
|
||||
|
||||
```rust
|
||||
let _ = init_tracer();
|
||||
```
|
||||
|
||||
Modify your `main()` function from
|
||||
|
||||
```rust
|
||||
fn main(){
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
to
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
Add the below code block within a function or a section of your code where you're setting up and using the tracer for distributed tracing. After adding the below code block you can send traces to SigNoz Cloud
|
||||
|
||||
```rust
|
||||
let tracer = global::tracer("global_tracer");
|
||||
let _cx = Context::new();
|
||||
|
||||
tracer.in_span("operation", |cx| {
|
||||
let span = cx.span();
|
||||
span.set_attribute(Key::new("KEY").string("value"));
|
||||
|
||||
span.add_event(
|
||||
format!("Operations"),
|
||||
vec![
|
||||
Key::new("SigNoz is").string("working!"),
|
||||
],
|
||||
);
|
||||
});
|
||||
shutdown_tracer_provider()
|
||||
```
|
||||
|
||||
The above code block will create a span named operation which sets an attribute and an event to it saying "SigNoz is working!".
|
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
Once you are done instrumenting your Rust application, you can run it using the below commands
|
||||
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Rust application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 OTEL_RESOURCE_ATTRIBUTES=service.name=s{{MYAPP}} cargo run
|
||||
```
|
@ -0,0 +1,133 @@
|
||||
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
|
||||
|
||||
```rust
|
||||
opentelemetry = { version = "0.18.0", features = ["rt-tokio", "metrics", "trace"] }
|
||||
opentelemetry-otlp = { version = "0.11.0", features = ["trace", "metrics"] }
|
||||
opentelemetry-semantic-conventions = { version = "0.10.0" }
|
||||
opentelemetry-proto = { version = "0.1.0"}
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tonic = { version = "0.8.2", features = ["tls-roots"] }
|
||||
dotenv = "0.15.0"
|
||||
```
|
||||
|
||||
|
||||
Use the above crates in entry point of your Rust application, which is generally your `main.rs` file
|
||||
|
||||
```rust
|
||||
use dotenv::dotenv;
|
||||
use opentelemetry::global::shutdown_tracer_provider;
|
||||
use opentelemetry::sdk::Resource;
|
||||
use opentelemetry::trace::TraceError;
|
||||
use opentelemetry::{
|
||||
global, sdk::trace as sdktrace,
|
||||
trace::{TraceContextExt, Tracer},
|
||||
Context, Key, KeyValue,
|
||||
};
|
||||
use opentelemetry_otlp::WithExportConfig;
|
||||
use tonic::metadata::{MetadataMap, MetadataValue};
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Initialize tracer and create env file
|
||||
Add `init_tracer` function to your `main.rs` file. It initializes an OpenTelemetry tracer with the OpenTelemetry OTLP exporter which is sending data to SigNoz Cloud.
|
||||
|
||||
```rust
|
||||
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
|
||||
let signoz_access_token = std::env::var("SIGNOZ_ACCESS_TOKEN").expect("SIGNOZ_ACCESS_TOKEN not set");
|
||||
let mut metadata = MetadataMap::new();
|
||||
metadata.insert(
|
||||
"signoz-access-token",
|
||||
MetadataValue::from_str(&signoz_access_token).unwrap(),
|
||||
);
|
||||
opentelemetry_otlp::new_pipeline()
|
||||
.tracing()
|
||||
.with_exporter(
|
||||
opentelemetry_otlp::new_exporter()
|
||||
.tonic()
|
||||
.with_metadata(metadata)
|
||||
.with_endpoint(std::env::var("SIGNOZ_ENDPOINT").expect("SIGNOZ_ENDPOINT not set")),
|
||||
)
|
||||
.with_trace_config(
|
||||
sdktrace::config().with_resource(Resource::new(vec![
|
||||
KeyValue::new(
|
||||
opentelemetry_semantic_conventions::resource::SERVICE_NAME,
|
||||
std::env::var("APP_NAME").expect("APP_NAME not set"),
|
||||
),
|
||||
])),
|
||||
)
|
||||
.install_batch(opentelemetry::runtime::Tokio)
|
||||
}
|
||||
```
|
||||
|
||||
After adding the above function in your `main.rs` file, create an `.env` file in root of your app. The structure could look like this :
|
||||
|
||||
```bash
|
||||
project_root/
|
||||
|-- Cargo.toml
|
||||
|-- src/
|
||||
| |-- main.rs
|
||||
|-- .env
|
||||
```
|
||||
|
||||
In your environnement file, paste the below variables which will be used in the next steps.
|
||||
|
||||
```rust
|
||||
PORT=3000 // If it is a web app pass port or else you can ignore this variable
|
||||
APP_NAME={{MYAPP}}
|
||||
SIGNOZ_ENDPOINT=https://ingest.{{REGION}}.signoz.cloud:443/v1/traces
|
||||
SIGNOZ_ACCESS_TOKEN={{SIGNOZ_INGESTION_KEY}}
|
||||
```
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
|
||||
Call the `init_tracer` function inside `main()` at starting so that as soon as your rust application starts, tracer will be available globally.
|
||||
|
||||
```rust
|
||||
dotenv().ok();
|
||||
let _ = init_tracer();
|
||||
```
|
||||
|
||||
Modify your `main()` function from
|
||||
|
||||
```rust
|
||||
fn main(){
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
to
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
Add the below code block within a function or a section of your code where you're setting up and using the tracer for distributed tracing. After adding the below code block you can send traces to SigNoz Cloud
|
||||
|
||||
```rust
|
||||
let tracer = global::tracer("global_tracer");
|
||||
let _cx = Context::new();
|
||||
|
||||
tracer.in_span("operation", |cx| {
|
||||
let span = cx.span();
|
||||
span.set_attribute(Key::new("KEY").string("value"));
|
||||
|
||||
span.add_event(
|
||||
format!("Operations"),
|
||||
vec![
|
||||
Key::new("SigNoz is").string("working!"),
|
||||
],
|
||||
);
|
||||
});
|
||||
shutdown_tracer_provider()
|
||||
```
|
||||
|
||||
The above code block will create a span named operation which sets an attribute and an event to it saying "SigNoz is working!".
|
@ -0,0 +1,7 @@
|
||||
### Running your Rust application
|
||||
|
||||
Since your variables are set in the `.env` file, you can run your Rust application using the below command:
|
||||
|
||||
```bash
|
||||
cargo run
|
||||
```
|
@ -0,0 +1,96 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_linux_arm64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_linux_arm64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,95 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Rust Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
|
||||
|
||||
```rust
|
||||
opentelemetry = { version = "0.18.0", features = ["rt-tokio", "metrics", "trace"] }
|
||||
opentelemetry-otlp = { version = "0.11.0", features = ["trace", "metrics"] }
|
||||
opentelemetry-semantic-conventions = { version = "0.10.0" }
|
||||
opentelemetry-proto = { version = "0.1.0"}
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tonic = { version = "0.8.2", features = ["tls-roots"] }
|
||||
```
|
||||
|
||||
|
||||
Use the above crates in entry point of your Rust application, which is generally your `main.rs` file
|
||||
|
||||
```rust
|
||||
use opentelemetry::global::shutdown_tracer_provider;
|
||||
use opentelemetry::sdk::Resource;
|
||||
use opentelemetry::trace::TraceError;
|
||||
use opentelemetry::{
|
||||
global, sdk::trace as sdktrace,
|
||||
trace::{TraceContextExt, Tracer},
|
||||
Context, Key, KeyValue,
|
||||
};
|
||||
use opentelemetry_otlp::WithExportConfig;
|
||||
use tonic::metadata::{MetadataMap, MetadataValue};
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Add `init_tracer` function to your `main.rs` file. It initializes an OpenTelemetry tracer with the OpenTelemetry OTLP exporter which is sending data to SigNoz Cloud.
|
||||
|
||||
```rust
|
||||
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
|
||||
opentelemetry_otlp::new_pipeline()
|
||||
.tracing()
|
||||
.with_exporter(opentelemetry_otlp::new_exporter().tonic().with_env())
|
||||
.with_trace_config(
|
||||
sdktrace::config().with_resource(Resource::default()),
|
||||
)
|
||||
.install_batch(opentelemetry::runtime::Tokio)
|
||||
}
|
||||
```
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
Call the `init_tracer` function inside `main()` at starting so that as soon as your rust application starts, tracer will be available globally.
|
||||
|
||||
```rust
|
||||
let _ = init_tracer();
|
||||
```
|
||||
|
||||
Modify your `main()` function from
|
||||
|
||||
```rust
|
||||
fn main(){
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
to
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
Add the below code block within a function or a section of your code where you're setting up and using the tracer for distributed tracing. After adding the below code block you can send traces to SigNoz Cloud
|
||||
|
||||
```rust
|
||||
let tracer = global::tracer("global_tracer");
|
||||
let _cx = Context::new();
|
||||
|
||||
tracer.in_span("operation", |cx| {
|
||||
let span = cx.span();
|
||||
span.set_attribute(Key::new("KEY").string("value"));
|
||||
|
||||
span.add_event(
|
||||
format!("Operations"),
|
||||
vec![
|
||||
Key::new("SigNoz is").string("working!"),
|
||||
],
|
||||
);
|
||||
});
|
||||
shutdown_tracer_provider()
|
||||
```
|
||||
|
||||
The above code block will create a span named operation which sets an attribute and an event to it saying "SigNoz is working!".
|
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
Once you are done instrumenting your Rust application, you can run it using the below commands
|
||||
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Rust application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 OTEL_RESOURCE_ATTRIBUTES=service.name=s{{MYAPP}} cargo run
|
||||
```
|
@ -0,0 +1,133 @@
|
||||
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
|
||||
|
||||
```rust
|
||||
opentelemetry = { version = "0.18.0", features = ["rt-tokio", "metrics", "trace"] }
|
||||
opentelemetry-otlp = { version = "0.11.0", features = ["trace", "metrics"] }
|
||||
opentelemetry-semantic-conventions = { version = "0.10.0" }
|
||||
opentelemetry-proto = { version = "0.1.0"}
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tonic = { version = "0.8.2", features = ["tls-roots"] }
|
||||
dotenv = "0.15.0"
|
||||
```
|
||||
|
||||
|
||||
Use the above crates in entry point of your Rust application, which is generally your `main.rs` file
|
||||
|
||||
```rust
|
||||
use dotenv::dotenv;
|
||||
use opentelemetry::global::shutdown_tracer_provider;
|
||||
use opentelemetry::sdk::Resource;
|
||||
use opentelemetry::trace::TraceError;
|
||||
use opentelemetry::{
|
||||
global, sdk::trace as sdktrace,
|
||||
trace::{TraceContextExt, Tracer},
|
||||
Context, Key, KeyValue,
|
||||
};
|
||||
use opentelemetry_otlp::WithExportConfig;
|
||||
use tonic::metadata::{MetadataMap, MetadataValue};
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Initialize tracer and create env file
|
||||
Add `init_tracer` function to your `main.rs` file. It initializes an OpenTelemetry tracer with the OpenTelemetry OTLP exporter which is sending data to SigNoz Cloud.
|
||||
|
||||
```rust
|
||||
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
|
||||
let signoz_access_token = std::env::var("SIGNOZ_ACCESS_TOKEN").expect("SIGNOZ_ACCESS_TOKEN not set");
|
||||
let mut metadata = MetadataMap::new();
|
||||
metadata.insert(
|
||||
"signoz-access-token",
|
||||
MetadataValue::from_str(&signoz_access_token).unwrap(),
|
||||
);
|
||||
opentelemetry_otlp::new_pipeline()
|
||||
.tracing()
|
||||
.with_exporter(
|
||||
opentelemetry_otlp::new_exporter()
|
||||
.tonic()
|
||||
.with_metadata(metadata)
|
||||
.with_endpoint(std::env::var("SIGNOZ_ENDPOINT").expect("SIGNOZ_ENDPOINT not set")),
|
||||
)
|
||||
.with_trace_config(
|
||||
sdktrace::config().with_resource(Resource::new(vec![
|
||||
KeyValue::new(
|
||||
opentelemetry_semantic_conventions::resource::SERVICE_NAME,
|
||||
std::env::var("APP_NAME").expect("APP_NAME not set"),
|
||||
),
|
||||
])),
|
||||
)
|
||||
.install_batch(opentelemetry::runtime::Tokio)
|
||||
}
|
||||
```
|
||||
|
||||
After adding the above function in your `main.rs` file, create an `.env` file in root of your app. The structure could look like this :
|
||||
|
||||
```bash
|
||||
project_root/
|
||||
|-- Cargo.toml
|
||||
|-- src/
|
||||
| |-- main.rs
|
||||
|-- .env
|
||||
```
|
||||
|
||||
In your environment file, paste the below variables which will be used in the next steps.
|
||||
|
||||
```rust
|
||||
PORT=3000 // If it is a web app pass port or else you can ignore this variable
|
||||
APP_NAME={{MYAPP}}
|
||||
SIGNOZ_ENDPOINT=https://ingest.{{REGION}}.signoz.cloud:443/v1/traces
|
||||
SIGNOZ_ACCESS_TOKEN={{SIGNOZ_INGESTION_KEY}}
|
||||
```
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
|
||||
Call the `init_tracer` function inside `main()` at starting so that as soon as your rust application starts, tracer will be available globally.
|
||||
|
||||
```rust
|
||||
dotenv().ok();
|
||||
let _ = init_tracer();
|
||||
```
|
||||
|
||||
Modify your `main()` function from
|
||||
|
||||
```rust
|
||||
fn main(){
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
to
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
Add the below code block within a function or a section of your code where you're setting up and using the tracer for distributed tracing. After adding the below code block you can send traces to SigNoz Cloud
|
||||
|
||||
```rust
|
||||
let tracer = global::tracer("global_tracer");
|
||||
let _cx = Context::new();
|
||||
|
||||
tracer.in_span("operation", |cx| {
|
||||
let span = cx.span();
|
||||
span.set_attribute(Key::new("KEY").string("value"));
|
||||
|
||||
span.add_event(
|
||||
format!("Operations"),
|
||||
vec![
|
||||
Key::new("SigNoz is").string("working!"),
|
||||
],
|
||||
);
|
||||
});
|
||||
shutdown_tracer_provider()
|
||||
```
|
||||
|
||||
The above code block will create a span named operation which sets an attribute and an event to it saying "SigNoz is working!".
|
@ -0,0 +1,7 @@
|
||||
### Running your Rust application
|
||||
|
||||
Since your variables are set in the `.env` file, you can run your Rust application using the below command:
|
||||
|
||||
```bash
|
||||
cargo run
|
||||
```
|
@ -0,0 +1,96 @@
|
||||
### Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_darwin_amd64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_darwin_amd64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,95 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Rust Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
|
||||
|
||||
```rust
|
||||
opentelemetry = { version = "0.18.0", features = ["rt-tokio", "metrics", "trace"] }
|
||||
opentelemetry-otlp = { version = "0.11.0", features = ["trace", "metrics"] }
|
||||
opentelemetry-semantic-conventions = { version = "0.10.0" }
|
||||
opentelemetry-proto = { version = "0.1.0"}
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tonic = { version = "0.8.2", features = ["tls-roots"] }
|
||||
```
|
||||
|
||||
|
||||
Use the above crates in entry point of your Rust application, which is generally your `main.rs` file
|
||||
|
||||
```rust
|
||||
use opentelemetry::global::shutdown_tracer_provider;
|
||||
use opentelemetry::sdk::Resource;
|
||||
use opentelemetry::trace::TraceError;
|
||||
use opentelemetry::{
|
||||
global, sdk::trace as sdktrace,
|
||||
trace::{TraceContextExt, Tracer},
|
||||
Context, Key, KeyValue,
|
||||
};
|
||||
use opentelemetry_otlp::WithExportConfig;
|
||||
use tonic::metadata::{MetadataMap, MetadataValue};
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Add `init_tracer` function to your `main.rs` file. It initializes an OpenTelemetry tracer with the OpenTelemetry OTLP exporter which is sending data to SigNoz Cloud.
|
||||
|
||||
```rust
|
||||
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
|
||||
opentelemetry_otlp::new_pipeline()
|
||||
.tracing()
|
||||
.with_exporter(opentelemetry_otlp::new_exporter().tonic().with_env())
|
||||
.with_trace_config(
|
||||
sdktrace::config().with_resource(Resource::default()),
|
||||
)
|
||||
.install_batch(opentelemetry::runtime::Tokio)
|
||||
}
|
||||
```
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
Call the `init_tracer` function inside `main()` at starting so that as soon as your rust application starts, tracer will be available globally.
|
||||
|
||||
```rust
|
||||
let _ = init_tracer();
|
||||
```
|
||||
|
||||
Modify your `main()` function from
|
||||
|
||||
```rust
|
||||
fn main(){
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
to
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
Add the below code block within a function or a section of your code where you're setting up and using the tracer for distributed tracing. After adding the below code block you can send traces to SigNoz Cloud
|
||||
|
||||
```rust
|
||||
let tracer = global::tracer("global_tracer");
|
||||
let _cx = Context::new();
|
||||
|
||||
tracer.in_span("operation", |cx| {
|
||||
let span = cx.span();
|
||||
span.set_attribute(Key::new("KEY").string("value"));
|
||||
|
||||
span.add_event(
|
||||
format!("Operations"),
|
||||
vec![
|
||||
Key::new("SigNoz is").string("working!"),
|
||||
],
|
||||
);
|
||||
});
|
||||
shutdown_tracer_provider()
|
||||
```
|
||||
|
||||
The above code block will create a span named operation which sets an attribute and an event to it saying "SigNoz is working!".
|
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
Once you are done instrumenting your Rust application, you can run it using the below commands
|
||||
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Rust application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 OTEL_RESOURCE_ATTRIBUTES=service.name=s{{MYAPP}} cargo run
|
||||
```
|
@ -0,0 +1,133 @@
|
||||
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
|
||||
|
||||
```rust
|
||||
opentelemetry = { version = "0.18.0", features = ["rt-tokio", "metrics", "trace"] }
|
||||
opentelemetry-otlp = { version = "0.11.0", features = ["trace", "metrics"] }
|
||||
opentelemetry-semantic-conventions = { version = "0.10.0" }
|
||||
opentelemetry-proto = { version = "0.1.0"}
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tonic = { version = "0.8.2", features = ["tls-roots"] }
|
||||
dotenv = "0.15.0"
|
||||
```
|
||||
|
||||
|
||||
Use the above crates in entry point of your Rust application, which is generally your `main.rs` file
|
||||
|
||||
```rust
|
||||
use dotenv::dotenv;
|
||||
use opentelemetry::global::shutdown_tracer_provider;
|
||||
use opentelemetry::sdk::Resource;
|
||||
use opentelemetry::trace::TraceError;
|
||||
use opentelemetry::{
|
||||
global, sdk::trace as sdktrace,
|
||||
trace::{TraceContextExt, Tracer},
|
||||
Context, Key, KeyValue,
|
||||
};
|
||||
use opentelemetry_otlp::WithExportConfig;
|
||||
use tonic::metadata::{MetadataMap, MetadataValue};
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Initialize tracer and create env file
|
||||
Add `init_tracer` function to your `main.rs` file. It initializes an OpenTelemetry tracer with the OpenTelemetry OTLP exporter which is sending data to SigNoz Cloud.
|
||||
|
||||
```rust
|
||||
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
|
||||
let signoz_access_token = std::env::var("SIGNOZ_ACCESS_TOKEN").expect("SIGNOZ_ACCESS_TOKEN not set");
|
||||
let mut metadata = MetadataMap::new();
|
||||
metadata.insert(
|
||||
"signoz-access-token",
|
||||
MetadataValue::from_str(&signoz_access_token).unwrap(),
|
||||
);
|
||||
opentelemetry_otlp::new_pipeline()
|
||||
.tracing()
|
||||
.with_exporter(
|
||||
opentelemetry_otlp::new_exporter()
|
||||
.tonic()
|
||||
.with_metadata(metadata)
|
||||
.with_endpoint(std::env::var("SIGNOZ_ENDPOINT").expect("SIGNOZ_ENDPOINT not set")),
|
||||
)
|
||||
.with_trace_config(
|
||||
sdktrace::config().with_resource(Resource::new(vec![
|
||||
KeyValue::new(
|
||||
opentelemetry_semantic_conventions::resource::SERVICE_NAME,
|
||||
std::env::var("APP_NAME").expect("APP_NAME not set"),
|
||||
),
|
||||
])),
|
||||
)
|
||||
.install_batch(opentelemetry::runtime::Tokio)
|
||||
}
|
||||
```
|
||||
|
||||
After adding the above function in your `main.rs` file, create an `.env` file in root of your app. The structure could look like this :
|
||||
|
||||
```bash
|
||||
project_root/
|
||||
|-- Cargo.toml
|
||||
|-- src/
|
||||
| |-- main.rs
|
||||
|-- .env
|
||||
```
|
||||
|
||||
In your environment file, paste the below variables which will be used in the next steps.
|
||||
|
||||
```rust
|
||||
PORT=3000 // If it is a web app pass port or else you can ignore this variable
|
||||
APP_NAME={{MYAPP}}
|
||||
SIGNOZ_ENDPOINT=https://ingest.{{REGION}}.signoz.cloud:443/v1/traces
|
||||
SIGNOZ_ACCESS_TOKEN={{SIGNOZ_INGESTION_KEY}}
|
||||
```
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
|
||||
Call the `init_tracer` function inside `main()` at starting so that as soon as your rust application starts, tracer will be available globally.
|
||||
|
||||
```rust
|
||||
dotenv().ok();
|
||||
let _ = init_tracer();
|
||||
```
|
||||
|
||||
Modify your `main()` function from
|
||||
|
||||
```rust
|
||||
fn main(){
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
to
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
Add the below code block within a function or a section of your code where you're setting up and using the tracer for distributed tracing. After adding the below code block you can send traces to SigNoz Cloud
|
||||
|
||||
```rust
|
||||
let tracer = global::tracer("global_tracer");
|
||||
let _cx = Context::new();
|
||||
|
||||
tracer.in_span("operation", |cx| {
|
||||
let span = cx.span();
|
||||
span.set_attribute(Key::new("KEY").string("value"));
|
||||
|
||||
span.add_event(
|
||||
format!("Operations"),
|
||||
vec![
|
||||
Key::new("SigNoz is").string("working!"),
|
||||
],
|
||||
);
|
||||
});
|
||||
shutdown_tracer_provider()
|
||||
```
|
||||
|
||||
The above code block will create a span named operation which sets an attribute and an event to it saying "SigNoz is working!".
|
@ -0,0 +1,7 @@
|
||||
### Running your Rust application
|
||||
|
||||
Since your variables are set in the `.env` file, you can run your Rust application using the below command:
|
||||
|
||||
```bash
|
||||
cargo run
|
||||
```
|
@ -0,0 +1,96 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_darwin_arm64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_darwin_arm64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,95 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Rust Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
|
||||
|
||||
```rust
|
||||
opentelemetry = { version = "0.18.0", features = ["rt-tokio", "metrics", "trace"] }
|
||||
opentelemetry-otlp = { version = "0.11.0", features = ["trace", "metrics"] }
|
||||
opentelemetry-semantic-conventions = { version = "0.10.0" }
|
||||
opentelemetry-proto = { version = "0.1.0"}
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tonic = { version = "0.8.2", features = ["tls-roots"] }
|
||||
```
|
||||
|
||||
|
||||
Use the above crates in entry point of your Rust application, which is generally your `main.rs` file
|
||||
|
||||
```rust
|
||||
use opentelemetry::global::shutdown_tracer_provider;
|
||||
use opentelemetry::sdk::Resource;
|
||||
use opentelemetry::trace::TraceError;
|
||||
use opentelemetry::{
|
||||
global, sdk::trace as sdktrace,
|
||||
trace::{TraceContextExt, Tracer},
|
||||
Context, Key, KeyValue,
|
||||
};
|
||||
use opentelemetry_otlp::WithExportConfig;
|
||||
use tonic::metadata::{MetadataMap, MetadataValue};
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Add `init_tracer` function to your `main.rs` file. It initializes an OpenTelemetry tracer with the OpenTelemetry OTLP exporter which is sending data to SigNoz Cloud.
|
||||
|
||||
```rust
|
||||
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
|
||||
opentelemetry_otlp::new_pipeline()
|
||||
.tracing()
|
||||
.with_exporter(opentelemetry_otlp::new_exporter().tonic().with_env())
|
||||
.with_trace_config(
|
||||
sdktrace::config().with_resource(Resource::default()),
|
||||
)
|
||||
.install_batch(opentelemetry::runtime::Tokio)
|
||||
}
|
||||
```
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
Call the `init_tracer` function inside `main()` at starting so that as soon as your rust application starts, tracer will be available globally.
|
||||
|
||||
```rust
|
||||
let _ = init_tracer();
|
||||
```
|
||||
|
||||
Modify your `main()` function from
|
||||
|
||||
```rust
|
||||
fn main(){
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
to
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
//rest of the code
|
||||
}
|
||||
```
|
||||
|
||||
Add the below code block within a function or a section of your code where you're setting up and using the tracer for distributed tracing. After adding the below code block you can send traces to SigNoz Cloud
|
||||
|
||||
```rust
|
||||
let tracer = global::tracer("global_tracer");
|
||||
let _cx = Context::new();
|
||||
|
||||
tracer.in_span("operation", |cx| {
|
||||
let span = cx.span();
|
||||
span.set_attribute(Key::new("KEY").string("value"));
|
||||
|
||||
span.add_event(
|
||||
format!("Operations"),
|
||||
vec![
|
||||
Key::new("SigNoz is").string("working!"),
|
||||
],
|
||||
);
|
||||
});
|
||||
shutdown_tracer_provider()
|
||||
```
|
||||
|
||||
The above code block will create a span named operation which sets an attribute and an event to it saying "SigNoz is working!".
|
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
Once you are done instrumenting your Rust application, you can run it using the below commands
|
||||
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Rust application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 OTEL_RESOURCE_ATTRIBUTES=service.name=s{{MYAPP}} cargo run
|
||||
```
|
@ -0,0 +1,24 @@
|
||||
## Install otel-collector in your Kubernetes infra
|
||||
|
||||
|
||||
Add the SigNoz Helm Chart repository
|
||||
```bash
|
||||
helm repo add signoz https://charts.signoz.io
|
||||
```
|
||||
|
||||
|
||||
If the chart is already present, update the chart to the latest using:
|
||||
```bash
|
||||
helm repo update
|
||||
```
|
||||
|
||||
|
||||
Install the Kubernetes Infrastructure chart provided by SigNoz
|
||||
```bash
|
||||
helm install my-release signoz/k8s-infra \
|
||||
--set otelCollectorEndpoint=ingest.{{REGION}}.signoz.cloud:443 \
|
||||
--set otelInsecure=false \
|
||||
--set signozApiKey={{SIGNOZ_INGESTION_KEY}} \
|
||||
--set global.clusterName=<CLUSTER_NAME>
|
||||
```
|
||||
- Replace `<CLUSTER_NAME>` with the name of the Kubernetes cluster or a unique identifier of the cluster.
|
@ -0,0 +1,68 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Swift Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
|
||||
To configure your Swift application to send data you need to initialize OpenTelemetry. Add these dependency in `Package.swift` file of your project or if you are using XCode then you need to add this [dependency](https://github.com/open-telemetry/opentelemetry-swift) and then import these below dependencies in the main file.
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import GRPC
|
||||
import NIO
|
||||
import NIOSSL
|
||||
import OpenTelemetryApi
|
||||
import OpenTelemetryProtocolExporterCommon
|
||||
import OpenTelemetryProtocolExporterGrpc
|
||||
import OpenTelemetrySdk
|
||||
import ResourceExtension
|
||||
import SignPostIntegration
|
||||
import StdoutExporter
|
||||
import ZipkinExporter
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Initialize the tracer using the code block below in the `main.swift` file :
|
||||
|
||||
```swift
|
||||
var resources = DefaultResources().get()
|
||||
|
||||
let instrumentationScopeName = "{{MYAPP}}"
|
||||
let instrumentationScopeVersion = "semver:0.1.0"
|
||||
|
||||
let otlpConfiguration: OtlpConfiguration = OtlpConfiguration(timeout: TimeInterval(10))
|
||||
|
||||
let grpcChannel = ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads:1)).connect(host: <OTEL_EXPORTER_OTLP_ENDPOINT>, port: 4317)
|
||||
|
||||
let otlpTraceExporter = OtlpTraceExporter(channel: grpcChannel,
|
||||
config: otlpConfiguration)
|
||||
let stdoutExporter = StdoutExporter()
|
||||
|
||||
let spanExporter = MultiSpanExporter(spanExporters: [otlpTraceExporter, stdoutExporter])
|
||||
|
||||
let spanProcessor = SimpleSpanProcessor(spanExporter: spanExporter)
|
||||
OpenTelemetry.registerTracerProvider(tracerProvider:
|
||||
TracerProviderBuilder()
|
||||
.add(spanProcessor: spanProcessor)
|
||||
.build()
|
||||
)
|
||||
```
|
||||
- <OTEL_EXPORTER_OTLP_ENDPOINT> - The default value for this is `http://localhost:4317`
|
||||
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
```swift
|
||||
func doWork() {
|
||||
let childSpan = tracer.spanBuilder(spanName: "doWork").setSpanKind(spanKind: .client).startSpan()
|
||||
childSpan.setAttribute(key: sampleKey, value: sampleValue)
|
||||
Thread.sleep(forTimeInterval: Double.random(in: 0 ..< 10) / 100)
|
||||
childSpan.end()
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
If you call this `doWork` function, it will add a trace with span name "doWork" and attributes with key-value pair.
|
@ -0,0 +1,7 @@
|
||||
### Running your Swift application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
swift run
|
||||
```
|
@ -0,0 +1,65 @@
|
||||
|
||||
|
||||
### Step 1: Add dependencies
|
||||
|
||||
To configure your Swift application to send data you need to initialize OpenTelemetry. Add these dependency in `Package.swift` file of your project or if you are using XCode then you need to add this [dependency](https://github.com/open-telemetry/opentelemetry-swift) and then import these below dependencies in the main file.
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import GRPC
|
||||
import NIO
|
||||
import NIOSSL
|
||||
import OpenTelemetryApi
|
||||
import OpenTelemetryProtocolExporterCommon
|
||||
import OpenTelemetryProtocolExporterGrpc
|
||||
import OpenTelemetrySdk
|
||||
import ResourceExtension
|
||||
import SignPostIntegration
|
||||
import StdoutExporter
|
||||
import ZipkinExporter
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Initialize the tracer using the code block below in the `main.swift` file inside the main function or you can create another function for initializing the tracer and call it in some other block of code.
|
||||
|
||||
```swift
|
||||
var resources = DefaultResources().get()
|
||||
|
||||
let instrumentationScopeName = "{{MYAPP}}"
|
||||
let instrumentationScopeVersion = "semver:0.1.0"
|
||||
|
||||
let otlpConfiguration: OtlpConfiguration = OtlpConfiguration(timeout: TimeInterval(10), headers: [("signoz-access-token", {{SIGNOZ_INGESTION_KEY}})])
|
||||
|
||||
let grpcChannel = ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads:1)).connect(host: "https://ingest.{{REGION}}.signoz.cloud:443", port: 443)
|
||||
|
||||
let otlpTraceExporter = OtlpTraceExporter(channel: grpcChannel,
|
||||
config: otlpConfiguration)
|
||||
let stdoutExporter = StdoutExporter()
|
||||
|
||||
let spanExporter = MultiSpanExporter(spanExporters: [otlpTraceExporter, stdoutExporter])
|
||||
|
||||
let spanProcessor = SimpleSpanProcessor(spanExporter: spanExporter)
|
||||
OpenTelemetry.registerTracerProvider(tracerProvider:
|
||||
TracerProviderBuilder()
|
||||
.add(spanProcessor: spanProcessor)
|
||||
.build()
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
```swift
|
||||
func doWork() {
|
||||
let childSpan = tracer.spanBuilder(spanName: "doWork").setSpanKind(spanKind: .client).startSpan()
|
||||
childSpan.setAttribute(key: sampleKey, value: sampleValue)
|
||||
Thread.sleep(forTimeInterval: Double.random(in: 0 ..< 10) / 100)
|
||||
childSpan.end()
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
If you call this `doWork` function, it will add a trace with span name "doWork" and attributes with key-value pair. You can modify this function according to your needs.
|
@ -0,0 +1,7 @@
|
||||
### Running your Swift application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
swift run
|
||||
```
|
@ -0,0 +1,96 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_linux_amd64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_linux_amd64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,70 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Swift Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
|
||||
To configure your Swift application to send data you need to initialize OpenTelemetry. Add these dependency in `Package.swift` file of your project or if you are using XCode then you need to add this [dependency](https://github.com/open-telemetry/opentelemetry-swift) and then import these below dependencies in the main file.
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import GRPC
|
||||
import NIO
|
||||
import NIOSSL
|
||||
import OpenTelemetryApi
|
||||
import OpenTelemetryProtocolExporterCommon
|
||||
import OpenTelemetryProtocolExporterGrpc
|
||||
import OpenTelemetrySdk
|
||||
import ResourceExtension
|
||||
import SignPostIntegration
|
||||
import StdoutExporter
|
||||
import ZipkinExporter
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Initialize the tracer using the code block below in the `main.swift` file inside the main function or you can create another function for initializing the tracer and call it in some other block of code.
|
||||
|
||||
```swift
|
||||
var resources = DefaultResources().get()
|
||||
|
||||
let instrumentationScopeName = "{{MYAPP}}"
|
||||
let instrumentationScopeVersion = "semver:0.1.0"
|
||||
|
||||
let otlpConfiguration: OtlpConfiguration = OtlpConfiguration(timeout: TimeInterval(10))
|
||||
|
||||
let grpcChannel = ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads:1)).connect(host: <OtelCollector_URL>, port: 4317)
|
||||
|
||||
let otlpTraceExporter = OtlpTraceExporter(channel: grpcChannel,
|
||||
config: otlpConfiguration)
|
||||
let stdoutExporter = StdoutExporter()
|
||||
|
||||
let spanExporter = MultiSpanExporter(spanExporters: [otlpTraceExporter, stdoutExporter])
|
||||
|
||||
let spanProcessor = SimpleSpanProcessor(spanExporter: spanExporter)
|
||||
OpenTelemetry.registerTracerProvider(tracerProvider:
|
||||
TracerProviderBuilder()
|
||||
.add(spanProcessor: spanProcessor)
|
||||
.build()
|
||||
)
|
||||
```
|
||||
- <OtelCollector_URL> - The endpoint where Otel Collector is running. For ex -> "localhost"
|
||||
|
||||
|
||||
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
```swift
|
||||
func doWork() {
|
||||
let childSpan = tracer.spanBuilder(spanName: "doWork").setSpanKind(spanKind: .client).startSpan()
|
||||
childSpan.setAttribute(key: sampleKey, value: sampleValue)
|
||||
Thread.sleep(forTimeInterval: Double.random(in: 0 ..< 10) / 100)
|
||||
childSpan.end()
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
If you call this `doWork` function, it will add a trace with span name "doWork" and attributes with key-value pair. You can modify this function according to your needs.
|
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
Once you are done instrumenting your Swift application, you can run it using the below commands
|
||||
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Swift application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
swift run
|
||||
```
|
@ -0,0 +1,64 @@
|
||||
|
||||
|
||||
### Step 1: Add dependencies
|
||||
|
||||
To configure your Swift application to send data you need to initialize OpenTelemetry. Add these dependency in `Package.swift` file of your project or if you are using XCode then you need to add this [dependency](https://github.com/open-telemetry/opentelemetry-swift) and then import these below dependencies in the main file.
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import GRPC
|
||||
import NIO
|
||||
import NIOSSL
|
||||
import OpenTelemetryApi
|
||||
import OpenTelemetryProtocolExporterCommon
|
||||
import OpenTelemetryProtocolExporterGrpc
|
||||
import OpenTelemetrySdk
|
||||
import ResourceExtension
|
||||
import SignPostIntegration
|
||||
import StdoutExporter
|
||||
import ZipkinExporter
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Initialize the tracer using the code block below in the `main.swift` file inside the main function or you can create another function for initializing the tracer and call it in some other block of code.
|
||||
|
||||
```swift
|
||||
var resources = DefaultResources().get()
|
||||
|
||||
let instrumentationScopeName = "{{MYAPP}}"
|
||||
let instrumentationScopeVersion = "semver:0.1.0"
|
||||
|
||||
let otlpConfiguration: OtlpConfiguration = OtlpConfiguration(timeout: TimeInterval(10), headers: [("signoz-access-token", {{SIGNOZ_INGESTION_KEY}})])
|
||||
|
||||
let grpcChannel = ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads:1)).connect(host: "https://ingest.{{REGION}}.signoz.cloud:443", port: 443)
|
||||
|
||||
let otlpTraceExporter = OtlpTraceExporter(channel: grpcChannel,
|
||||
config: otlpConfiguration)
|
||||
let stdoutExporter = StdoutExporter()
|
||||
|
||||
let spanExporter = MultiSpanExporter(spanExporters: [otlpTraceExporter, stdoutExporter])
|
||||
|
||||
let spanProcessor = SimpleSpanProcessor(spanExporter: spanExporter)
|
||||
OpenTelemetry.registerTracerProvider(tracerProvider:
|
||||
TracerProviderBuilder()
|
||||
.add(spanProcessor: spanProcessor)
|
||||
.build()
|
||||
)
|
||||
```
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
```swift
|
||||
func doWork() {
|
||||
let childSpan = tracer.spanBuilder(spanName: "doWork").setSpanKind(spanKind: .client).startSpan()
|
||||
childSpan.setAttribute(key: sampleKey, value: sampleValue)
|
||||
Thread.sleep(forTimeInterval: Double.random(in: 0 ..< 10) / 100)
|
||||
childSpan.end()
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
If you call this `doWork` function, it will add a trace with span name "doWork" and attributes with key-value pair. You can modify this function according to your needs. To read more about spans, you can follow [this link](https://opentelemetry.io/docs/concepts/signals/traces/#spans)
|
@ -0,0 +1,7 @@
|
||||
### Running your Swift application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
swift run
|
||||
```
|
@ -0,0 +1,96 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_linux_arm64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_linux_arm64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,68 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Swift Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
|
||||
To configure your Swift application to send data you need to initialize OpenTelemetry. Add these dependency in `Package.swift` file of your project or if you are using XCode then you need to add this [dependency](https://github.com/open-telemetry/opentelemetry-swift) and then import these below dependencies in the main file.
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import GRPC
|
||||
import NIO
|
||||
import NIOSSL
|
||||
import OpenTelemetryApi
|
||||
import OpenTelemetryProtocolExporterCommon
|
||||
import OpenTelemetryProtocolExporterGrpc
|
||||
import OpenTelemetrySdk
|
||||
import ResourceExtension
|
||||
import SignPostIntegration
|
||||
import StdoutExporter
|
||||
import ZipkinExporter
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Initialize the tracer using the code block below in the `main.swift` file inside the main function or you can create another function for initializing the tracer and call it in some other block of code.
|
||||
|
||||
```swift
|
||||
var resources = DefaultResources().get()
|
||||
|
||||
let instrumentationScopeName = "{{MYAPP}}"
|
||||
let instrumentationScopeVersion = "semver:0.1.0"
|
||||
|
||||
let otlpConfiguration: OtlpConfiguration = OtlpConfiguration(timeout: TimeInterval(10))
|
||||
|
||||
let grpcChannel = ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads:1)).connect(host: <OtelCollector_URL>, port: 4317)
|
||||
|
||||
let otlpTraceExporter = OtlpTraceExporter(channel: grpcChannel,
|
||||
config: otlpConfiguration)
|
||||
let stdoutExporter = StdoutExporter()
|
||||
|
||||
let spanExporter = MultiSpanExporter(spanExporters: [otlpTraceExporter, stdoutExporter])
|
||||
|
||||
let spanProcessor = SimpleSpanProcessor(spanExporter: spanExporter)
|
||||
OpenTelemetry.registerTracerProvider(tracerProvider:
|
||||
TracerProviderBuilder()
|
||||
.add(spanProcessor: spanProcessor)
|
||||
.build()
|
||||
)
|
||||
```
|
||||
- <OtelCollector_URL> - The endpoint where Otel Collector is running. For ex -> "localhost"
|
||||
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
```swift
|
||||
func doWork() {
|
||||
let childSpan = tracer.spanBuilder(spanName: "doWork").setSpanKind(spanKind: .client).startSpan()
|
||||
childSpan.setAttribute(key: sampleKey, value: sampleValue)
|
||||
Thread.sleep(forTimeInterval: Double.random(in: 0 ..< 10) / 100)
|
||||
childSpan.end()
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
If you call this `doWork` function, it will add a trace with span name "doWork" and attributes with key-value pair. You can modify this function according to your needs.
|
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
Once you are done instrumenting your Swift application, you can run it using the below commands
|
||||
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Swift application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
swift run
|
||||
```
|
@ -0,0 +1,64 @@
|
||||
|
||||
|
||||
### Step 1: Add dependencies
|
||||
|
||||
To configure your Swift application to send data you need to initialize OpenTelemetry. Add these dependency in `Package.swift` file of your project or if you are using XCode then you need to add this [dependency](https://github.com/open-telemetry/opentelemetry-swift) and then import these below dependencies in the main file.
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import GRPC
|
||||
import NIO
|
||||
import NIOSSL
|
||||
import OpenTelemetryApi
|
||||
import OpenTelemetryProtocolExporterCommon
|
||||
import OpenTelemetryProtocolExporterGrpc
|
||||
import OpenTelemetrySdk
|
||||
import ResourceExtension
|
||||
import SignPostIntegration
|
||||
import StdoutExporter
|
||||
import ZipkinExporter
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Initialize the tracer using the code block below in the `main.swift` file inside the main function or you can create another function for initializing the tracer and call it in some other block of code.
|
||||
|
||||
```swift
|
||||
var resources = DefaultResources().get()
|
||||
|
||||
let instrumentationScopeName = "{{MYAPP}}"
|
||||
let instrumentationScopeVersion = "semver:0.1.0"
|
||||
|
||||
let otlpConfiguration: OtlpConfiguration = OtlpConfiguration(timeout: TimeInterval(10), headers: [("signoz-access-token", {{SIGNOZ_INGESTION_KEY}})])
|
||||
|
||||
let grpcChannel = ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads:1)).connect(host: "https://ingest.{{REGION}}.signoz.cloud:443", port: 443)
|
||||
|
||||
let otlpTraceExporter = OtlpTraceExporter(channel: grpcChannel,
|
||||
config: otlpConfiguration)
|
||||
let stdoutExporter = StdoutExporter()
|
||||
|
||||
let spanExporter = MultiSpanExporter(spanExporters: [otlpTraceExporter, stdoutExporter])
|
||||
|
||||
let spanProcessor = SimpleSpanProcessor(spanExporter: spanExporter)
|
||||
OpenTelemetry.registerTracerProvider(tracerProvider:
|
||||
TracerProviderBuilder()
|
||||
.add(spanProcessor: spanProcessor)
|
||||
.build()
|
||||
)
|
||||
```
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
```swift
|
||||
func doWork() {
|
||||
let childSpan = tracer.spanBuilder(spanName: "doWork").setSpanKind(spanKind: .client).startSpan()
|
||||
childSpan.setAttribute(key: sampleKey, value: sampleValue)
|
||||
Thread.sleep(forTimeInterval: Double.random(in: 0 ..< 10) / 100)
|
||||
childSpan.end()
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
If you call this `doWork` function, it will add a trace with span name "doWork" and attributes with key-value pair. You can modify this function according to your needs.
|
@ -0,0 +1,7 @@
|
||||
### Running your Swift application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
swift run
|
||||
```
|
@ -0,0 +1,96 @@
|
||||
### Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_darwin_amd64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_darwin_amd64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,69 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Swift Application
|
||||
|
||||
### Step 1: Add dependencies
|
||||
|
||||
To configure your Swift application to send data you need to initialize OpenTelemetry. Add these dependency in `Package.swift` file of your project or if you are using XCode then you need to add this [dependency](https://github.com/open-telemetry/opentelemetry-swift) and then import these below dependencies in the main file.
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import GRPC
|
||||
import NIO
|
||||
import NIOSSL
|
||||
import OpenTelemetryApi
|
||||
import OpenTelemetryProtocolExporterCommon
|
||||
import OpenTelemetryProtocolExporterGrpc
|
||||
import OpenTelemetrySdk
|
||||
import ResourceExtension
|
||||
import SignPostIntegration
|
||||
import StdoutExporter
|
||||
import ZipkinExporter
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Initialize the tracer using the code block below in the `main.swift` file inside the main function or you can create another function for initializing the tracer and call it in some other block of code.
|
||||
|
||||
```swift
|
||||
var resources = DefaultResources().get()
|
||||
|
||||
let instrumentationScopeName = "{{MYAPP}}"
|
||||
let instrumentationScopeVersion = "semver:0.1.0"
|
||||
|
||||
let otlpConfiguration: OtlpConfiguration = OtlpConfiguration(timeout: TimeInterval(10))
|
||||
|
||||
let grpcChannel = ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads:1)).connect(host: <OtelCollector_URL>, port: 4317)
|
||||
|
||||
let otlpTraceExporter = OtlpTraceExporter(channel: grpcChannel,
|
||||
config: otlpConfiguration)
|
||||
let stdoutExporter = StdoutExporter()
|
||||
|
||||
let spanExporter = MultiSpanExporter(spanExporters: [otlpTraceExporter, stdoutExporter])
|
||||
|
||||
let spanProcessor = SimpleSpanProcessor(spanExporter: spanExporter)
|
||||
OpenTelemetry.registerTracerProvider(tracerProvider:
|
||||
TracerProviderBuilder()
|
||||
.add(spanProcessor: spanProcessor)
|
||||
.build()
|
||||
)
|
||||
```
|
||||
- <OtelCollector_URL> - The endpoint where Otel Collector is running. For ex -> "localhost"
|
||||
|
||||
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
```swift
|
||||
func doWork() {
|
||||
let childSpan = tracer.spanBuilder(spanName: "doWork").setSpanKind(spanKind: .client).startSpan()
|
||||
childSpan.setAttribute(key: sampleKey, value: sampleValue)
|
||||
Thread.sleep(forTimeInterval: Double.random(in: 0 ..< 10) / 100)
|
||||
childSpan.end()
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
If you call this `doWork` function, it will add a trace with span name "doWork" and attributes with key-value pair. You can modify this function according to your needs.
|
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
Once you are done instrumenting your Swift application, you can run it using the below commands
|
||||
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Swift application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
swift run
|
||||
```
|
@ -0,0 +1,64 @@
|
||||
|
||||
|
||||
### Step 1: Add dependencies
|
||||
|
||||
To configure your Swift application to send data you need to initialize OpenTelemetry. Add these dependency in `Package.swift` file of your project or if you are using XCode then you need to add this [dependency](https://github.com/open-telemetry/opentelemetry-swift) and then import these below dependencies in the main file.
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import GRPC
|
||||
import NIO
|
||||
import NIOSSL
|
||||
import OpenTelemetryApi
|
||||
import OpenTelemetryProtocolExporterCommon
|
||||
import OpenTelemetryProtocolExporterGrpc
|
||||
import OpenTelemetrySdk
|
||||
import ResourceExtension
|
||||
import SignPostIntegration
|
||||
import StdoutExporter
|
||||
import ZipkinExporter
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Initialize the tracer using the code block below in the `main.swift` file inside the main function or you can create another function for initializing the tracer and call it in some other block of code.
|
||||
|
||||
```swift
|
||||
var resources = DefaultResources().get()
|
||||
|
||||
let instrumentationScopeName = "{{MYAPP}}"
|
||||
let instrumentationScopeVersion = "semver:0.1.0"
|
||||
|
||||
let otlpConfiguration: OtlpConfiguration = OtlpConfiguration(timeout: TimeInterval(10), headers: [("signoz-access-token", {{SIGNOZ_INGESTION_KEY}})])
|
||||
|
||||
let grpcChannel = ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads:1)).connect(host: "https://ingest.{{REGION}}.signoz.cloud:443", port: 443)
|
||||
|
||||
let otlpTraceExporter = OtlpTraceExporter(channel: grpcChannel,
|
||||
config: otlpConfiguration)
|
||||
let stdoutExporter = StdoutExporter()
|
||||
|
||||
let spanExporter = MultiSpanExporter(spanExporters: [otlpTraceExporter, stdoutExporter])
|
||||
|
||||
let spanProcessor = SimpleSpanProcessor(spanExporter: spanExporter)
|
||||
OpenTelemetry.registerTracerProvider(tracerProvider:
|
||||
TracerProviderBuilder()
|
||||
.add(spanProcessor: spanProcessor)
|
||||
.build()
|
||||
)
|
||||
```
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
```swift
|
||||
func doWork() {
|
||||
let childSpan = tracer.spanBuilder(spanName: "doWork").setSpanKind(spanKind: .client).startSpan()
|
||||
childSpan.setAttribute(key: sampleKey, value: sampleValue)
|
||||
Thread.sleep(forTimeInterval: Double.random(in: 0 ..< 10) / 100)
|
||||
childSpan.end()
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
If you call this `doWork` function, it will add a trace with span name "doWork" and attributes with key-value pair. You can modify this function according to your needs.
|
@ -0,0 +1,7 @@
|
||||
### Running your Swift application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
swift run
|
||||
```
|
@ -0,0 +1,96 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
### Step 1: Download otel-collector tar.gz
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_darwin_arm64.tar.gz
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
|
||||
```bash
|
||||
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_darwin_arm64.tar.gz -C otelcol-contrib
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
|
||||
```bash
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
hostmetrics:
|
||||
collection_interval: 60s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
mute_process_exe_error: true
|
||||
mute_process_io_error: true
|
||||
processes: {}
|
||||
prometheus:
|
||||
config:
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
scrape_configs:
|
||||
- job_name: otel-collector-binary
|
||||
static_configs:
|
||||
- targets:
|
||||
# - localhost:8888
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
extensions:
|
||||
health_check: {}
|
||||
zpages: {}
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
|
||||
logging:
|
||||
verbosity: normal
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
extensions: [health_check, zpages]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/internal:
|
||||
receivers: [prometheus, hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
|
@ -0,0 +1,66 @@
|
||||
|
||||
|
||||
### Step 1: Add dependencies
|
||||
|
||||
To configure your Swift application to send data you need to initialize OpenTelemetry. Add these dependency in `Package.swift` file of your project or if you are using XCode then you need to add this [dependency](https://github.com/open-telemetry/opentelemetry-swift) and then import these below dependencies in the main file.
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import GRPC
|
||||
import NIO
|
||||
import NIOSSL
|
||||
import OpenTelemetryApi
|
||||
import OpenTelemetryProtocolExporterCommon
|
||||
import OpenTelemetryProtocolExporterGrpc
|
||||
import OpenTelemetrySdk
|
||||
import ResourceExtension
|
||||
import SignPostIntegration
|
||||
import StdoutExporter
|
||||
import ZipkinExporter
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Initialize tracer
|
||||
Initialize the tracer using the code block below in the `main.swift` file inside the main function or you can create another function for initializing the tracer and call it in some other block of code.
|
||||
|
||||
```swift
|
||||
var resources = DefaultResources().get()
|
||||
|
||||
let instrumentationScopeName = "{{MYAPP}}"
|
||||
let instrumentationScopeVersion = "semver:0.1.0"
|
||||
|
||||
let otlpConfiguration: OtlpConfiguration = OtlpConfiguration(timeout: TimeInterval(10))
|
||||
|
||||
let grpcChannel = ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads:1)).connect(host: <OtelCollector_URL>, port: 4317)
|
||||
|
||||
let otlpTraceExporter = OtlpTraceExporter(channel: grpcChannel,
|
||||
config: otlpConfiguration)
|
||||
let stdoutExporter = StdoutExporter()
|
||||
|
||||
let spanExporter = MultiSpanExporter(spanExporters: [otlpTraceExporter, stdoutExporter])
|
||||
|
||||
let spanProcessor = SimpleSpanProcessor(spanExporter: spanExporter)
|
||||
OpenTelemetry.registerTracerProvider(tracerProvider:
|
||||
TracerProviderBuilder()
|
||||
.add(spanProcessor: spanProcessor)
|
||||
.build()
|
||||
)
|
||||
```
|
||||
- <OtelCollector_URL> - The endpoint where Otel Collector is running. For ex -> "localhost"
|
||||
|
||||
|
||||
### Step 3: Add OpenTelemetry instrumentation
|
||||
|
||||
```swift
|
||||
func doWork() {
|
||||
let childSpan = tracer.spanBuilder(spanName: "doWork").setSpanKind(spanKind: .client).startSpan()
|
||||
childSpan.setAttribute(key: sampleKey, value: sampleValue)
|
||||
Thread.sleep(forTimeInterval: Double.random(in: 0 ..< 10) / 100)
|
||||
childSpan.end()
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
If you call this `doWork` function, it will add a trace with span name "doWork" and attributes with key-value pair. You can modify this function according to your needs.
|
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
Once you are done instrumenting your Swift application, you can run it using the below commands
|
||||
|
||||
|
||||
|
||||
### Step 1: Run OTel Collector
|
||||
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
|
||||
|
||||
```bash
|
||||
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
|
||||
```
|
||||
|
||||
|
||||
#### (Optional Step): View last 50 lines of `otelcol` logs
|
||||
```bash
|
||||
tail -f -n 50 otelcol-output.log
|
||||
```
|
||||
|
||||
#### (Optional Step): Stop `otelcol`
|
||||
```bash
|
||||
kill "$(< otel-pid)"
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Running your Swift application
|
||||
|
||||
Run the application using the below command:
|
||||
|
||||
```bash
|
||||
swift run
|
||||
```
|
@ -115,6 +115,36 @@ export default function ConnectionStatus(): JSX.Element {
|
||||
imgClassName="supported-language-img"
|
||||
/>
|
||||
);
|
||||
case 'rust':
|
||||
return (
|
||||
<Header
|
||||
entity="rust"
|
||||
heading="Rust OpenTelemetry Instrumentation"
|
||||
imgURL="/Logos/rust.png"
|
||||
docsURL="https://signoz.io/docs/instrumentation/rust/"
|
||||
imgClassName="supported-language-img"
|
||||
/>
|
||||
);
|
||||
case 'elixir':
|
||||
return (
|
||||
<Header
|
||||
entity="rust"
|
||||
heading="Elixir OpenTelemetry Instrumentation"
|
||||
imgURL="/Logos/elixir.png"
|
||||
docsURL="https://signoz.io/docs/instrumentation/elixir/"
|
||||
imgClassName="supported-language-img"
|
||||
/>
|
||||
);
|
||||
case 'swift':
|
||||
return (
|
||||
<Header
|
||||
entity="swift"
|
||||
heading="Swift OpenTelemetry Instrumentation"
|
||||
imgURL="/Logos/swift.png"
|
||||
docsURL="https://signoz.io/docs/instrumentation/swift/"
|
||||
imgClassName="supported-language-img"
|
||||
/>
|
||||
);
|
||||
|
||||
default:
|
||||
return <> </>;
|
||||
|
@ -41,6 +41,38 @@ import APM_dotnet_macOsARM64_quickStart_runApplication from '../Modules/APM/Dotn
|
||||
import APM_dotnet_macOsARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Dotnet/md-docs/MacOsARM64/Recommended/dotnet-macosarm64-recommended-installOtelCollector.md';
|
||||
import APM_dotnet_macOsARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Dotnet/md-docs/MacOsARM64/Recommended/dotnet-macosarm64-recommended-instrumentApplication.md';
|
||||
import APM_dotnet_macOsARM64_recommendedSteps_runApplication from '../Modules/APM/Dotnet/md-docs/MacOsARM64/Recommended/dotnet-macosarm64-recommended-runApplication.md';
|
||||
// Elixir-Kubernetes
|
||||
import APM_elixir_kubernetes_recommendedSteps_setupOtelCollector from '../Modules/APM/Elixir/md-docs/Kubernetes/elixir-kubernetes-installOtelCollector.md';
|
||||
import APM_elixir_kubernetes_recommendedSteps_instrumentApplication from '../Modules/APM/Elixir/md-docs/Kubernetes/elixir-kubernetes-instrumentApplication.md';
|
||||
import APM_elixir_kubernetes_recommendedSteps_runApplication from '../Modules/APM/Elixir/md-docs/Kubernetes/elixir-kubernetes-runApplication.md';
|
||||
// Elixir-LinuxAMD64-quickstart
|
||||
import APM_elixir_linuxAMD64_quickStart_instrumentApplication from '../Modules/APM/Elixir/md-docs/LinuxAMD64/QuickStart/elixir-linuxamd64-quickStart-instrumentApplication.md';
|
||||
import APM_elixir_linuxAMD64_quickStart_runApplication from '../Modules/APM/Elixir/md-docs/LinuxAMD64/QuickStart/elixir-linuxamd64-quickStart-runApplication.md';
|
||||
// Elixir-LinuxAMD64-recommended
|
||||
import APM_elixir_linuxAMD64_recommendedSteps_setupOtelCollector from '../Modules/APM/Elixir/md-docs/LinuxAMD64/Recommended/elixir-linuxamd64-recommended-installOtelCollector.md';
|
||||
import APM_elixir_linuxAMD64_recommendedSteps_instrumentApplication from '../Modules/APM/Elixir/md-docs/LinuxAMD64/Recommended/elixir-linuxamd64-recommended-instrumentApplication.md';
|
||||
import APM_elixir_linuxAMD64_recommendedSteps_runApplication from '../Modules/APM/Elixir/md-docs/LinuxAMD64/Recommended/elixir-linuxamd64-recommended-runApplication.md';
|
||||
// Elixir-LinuxARM64-quickstart
|
||||
import APM_elixir_linuxARM64_quickStart_instrumentApplication from '../Modules/APM/Elixir/md-docs/LinuxARM64/QuickStart/elixir-linuxarm64-quickStart-instrumentApplication.md';
|
||||
import APM_elixir_linuxARM64_quickStart_runApplication from '../Modules/APM/Elixir/md-docs/LinuxARM64/QuickStart/elixir-linuxarm64-quickStart-runApplication.md';
|
||||
// Elixir-LinuxARM64-recommended
|
||||
import APM_elixir_linuxARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Elixir/md-docs/LinuxARM64/Recommended/elixir-linuxarm64-recommended-installOtelCollector.md';
|
||||
import APM_elixir_linuxARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Elixir/md-docs/LinuxARM64/Recommended/elixir-linuxarm64-recommended-instrumentApplication.md';
|
||||
import APM_elixir_linuxARM64_recommendedSteps_runApplication from '../Modules/APM/Elixir/md-docs/LinuxARM64/Recommended/elixir-linuxarm64-recommended-runApplication.md';
|
||||
// Elixir-MacOsAMD64-quickstart
|
||||
import APM_elixir_macOsAMD64_quickStart_instrumentApplication from '../Modules/APM/Elixir/md-docs/MacOsAMD64/QuickStart/elixir-macosamd64-quickStart-instrumentApplication.md';
|
||||
import APM_elixir_macOsAMD64_quickStart_runApplication from '../Modules/APM/Elixir/md-docs/MacOsAMD64/QuickStart/elixir-macosamd64-quickStart-runApplication.md';
|
||||
// Elixir-MacOsAMD64-recommended
|
||||
import APM_elixir_macOsAMD64_recommendedSteps_setupOtelCollector from '../Modules/APM/Elixir/md-docs/MacOsAMD64/Recommended/elixir-macosamd64-recommended-installOtelCollector.md';
|
||||
import APM_elixir_macOsAMD64_recommendedSteps_instrumentApplication from '../Modules/APM/Elixir/md-docs/MacOsAMD64/Recommended/elixir-macosamd64-recommended-instrumentApplication.md';
|
||||
import APM_elixir_macOsAMD64_recommendedSteps_runApplication from '../Modules/APM/Elixir/md-docs/MacOsAMD64/Recommended/elixir-macosamd64-recommended-runApplication.md';
|
||||
// Elixir-MacOsARM64-quickstart
|
||||
import APM_elixir_macOsARM64_quickStart_instrumentApplication from '../Modules/APM/Elixir/md-docs/MacOsARM64/QuickStart/elixir-macosarm64-quickStart-instrumentApplication.md';
|
||||
import APM_elixir_macOsARM64_quickStart_runApplication from '../Modules/APM/Elixir/md-docs/MacOsARM64/QuickStart/elixir-macosarm64-quickStart-runApplication.md';
|
||||
// Elixir-MacOsARM64-recommended
|
||||
import APM_elixir_macOsARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Elixir/md-docs/MacOsARM64/Recommended/elixir-macosarm64-recommended-installOtelCollector.md';
|
||||
import APM_elixir_macOsARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Elixir/md-docs/MacOsARM64/Recommended/elixir-macosarm64-recommended-instrumentApplication.md';
|
||||
import APM_elixir_macOsARM64_recommendedSteps_runApplication from '../Modules/APM/Elixir/md-docs/MacOsARM64/Recommended/elixir-macosarm64-recommended-runApplication.md';
|
||||
import APM_go_kubernetes_recommendedSteps_setupOtelCollector from '../Modules/APM/GoLang/md-docs/Kubernetes/golang-kubernetes-installOtelCollector.md';
|
||||
import APM_go_kubernetes_recommendedSteps_instrumentApplication from '../Modules/APM/GoLang/md-docs/Kubernetes/golang-kubernetes-instrumentApplication.md';
|
||||
import APM_go_kubernetes_recommendedSteps_runApplication from '../Modules/APM/GoLang/md-docs/Kubernetes/golang-kubernetes-runApplication.md';
|
||||
@ -577,9 +609,73 @@ import APM_rails_macOsARM64_quickStart_runApplication from '../Modules/APM/RubyO
|
||||
import APM_rails_macOsARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/RubyOnRails/md-docs/MacOsARM64/Recommended/ror-macosarm64-recommended-installOtelCollector.md';
|
||||
import APM_rails_macOsARM64_recommendedSteps_instrumentApplication from '../Modules/APM/RubyOnRails/md-docs/MacOsARM64/Recommended/ror-macosarm64-recommended-instrumentApplication.md';
|
||||
import APM_rails_macOsARM64_recommendedSteps_runApplication from '../Modules/APM/RubyOnRails/md-docs/MacOsARM64/Recommended/ror-macosarm64-recommended-runApplication.md';
|
||||
// Rust-Kubernetes
|
||||
import APM_rust_kubernetes_recommendedSteps_setupOtelCollector from '../Modules/APM/Rust/md-docs/Kubernetes/rust-kubernetes-installOtelCollector.md';
|
||||
import APM_rust_kubernetes_recommendedSteps_instrumentApplication from '../Modules/APM/Rust/md-docs/Kubernetes/rust-kubernetes-instrumentApplication.md';
|
||||
import APM_rust_kubernetes_recommendedSteps_runApplication from '../Modules/APM/Rust/md-docs/Kubernetes/rust-kubernetes-runApplication.md';
|
||||
// Rust-LinuxAMD64-quickstart
|
||||
import APM_rust_linuxAMD64_quickStart_instrumentApplication from '../Modules/APM/Rust/md-docs/LinuxAMD64/QuickStart/rust-linuxamd64-quickStart-instrumentApplication.md';
|
||||
import APM_rust_linuxAMD64_quickStart_runApplication from '../Modules/APM/Rust/md-docs/LinuxAMD64/QuickStart/rust-linuxamd64-quickStart-runApplication.md';
|
||||
// Rust-LinuxAMD64-recommended
|
||||
import APM_rust_linuxAMD64_recommendedSteps_setupOtelCollector from '../Modules/APM/Rust/md-docs/LinuxAMD64/Recommended/rust-linuxamd64-recommended-installOtelCollector.md';
|
||||
import APM_rust_linuxAMD64_recommendedSteps_instrumentApplication from '../Modules/APM/Rust/md-docs/LinuxAMD64/Recommended/rust-linuxamd64-recommended-instrumentApplication.md';
|
||||
import APM_rust_linuxAMD64_recommendedSteps_runApplication from '../Modules/APM/Rust/md-docs/LinuxAMD64/Recommended/rust-linuxamd64-recommended-runApplication.md';
|
||||
// Rust-LinuxARM64-quickstart
|
||||
import APM_rust_linuxARM64_quickStart_instrumentApplication from '../Modules/APM/Rust/md-docs/LinuxARM64/QuickStart/rust-linuxarm64-quickStart-instrumentApplication.md';
|
||||
import APM_rust_linuxARM64_quickStart_runApplication from '../Modules/APM/Rust/md-docs/LinuxARM64/QuickStart/rust-linuxarm64-quickStart-runApplication.md';
|
||||
// Rust-LinuxARM64-recommended
|
||||
import APM_rust_linuxARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Rust/md-docs/LinuxARM64/Recommended/rust-linuxarm64-recommended-installOtelCollector.md';
|
||||
import APM_rust_linuxARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Rust/md-docs/LinuxARM64/Recommended/rust-linuxarm64-recommended-instrumentApplication.md';
|
||||
import APM_rust_linuxARM64_recommendedSteps_runApplication from '../Modules/APM/Rust/md-docs/LinuxARM64/Recommended/rust-linuxarm64-recommended-runApplication.md';
|
||||
// Rust-MacOsAMD64-quickstart
|
||||
import APM_rust_macOsAMD64_quickStart_instrumentApplication from '../Modules/APM/Rust/md-docs/MacOsAMD64/QuickStart/rust-macosamd64-quickStart-instrumentApplication.md';
|
||||
import APM_rust_macOsAMD64_quickStart_runApplication from '../Modules/APM/Rust/md-docs/MacOsAMD64/QuickStart/rust-macosamd64-quickStart-runApplication.md';
|
||||
// Rust-MacOsAMD64-recommended
|
||||
import APM_rust_macOsAMD64_recommendedSteps_setupOtelCollector from '../Modules/APM/Rust/md-docs/MacOsAMD64/Recommended/rust-macosamd64-recommended-installOtelCollector.md';
|
||||
import APM_rust_macOsAMD64_recommendedSteps_instrumentApplication from '../Modules/APM/Rust/md-docs/MacOsAMD64/Recommended/rust-macosamd64-recommended-instrumentApplication.md';
|
||||
import APM_rust_macOsAMD64_recommendedSteps_runApplication from '../Modules/APM/Rust/md-docs/MacOsAMD64/Recommended/rust-macosamd64-recommended-runApplication.md';
|
||||
// Rust-MacOsARM64-quickstart
|
||||
import APM_rust_macOsARM64_quickStart_instrumentApplication from '../Modules/APM/Rust/md-docs/MacOsARM64/QuickStart/rust-macosarm64-quickStart-instrumentApplication.md';
|
||||
import APM_rust_macOsARM64_quickStart_runApplication from '../Modules/APM/Rust/md-docs/MacOsARM64/QuickStart/rust-macosarm64-quickStart-runApplication.md';
|
||||
// Rust-MacOsARM64-recommended
|
||||
import APM_rust_macOsARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Rust/md-docs/MacOsARM64/Recommended/rust-macosarm64-recommended-installOtelCollector.md';
|
||||
import APM_rust_macOsARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Rust/md-docs/MacOsARM64/Recommended/rust-macosarm64-recommended-instrumentApplication.md';
|
||||
import APM_rust_macOsARM64_recommendedSteps_runApplication from '../Modules/APM/Rust/md-docs/MacOsARM64/Recommended/rust-macosarm64-recommended-runApplication.md';
|
||||
// Swift-Kubernetes
|
||||
import APM_swift_kubernetes_recommendedSteps_setupOtelCollector from '../Modules/APM/Swift/md-docs/Kubernetes/swift-kubernetes-installOtelCollector.md';
|
||||
import APM_swift_kubernetes_recommendedSteps_instrumentApplication from '../Modules/APM/Swift/md-docs/Kubernetes/swift-kubernetes-instrumentApplication.md';
|
||||
import APM_swift_kubernetes_recommendedSteps_runApplication from '../Modules/APM/Swift/md-docs/Kubernetes/swift-kubernetes-runApplication.md';
|
||||
// Swift-LinuxAMD64-quickstart
|
||||
import APM_swift_linuxAMD64_quickStart_instrumentApplication from '../Modules/APM/Swift/md-docs/LinuxAMD64/QuickStart/swift-linuxamd64-quickStart-instrumentApplication.md';
|
||||
import APM_swift_linuxAMD64_quickStart_runApplication from '../Modules/APM/Swift/md-docs/LinuxAMD64/QuickStart/swift-linuxamd64-quickStart-runApplication.md';
|
||||
// Swift-LinuxAMD64-recommended
|
||||
import APM_swift_linuxAMD64_recommendedSteps_setupOtelCollector from '../Modules/APM/Swift/md-docs/LinuxAMD64/Recommended/swift-linuxamd64-recommended-installOtelCollector.md';
|
||||
import APM_swift_linuxAMD64_recommendedSteps_instrumentApplication from '../Modules/APM/Swift/md-docs/LinuxAMD64/Recommended/swift-linuxamd64-recommended-instrumentApplication.md';
|
||||
import APM_swift_linuxAMD64_recommendedSteps_runApplication from '../Modules/APM/Swift/md-docs/LinuxAMD64/Recommended/swift-linuxamd64-recommended-runApplication.md';
|
||||
// Swift-LinuxARM64-quickstart
|
||||
import APM_swift_linuxARM64_quickStart_instrumentApplication from '../Modules/APM/Swift/md-docs/LinuxARM64/QuickStart/swift-linuxarm64-quickStart-instrumentApplication.md';
|
||||
import APM_swift_linuxARM64_quickStart_runApplication from '../Modules/APM/Swift/md-docs/LinuxARM64/QuickStart/swift-linuxarm64-quickStart-runApplication.md';
|
||||
// Swift-LinuxARM64-recommended
|
||||
import APM_swift_linuxARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Swift/md-docs/LinuxARM64/Recommended/swift-linuxarm64-recommended-installOtelCollector.md';
|
||||
import APM_swift_linuxARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Swift/md-docs/LinuxARM64/Recommended/swift-linuxarm64-recommended-instrumentApplication.md';
|
||||
import APM_swift_linuxARM64_recommendedSteps_runApplication from '../Modules/APM/Swift/md-docs/LinuxARM64/Recommended/swift-linuxarm64-recommended-runApplication.md';
|
||||
// Swift-MacOsAMD64-quickstart
|
||||
import APM_swift_macOsAMD64_quickStart_instrumentApplication from '../Modules/APM/Swift/md-docs/MacOsAMD64/QuickStart/swift-macosamd64-quickStart-instrumentApplication.md';
|
||||
import APM_swift_macOsAMD64_quickStart_runApplication from '../Modules/APM/Swift/md-docs/MacOsAMD64/QuickStart/swift-macosamd64-quickStart-runApplication.md';
|
||||
// Swift-MacOsAMD64-recommended
|
||||
import APM_swift_macOsAMD64_recommendedSteps_setupOtelCollector from '../Modules/APM/Swift/md-docs/MacOsAMD64/Recommended/swift-macosamd64-recommended-installOtelCollector.md';
|
||||
import APM_swift_macOsAMD64_recommendedSteps_instrumentApplication from '../Modules/APM/Swift/md-docs/MacOsAMD64/Recommended/swift-macosamd64-recommended-instrumentApplication.md';
|
||||
import APM_swift_macOsAMD64_recommendedSteps_runApplication from '../Modules/APM/Swift/md-docs/MacOsAMD64/Recommended/swift-macosamd64-recommended-runApplication.md';
|
||||
// Swift-MacOsARM64-quickstart
|
||||
import APM_swift_macOsARM64_quickStart_instrumentApplication from '../Modules/APM/Swift/md-docs/MacOsARM64/QuickStart/swift-macosarm64-quickStart-instrumentApplication.md';
|
||||
import APM_swift_macOsARM64_quickStart_runApplication from '../Modules/APM/Swift/md-docs/MacOsARM64/QuickStart/swift-macosarm64-quickStart-runApplication.md';
|
||||
// Swift-MacOsARM64-recommended
|
||||
import APM_swift_macOsARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Swift/md-docs/MacOsARM64/Recommended/swift-macosarm64-recommended-installOtelCollector.md';
|
||||
import APM_swift_macOsARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Swift/md-docs/MacOsARM64/Recommended/swift-macosarm64-recommended-instrumentApplication.md';
|
||||
import APM_swift_macOsARM64_recommendedSteps_runApplication from '../Modules/APM/Swift/md-docs/MacOsARM64/Recommended/swift-macosarm64-recommended-runApplication.md';
|
||||
|
||||
export const ApmDocFilePaths = {
|
||||
// APM
|
||||
// Aust
|
||||
|
||||
/// //// Java Start
|
||||
|
||||
@ -1311,44 +1407,143 @@ export const ApmDocFilePaths = {
|
||||
|
||||
/// //// .NET Start
|
||||
|
||||
// ROR-Kubernetes
|
||||
// dotnet-Kubernetes
|
||||
APM_dotnet_kubernetes_recommendedSteps_setupOtelCollector,
|
||||
APM_dotnet_kubernetes_recommendedSteps_instrumentApplication,
|
||||
APM_dotnet_kubernetes_recommendedSteps_runApplication,
|
||||
|
||||
// ROR-LinuxAMD64-quickstart
|
||||
// dotnet-LinuxAMD64-quickstart
|
||||
APM_dotnet_linuxAMD64_quickStart_instrumentApplication,
|
||||
APM_dotnet_linuxAMD64_quickStart_runApplication,
|
||||
|
||||
// ROR-LinuxAMD64-recommended
|
||||
// dotnet-LinuxAMD64-recommended
|
||||
APM_dotnet_linuxAMD64_recommendedSteps_setupOtelCollector,
|
||||
APM_dotnet_linuxAMD64_recommendedSteps_instrumentApplication,
|
||||
APM_dotnet_linuxAMD64_recommendedSteps_runApplication,
|
||||
|
||||
// ROR-LinuxARM64-quickstart
|
||||
// dotnet-LinuxARM64-quickstart
|
||||
APM_dotnet_linuxARM64_quickStart_instrumentApplication,
|
||||
APM_dotnet_linuxARM64_quickStart_runApplication,
|
||||
|
||||
// ROR-LinuxARM64-recommended
|
||||
// dotnet-LinuxARM64-recommended
|
||||
APM_dotnet_linuxARM64_recommendedSteps_setupOtelCollector,
|
||||
APM_dotnet_linuxARM64_recommendedSteps_instrumentApplication,
|
||||
APM_dotnet_linuxARM64_recommendedSteps_runApplication,
|
||||
|
||||
// ROR-MacOsAMD64-quickstart
|
||||
// dotnet-MacOsAMD64-quickstart
|
||||
APM_dotnet_macOsAMD64_quickStart_instrumentApplication,
|
||||
APM_dotnet_macOsAMD64_quickStart_runApplication,
|
||||
|
||||
// ROR-MacOsAMD64-recommended
|
||||
// dotnet-MacOsAMD64-recommended
|
||||
APM_dotnet_macOsAMD64_recommendedSteps_setupOtelCollector,
|
||||
APM_dotnet_macOsAMD64_recommendedSteps_instrumentApplication,
|
||||
APM_dotnet_macOsAMD64_recommendedSteps_runApplication,
|
||||
|
||||
// ROR-MacOsARM64-quickstart
|
||||
// dotnet-MacOsARM64-quickstart
|
||||
APM_dotnet_macOsARM64_quickStart_instrumentApplication,
|
||||
APM_dotnet_macOsARM64_quickStart_runApplication,
|
||||
|
||||
// ROR-MacOsARM64-recommended
|
||||
// dotnet-MacOsARM64-recommended
|
||||
APM_dotnet_macOsARM64_recommendedSteps_setupOtelCollector,
|
||||
APM_dotnet_macOsARM64_recommendedSteps_instrumentApplication,
|
||||
APM_dotnet_macOsARM64_recommendedSteps_runApplication,
|
||||
|
||||
// Rust
|
||||
APM_rust_kubernetes_recommendedSteps_setupOtelCollector,
|
||||
APM_rust_kubernetes_recommendedSteps_instrumentApplication,
|
||||
APM_rust_kubernetes_recommendedSteps_runApplication,
|
||||
|
||||
APM_rust_linuxAMD64_quickStart_instrumentApplication,
|
||||
APM_rust_linuxAMD64_quickStart_runApplication,
|
||||
|
||||
APM_rust_linuxAMD64_recommendedSteps_setupOtelCollector,
|
||||
APM_rust_linuxAMD64_recommendedSteps_instrumentApplication,
|
||||
APM_rust_linuxAMD64_recommendedSteps_runApplication,
|
||||
|
||||
APM_rust_linuxARM64_quickStart_instrumentApplication,
|
||||
APM_rust_linuxARM64_quickStart_runApplication,
|
||||
|
||||
APM_rust_linuxARM64_recommendedSteps_setupOtelCollector,
|
||||
APM_rust_linuxARM64_recommendedSteps_instrumentApplication,
|
||||
APM_rust_linuxARM64_recommendedSteps_runApplication,
|
||||
|
||||
APM_rust_macOsAMD64_quickStart_instrumentApplication,
|
||||
APM_rust_macOsAMD64_quickStart_runApplication,
|
||||
|
||||
APM_rust_macOsAMD64_recommendedSteps_setupOtelCollector,
|
||||
APM_rust_macOsAMD64_recommendedSteps_instrumentApplication,
|
||||
APM_rust_macOsAMD64_recommendedSteps_runApplication,
|
||||
|
||||
APM_rust_macOsARM64_quickStart_instrumentApplication,
|
||||
APM_rust_macOsARM64_quickStart_runApplication,
|
||||
|
||||
APM_rust_macOsARM64_recommendedSteps_setupOtelCollector,
|
||||
APM_rust_macOsARM64_recommendedSteps_instrumentApplication,
|
||||
APM_rust_macOsARM64_recommendedSteps_runApplication,
|
||||
|
||||
// Elixir
|
||||
APM_elixir_kubernetes_recommendedSteps_setupOtelCollector,
|
||||
APM_elixir_kubernetes_recommendedSteps_instrumentApplication,
|
||||
APM_elixir_kubernetes_recommendedSteps_runApplication,
|
||||
|
||||
APM_elixir_linuxAMD64_quickStart_instrumentApplication,
|
||||
APM_elixir_linuxAMD64_quickStart_runApplication,
|
||||
|
||||
APM_elixir_linuxAMD64_recommendedSteps_setupOtelCollector,
|
||||
APM_elixir_linuxAMD64_recommendedSteps_instrumentApplication,
|
||||
APM_elixir_linuxAMD64_recommendedSteps_runApplication,
|
||||
|
||||
APM_elixir_linuxARM64_quickStart_instrumentApplication,
|
||||
APM_elixir_linuxARM64_quickStart_runApplication,
|
||||
|
||||
APM_elixir_linuxARM64_recommendedSteps_setupOtelCollector,
|
||||
APM_elixir_linuxARM64_recommendedSteps_instrumentApplication,
|
||||
APM_elixir_linuxARM64_recommendedSteps_runApplication,
|
||||
|
||||
APM_elixir_macOsAMD64_quickStart_instrumentApplication,
|
||||
APM_elixir_macOsAMD64_quickStart_runApplication,
|
||||
|
||||
APM_elixir_macOsAMD64_recommendedSteps_setupOtelCollector,
|
||||
APM_elixir_macOsAMD64_recommendedSteps_instrumentApplication,
|
||||
APM_elixir_macOsAMD64_recommendedSteps_runApplication,
|
||||
|
||||
APM_elixir_macOsARM64_quickStart_instrumentApplication,
|
||||
APM_elixir_macOsARM64_quickStart_runApplication,
|
||||
|
||||
APM_elixir_macOsARM64_recommendedSteps_setupOtelCollector,
|
||||
APM_elixir_macOsARM64_recommendedSteps_instrumentApplication,
|
||||
APM_elixir_macOsARM64_recommendedSteps_runApplication,
|
||||
|
||||
// Swift
|
||||
APM_swift_kubernetes_recommendedSteps_setupOtelCollector,
|
||||
APM_swift_kubernetes_recommendedSteps_instrumentApplication,
|
||||
APM_swift_kubernetes_recommendedSteps_runApplication,
|
||||
|
||||
APM_swift_linuxAMD64_quickStart_instrumentApplication,
|
||||
APM_swift_linuxAMD64_quickStart_runApplication,
|
||||
|
||||
APM_swift_linuxAMD64_recommendedSteps_setupOtelCollector,
|
||||
APM_swift_linuxAMD64_recommendedSteps_instrumentApplication,
|
||||
APM_swift_linuxAMD64_recommendedSteps_runApplication,
|
||||
|
||||
APM_swift_linuxARM64_quickStart_instrumentApplication,
|
||||
APM_swift_linuxARM64_quickStart_runApplication,
|
||||
|
||||
APM_swift_linuxARM64_recommendedSteps_setupOtelCollector,
|
||||
APM_swift_linuxARM64_recommendedSteps_instrumentApplication,
|
||||
APM_swift_linuxARM64_recommendedSteps_runApplication,
|
||||
|
||||
APM_swift_macOsAMD64_quickStart_instrumentApplication,
|
||||
APM_swift_macOsAMD64_quickStart_runApplication,
|
||||
|
||||
APM_swift_macOsAMD64_recommendedSteps_setupOtelCollector,
|
||||
APM_swift_macOsAMD64_recommendedSteps_instrumentApplication,
|
||||
APM_swift_macOsAMD64_recommendedSteps_runApplication,
|
||||
|
||||
APM_swift_macOsARM64_quickStart_instrumentApplication,
|
||||
APM_swift_macOsARM64_quickStart_runApplication,
|
||||
|
||||
APM_swift_macOsARM64_recommendedSteps_setupOtelCollector,
|
||||
APM_swift_macOsARM64_recommendedSteps_instrumentApplication,
|
||||
APM_swift_macOsARM64_recommendedSteps_runApplication,
|
||||
};
|
||||
|
@ -107,6 +107,21 @@ const supportedLanguages = [
|
||||
id: 'dotnet',
|
||||
imgURL: `Logos/dotnet.png`,
|
||||
},
|
||||
{
|
||||
name: 'rust',
|
||||
id: 'rust',
|
||||
imgURL: `Logos/rust.png`,
|
||||
},
|
||||
{
|
||||
name: 'elixir',
|
||||
id: 'elixir',
|
||||
imgURL: `Logos/elixir.png`,
|
||||
},
|
||||
{
|
||||
name: 'swift',
|
||||
id: 'swift',
|
||||
imgURL: `Logos/swift.png`,
|
||||
},
|
||||
];
|
||||
|
||||
export const defaultLogsType = {
|
||||
@ -222,7 +237,10 @@ export const getSupportedFrameworks = ({
|
||||
if (
|
||||
(moduleID === ModulesMap.APM && dataSourceName === 'go') ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === 'rails') ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === '.NET')
|
||||
(moduleID === ModulesMap.APM && dataSourceName === '.NET') ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === 'rust') ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === 'elixir') ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === 'swift')
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
@ -248,7 +266,10 @@ export const hasFrameworks = ({
|
||||
moduleID === ModulesMap.InfrastructureMonitoring ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === 'go') ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === 'rails') ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === '.NET')
|
||||
(moduleID === ModulesMap.APM && dataSourceName === '.NET') ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === 'rust') ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === 'elixir') ||
|
||||
(moduleID === ModulesMap.APM && dataSourceName === 'swift')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
@ -11,7 +11,11 @@
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"moduleResolution": "node",
|
||||
@ -20,13 +24,25 @@
|
||||
"noEmit": true,
|
||||
"baseUrl": "./src",
|
||||
"downlevelIteration": true,
|
||||
"plugins": [{ "name": "typescript-plugin-css-modules" }],
|
||||
"types": ["node", "jest"],
|
||||
"plugins": [
|
||||
{
|
||||
"name": "typescript-plugin-css-modules"
|
||||
}
|
||||
],
|
||||
"types": [
|
||||
"node",
|
||||
"jest"
|
||||
],
|
||||
},
|
||||
"exclude": ["node_modules"],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"./src/container/OnboardingContainer/constants/*.ts"
|
||||
],
|
||||
"include": [
|
||||
"./src",
|
||||
"./src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts",
|
||||
"./src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.d.ts",
|
||||
"./babel.config.js",
|
||||
"./jest.config.ts",
|
||||
"./.eslintrc.js",
|
||||
@ -42,4 +58,4 @@
|
||||
"./tests/**.ts",
|
||||
"./**/*.d.ts"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user