Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update nodejs docs #658

Merged
merged 4 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/_include/tracing-shipping/collector-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ exporters:
headers:
user-agent: logzio-opentelemetry-traces

logging:

processors:
batch:
tail_sampling:
Expand Down Expand Up @@ -51,5 +49,8 @@ service:
traces:
receivers: [otlp]
processors: [tail_sampling, batch]
exporters: [logging, logzio/traces]
exporters: [logzio/traces]
telemetry:
logs:
level: info
```
2 changes: 1 addition & 1 deletion docs/_include/tracing-shipping/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ service:

{@include: ../../_include/tracing-shipping/replace-tracing-token.html}

#### Tail Sampling
#### Tail Sampling

{@include: ../../_include/tracing-shipping/tail-sampling.md}

Expand Down
10 changes: 8 additions & 2 deletions docs/_include/tracing-shipping/node-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ npm install --save @opentelemetry/sdk-node

#### Create a tracer file

In your application's directory, create a file named `tracer.js` with the following configuration:
In your application's directory, create a file named `tracer.js` with the following configuration.


:::caution Important
Replace `<<YOUR-SERVICE-NAME>>` with your service name.
:::


```javascript
"use strict";
Expand Down Expand Up @@ -43,7 +49,7 @@ const exporter = new OTLPTraceExporter({
const provider = new BasicTracerProvider({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]:
"YOUR-SERVICE-NAME",
"<<YOUR-SERVICE-NAME>>",
}),
});
// export spans to console (useful for debugging)
Expand Down
2 changes: 1 addition & 1 deletion docs/_include/tracing-shipping/replace-tracing-token.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Replace `<<TRACING-SHIPPING-TOKEN>>` with the [token](https://app.logz.io/#/dashboard/settings/manage-tokens/data-shipping?product=tracing) of the account you want to ship to.

Replace `<LOGZIO_ACCOUNT_REGION_CODE>` with the applicable [region code](https://docs.logz.io/docs/user-guide/admin/hosting-regions/account-region/#available-regions).
Replace `<<LOGZIO_ACCOUNT_REGION_CODE>>` with the applicable [region code](https://docs.logz.io/docs/user-guide/admin/hosting-regions/account-region/#available-regions).

2 changes: 1 addition & 1 deletion docs/shipping/AWS/aws-lambda-extension-go.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ service:
{@include: ../../_include/tracing-shipping/replace-tracing-token.html}
{@include: ../../_include/tracing-shipping/tail-sampling.md}


#### Direct the OpenTelemetry collector to the configuration file


Expand Down
2 changes: 1 addition & 1 deletion docs/shipping/AWS/aws-lambda-extension-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ service:

{@include: ../../_include/tracing-shipping/replace-tracing-token.html}
{@include: ../../_include/tracing-shipping/tail-sampling.md}


#### Direct the OpenTelemetry collector to the configuration file

Expand Down
2 changes: 1 addition & 1 deletion docs/shipping/App360/App360.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ service:
```

{@include: ../../_include/tracing-shipping/replace-tracing-token.html}

{@include: ../../_include/tracing-shipping/replace-spm-token.html}

{@include: ../../_include/log-shipping/listener-var.html}
Expand Down
2 changes: 1 addition & 1 deletion docs/shipping/Code/dotnet-traces-kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ consumer.ConsumeWithInstrumentation((result) =>


{@include: ../../_include/tracing-shipping/replace-tracing-token.html}


* Replace `<path/to>` with the path to the directory where you downloaded the agent.
* Replace `<YOUR-SERVICE-NAME>` with the name of your tracing service defined earlier.
Expand Down
2 changes: 1 addition & 1 deletion docs/shipping/Code/dotnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@ This integration uses OpenTelemetry Collector Contrib, not the OpenTelemetry Col

{@include: ../../_include/tracing-shipping/dotnet-steps.md}

#### Download and configure OpenTelemetry collector
#### Download and configure OpenTelemetry collector

Create a dedicated directory on the host of your ASP.NET Core application and download the [OpenTelemetry collector](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v0.60.0) that is relevant to the operating system of your host.

Expand Down
2 changes: 1 addition & 1 deletion docs/shipping/Code/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ func handleErr(err error, message string) {


##### Download and configure OpenTelemetry collector

Create a dedicated directory on the host of your Go application and download the [OpenTelemetry collector](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.70.0) that is relevant to the operating system of your host.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ helm install -n monitoring \
--set logzio-k8s-telemetry.secrets.LogzioRegion="<<LOGZIO-REGION>>" \
--set logzio-k8s-telemetry.secrets.env_id="<<CLUSTER-NAME>>" \
logzio-monitoring logzio-helm/logzio-monitoring
```
```

| Parameter | Description |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/shipping/Code/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ This integration uses OpenTelemetry Collector Contrib, not the OpenTelemetry Col
Download the latest version of the [OpenTelemetry Java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar) to your application host.



**2. Download and configure OpenTelemetry collector**

Create a dedicated directory on the host of your Java application and download the relevant [OpenTelemetry collector](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.70.0).
Expand Down
2 changes: 1 addition & 1 deletion docs/shipping/Code/nestjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ require('<<PATH-TO-YOUR-FILE>>/tracer.ts');

Replace `<<PATH-TO-YOUR-FILE>>` with the path to your tracer file.


#### Download and configure OpenTelemetry collector

Create a dedicated directory on the host of your NestJS application and download the [OpenTelemetry collector](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.70.0) that is relevant to the operating system of your host.
Expand Down
41 changes: 23 additions & 18 deletions docs/shipping/Code/node-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ These examples use the [OpenTelemetry JS SDK](https://github.com/open-telemetry/

**Before you begin, you'll need**:

Node 8 or higher.
Node 14 or higher.

:::note
We recommend using this integration with [the Logz.io Metrics backend](https://app.logz.io/#/dashboard/metrics/), though it is compatible with any backend that supports the `prometheusremotewrite` format.
Expand All @@ -444,7 +444,7 @@ We recommend using this integration with [the Logz.io Metrics backend](https://a
### Install the SDK package

```shell
npm install logzio-nodejs-metrics-sdk@0.4.0
npm install logzio-nodejs-metrics-sdk@0.5.0
```

### Initialize the exporter and meter provider
Expand All @@ -455,7 +455,7 @@ const MeterProvider = require('@opentelemetry/sdk-metrics-base');
const sdk = require('logzio-nodejs-metrics-sdk');

const collectorOptions = {
url: '<<LISTENER-HOST>>',
url: 'https://<<LISTENER-HOST>>:8053',
headers: {
"Authorization":"Bearer <<PROMETHEUS-METRICS-SHIPPING-TOKEN>>"
}
Expand All @@ -464,12 +464,15 @@ const collectorOptions = {
const metricExporter = new sdk.RemoteWriteExporter(collectorOptions);

// Initialize the meter provider
const meter = new MeterProvider.MeterProvider({
exporter: metricExporter,
interval: 15000, // Push interval in milliseconds
const meter = new MeterProvider({
readers: [
new PeriodicExportingMetricReader(
{
exporter: metricExporter,
exportIntervalMillis: 1000
})
],
}).getMeter('example-exporter');


```
{@include: ../../_include/general-shipping/replace-placeholders-prometheus.html}

Expand Down Expand Up @@ -552,13 +555,8 @@ Install the pre-built dashboard for enhanced observability.

### Auto-instrument Node.js and send Traces to Logz.io

This integration includes:

* Install OpenTelemetry Node.js instrumentation packages on your host.
* Install the OpenTelemetry collector with Logz.io exporter.
* Run your Node.js application with OpenTelemetry instrumentation.

The Node.js instrumentation captures spans and forwards them to the collector, which exports the data to your Logz.io account.
<Tabs>
<TabItem value="nodejs-traces" label="OpenTelemetry Collector" default>

**Before you begin, you'll need**:

Expand All @@ -572,9 +570,8 @@ This integration uses OpenTelemetry Collector Contrib, not the OpenTelemetry Col
:::



{@include: ../../_include/tracing-shipping/node-steps.md}



#### Download and configure the OpenTelemetry collector
Expand Down Expand Up @@ -611,7 +608,8 @@ node --require './tracer.js' <YOUR-APPLICATION-FILE-NAME>.js
Give your traces some time to ingest, and then open your [Tracing account](https://app.logz.io/#/dashboard/jaeger).


### Auto-instrument Node.js with Docker for Logz.io
</TabItem>
<TabItem value="nodejs-traces-docker" label="Docker" default>

This integration auto-instruments your Node.js app and runs a containerized OpenTelemetry collector to send traces to Logz.io. Ensure both application and collector containers are on the same network.

Expand Down Expand Up @@ -649,6 +647,9 @@ node --require './tracer.js' <YOUR-APPLICATION-FILE-NAME>.js
Give your traces some time to ingest, and then open your [Tracing account](https://app.logz.io/#/dashboard/jaeger).


</TabItem>
<TabItem value="nodejs-traces-helm" label="Helm" default>


### Configuration using Helm

Expand Down Expand Up @@ -825,6 +826,10 @@ helm uninstall logzio-k8s-telemetry
```


</TabItem>
</Tabs>


{@include: ../../_include/tracing-shipping/otel-troubleshooting.md}


Expand Down
2 changes: 1 addition & 1 deletion docs/shipping/Code/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ After installation, configure the exporter with this command:
export OTEL_TRACES_EXPORTER=otlp
export OTEL_RESOURCE_ATTRIBUTES="service.name=<<YOUR-SERVICE-NAME>>"
```

### Download and configure OpenTelemetry collector

Create a directory on your Python application and download the relevant [OpenTelemetry collector](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.82.0). Create a `config.yaml` with the following parameters:
Expand Down
2 changes: 1 addition & 1 deletion docs/shipping/Code/ruby.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ This integration uses OpenTelemetry Collector Contrib, not the OpenTelemetry Col

{@include: ../../_include/tracing-shipping/ruby-steps.md}



### Download and configure OpenTelemetry collector

Expand Down
2 changes: 1 addition & 1 deletion docs/shipping/Other/opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ On deployment, your OpenTelemetry instrumentation captures spans from your appli
This integration uses OpenTelemetry Collector Contrib, not the OpenTelemetry Collector Core.
:::



### Download and configure OpenTelemetry collector

Expand Down