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

examples(sumo): improve example and guide #3485

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,35 @@ Once started, Tracetest Agent will:
- Be able to trigger test runs in the environment where it is running.
- Be able to connect to a trace data store that is not accessible outside of your environment.

Configure Sumo Logic as a Tracing Backend:

```yaml title=tracetest.datastore.yaml
---
type: DataStore
spec:
name: Sumo Logic
type: sumologic
sumologic:
# The URL will differ based on your location. View this
# docs page to figure out which URL you need:
# https://help.sumologic.com/docs/api/getting-started/#which-endpoint-should-i-should-use
url: "https://api.sumologic.com/api/"
# Create your ID and Key under Administration > Security > Access Keys
# in your Sumo Logic account:
# https://help.sumologic.com/docs/manage/security/access-keys/#create-your-access-key
accessID: "your-access-id"
accessKey: "your-access-key"
```

:::note Configure Sumo Logic API and Access
- Your Sumo Logic URL will differ based on which region you are using. [Here's a guide which Sumo Logic API endpoint to use](https://help.sumologic.com/docs/api/getting-started/#which-endpoint-should-i-should-use).
- [Create your ID and Key under Administration > Security > Access Keys in your Sumo Logic account](https://help.sumologic.com/docs/manage/security/access-keys/#create-your-access-key).
:::

```bash
tracetest apply datastore -f ./tracetest.datastore.yaml
```

### 2. Node.js App

The Node.js app is a simple Express app, contained in the `app.js` file.
Expand Down Expand Up @@ -144,7 +173,11 @@ services:

Traces sent to Sumo Logic from the OpenTelemetry Collector.

The `collector.config.yaml` configures the OpenTelemetry Collector. It receives traces via either `grpc` or `http`. Then, exports them to Sumo Logic via the Sumo Logic `extension` and an `installation_token`. View the [Sumo Logic docs here](https://help.sumologic.com/docs/manage/security/installation-tokens/) to learn more about installation tokens.
The `collector.config.yaml` configures the OpenTelemetry Collector. It receives traces via either `grpc` or `http`. Then, exports them to Sumo Logic via the Sumo Logic `extension` and an `installation_token`.

:::note Configure Sumo Logic Installation Token
View the [Sumo Logic docs here](https://help.sumologic.com/docs/manage/security/installation-tokens/) to learn more about installation tokens.
:::

```yaml
receivers:
Expand Down Expand Up @@ -179,9 +212,32 @@ This will start the Node.js app and Sumo Logic OpenTelemetry Collector and send

## Run Tracetest Tests

Open [Tracetest](https://app.tracetest.io/) and [configure Sumo Logic as a trace data store](/configuration/connecting-to-data-stores/sumologic).

Next, start creating tests! Make sure to use the `http://localhost:8080/` URL in your test creation.
1. Open [Tracetest](https://app.tracetest.io/)
2. [Configure Sumo Logic as a trace data store](/configuration/connecting-to-data-stores/sumologic) if you have not already as explained in ["1. Tracetest Agent"](#1-tracetest-agent).
3. Start creating tests! Make sure to use the `http://localhost:8080/` URL in your test creation.

Alternatively, you can import this test as a quick start!

```yaml
type: Test
spec:
id: W656Q0c4g
name: Test API
description: Test the App.
trigger:
type: http
httpRequest:
url: http://localhost:8080
method: GET
headers:
- key: Content-Type
value: application/json
specs:
- selector: span[tracetest.span.type="http" name="GET /" http.target="/" http.method="GET"]
assertions:
- attr:http.status_code = 200
- attr:tracetest.span.duration < 500ms
```

```mdx-code-block
</TabItem>
Expand Down Expand Up @@ -290,7 +346,11 @@ services:

Traces sent to Sumo Logic from the OpenTelemetry Collector.

The `collector.config.yaml` configures the OpenTelemetry Collector. It receives traces via either `grpc` or `http`. Then, exports them to Sumo Logic via the Sumo Logic `extension` and an `installation_token`. View the [Sumo Logic docs here](https://help.sumologic.com/docs/manage/security/installation-tokens/) to learn more about installation tokens.
The `collector.config.yaml` configures the OpenTelemetry Collector. It receives traces via either `grpc` or `http`. Then, exports them to Sumo Logic via the Sumo Logic `extension` and an `installation_token`.

:::note Configure Sumo Logic Installation Token
View the [Sumo Logic docs here](https://help.sumologic.com/docs/manage/security/installation-tokens/) to learn more about installation tokens.
:::

```yaml title="collector.config.yaml"
receivers:
Expand Down Expand Up @@ -398,10 +458,15 @@ The `tracetest-provision.yaml` file provisions the trace data store and polling

You'll need to set Sumo Logic:

- URL
- Access ID
- Access Key

View the [Sumo Logic configuration docs](http://localhost:3000/configuration/connecting-to-data-stores/sumologic) for guidance.
:::note Configure Sumo Logic API and Access
- Your Sumo Logic URL will differ based on which region you are using. [Here's a guide which Sumo Logic API endpoint to use](https://help.sumologic.com/docs/api/getting-started/#which-endpoint-should-i-should-use).
- [Create your ID and Key under Administration > Security > Access Keys in your Sumo Logic account](https://help.sumologic.com/docs/manage/security/access-keys/#create-your-access-key).
- View the [Sumo Logic configuration docs](/configuration/connecting-to-data-stores/sumologic) for guidance.
:::

```yaml title="tracetest-provision.yaml"
---
Expand All @@ -420,7 +485,7 @@ spec:
name: Sumo Logic
type: sumologic
sumologic:
url: "https://api.sumologic.com"
url: "https://api.sumologic.com/api/"
accessID: "your-access-id"
accessKey: "your-access-key"
```
Expand Down
3 changes: 3 additions & 0 deletions examples/quick-start-sumologic-nodejs/collector.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ exporters:

extensions:
sumologic:
# Create an Installation Token in your account at
# Administration > Security > Installation Tokens:
# https://help.sumologic.com/docs/manage/security/installation-tokens/
installation_token: <your-sumologic-installation-token>

service:
Expand Down
8 changes: 8 additions & 0 deletions examples/quick-start-sumologic-nodejs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ Once started, Tracetest Agent will:
- Be able to trigger test runs in the environment where it is running.
- Be able to connect to a trace data store that is not accessible outside of your environment. Eg. a Sumo Logic OpenTelemetry Collector instance running in the cluster without an ingress controller.

Configure Sumo Logic as a Tracing Backend:

```bash
tracetest apply datastore -f ./tracetest.datastore.yaml
```

> Note: Here's a guide which Sumo Logic API endpoint to use: https://help.sumologic.com/docs/api/getting-started/#which-endpoint-should-i-should-use

### 2. Start Node.js App

You can run the example with Docker.
Expand Down
8 changes: 5 additions & 3 deletions examples/quick-start-sumologic-nodejs/test-api.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
type: Test
spec:
id: W656Q0c4g
name: http://app:8080
description: akadlkasjdf
name: Test API
description: Test the App.
trigger:
type: http
httpRequest:
url: http://app:8080
url: http://localhost:8080
# OR for Tracetest Core
# url: http://app:8080
method: GET
headers:
- key: Content-Type
Expand Down
15 changes: 15 additions & 0 deletions examples/quick-start-sumologic-nodejs/tracetest.datastore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
type: DataStore
spec:
name: Sumo Logic
type: sumologic
sumologic:
# The URL will differ based on your location. View this
# docs page to figure out which URL you need:
# https://help.sumologic.com/docs/api/getting-started/#which-endpoint-should-i-should-use
url: "https://api.sumologic.com/api/"
# Create your ID and Key under Administration > Security > Access Keys
# in your Sumo Logic account:
# https://help.sumologic.com/docs/manage/security/access-keys/#create-your-access-key
accessID: "your-access-id"
accessKey: "your-access-key"
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ spec:
name: Sumo Logic
type: sumologic
sumologic:
url: "https://api.sumologic.com"
# The URL will differ based on your location. View this
# docs page to figure out which URL you need:
# https://help.sumologic.com/docs/api/getting-started/#which-endpoint-should-i-should-use
url: "https://api.sumologic.com/api/"
accessID: "your-access-id"
accessKey: "your-access-key"
Loading