Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 59047fc

Browse files
Nir Hadassigitbook-bot
Nir Hadassi
authored andcommitted
GitBook: [master] 3 pages modified
1 parent 19e7628 commit 59047fc

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* [Advanced](getting-started/install/advanced.md)
1313
* [Configure Logs](getting-started/install/configure-logs.md)
1414
* [Custom Collector](getting-started/install/custom-collector.md)
15+
* [Use w/o Aspecto SDK](getting-started/install/use-w-o-aspecto-sdk.md)
1516
* [How it Works](getting-started/how-it-works.md)
1617

1718
## 🛡️ Issue Prevention

getting-started/install/custom-collector.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ description: >-
66

77
# Custom Collector
88

9-
Aspecto's SDK is by default exporting collected trace data to our collector at [https://otelcol-fast.aspecto.io/v1/trace](https://otelcol-fast.aspecto.io/v1/trace). Users that need this data for other purposes \(such as exporting it to Jaeger, process it etc\), can configure Aspecto to send data to a custom collector by using the `otCollectorEndpoint` option:
9+
Aspecto's SDK is by default exporting collected trace data to our collector at [https://otelcol-fast.aspecto.io/v1/trace](https://otelcol-fast.aspecto.io/v1/trace).
10+
Users that need this data for other purposes \(such as exporting it to Jaeger, process it, etc\), can configure Aspecto to send data to a custom collector by using the `otCollectorEndpoint` option:
1011

1112
```javascript
1213
require('@aspecto/opentelemetry')({
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
description: How to send traces to Aspecto without using our SDK
3+
---
4+
5+
# Use w/o Aspecto SDK
6+
7+
To enjoy Aspecto to the fullest, we encourage you to use our SDK to send traces.
8+
If you already have an existing OpenTelemetry setup and prefer to keep using it, there are a couple of ways to do it.
9+
10+
The minimum required for our collector to accept your traces is to have the `service.name` resource attribute on your spans and pass the [Aspecto API-Key](https://app.aspecto.io/app/integration/api-key), either through `aspecto.token` resource attribute, or through the `Authorization` HTTP header when making a request to our collector.
11+
12+
## Send Traces to Aspecto directly from your code
13+
14+
To do so, you'd need to use the [`exporter-collector`](https://www.npmjs.com/package/@opentelemetry/exporter-collector) , here's an example Node.js snippet:
15+
16+
```typescript
17+
import { NodeTracerProvider } from '@opentelemetry/node';
18+
import { Resource } from '@opentelemetry/resources';
19+
import { SimpleSpanProcessor } from '@opentelemetry/tracing';
20+
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector';
21+
22+
const provider = new NodeTracerProvider({
23+
resource: new Resource({
24+
'service.name': 'my-service-name' // service.name is required
25+
}),
26+
});
27+
28+
provider.register();
29+
provider.addSpanProcessor(
30+
new SimpleSpanProcessor(
31+
new CollectorTraceExporter({
32+
url: 'https://otelcol-fast.aspecto.io/v1/trace',
33+
headers: {
34+
// Aspecto API-Key is required
35+
Authorization: process.env.ASPECTO_API_KEY
36+
}
37+
})
38+
)
39+
);
40+
```
41+
42+
## Export to Aspecto Collector from your own OpenTelemetry Collector
43+
44+
If you already have your own [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector) and want to export your traces to Aspecto, you'd need to add a new `otlphttp` exporter in your config.yml:
45+
46+
```yaml
47+
exporters:
48+
otlphttp:
49+
endpoint: https://otelcol-fast.aspecto.io
50+
headers:
51+
Authorization: <aspecto-api-key>
52+
53+
service:
54+
pipelines:
55+
traces:
56+
receivers: [...]
57+
processors: [...]
58+
exporters: [otlphttp, ...]
59+
```
60+

0 commit comments

Comments
 (0)