Skip to content

Commit 0c02b92

Browse files
authored
Merge branch 'main' into islam/inp-458-find-way-to-sync-send-data-to-axiom-docs
2 parents 01899a3 + dc28ab4 commit 0c02b92

28 files changed

+688
-58
lines changed

apps/vercel.mdx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Vercel provides a frictionless developer experience to take care of the hard thi
2424

2525
Vercel makes it easy for frontend teams to develop, preview, and ship delightful user experiences, where performance is the default.
2626

27-
## Sending logs to Axiom
27+
## Send logs to Axiom
2828

2929
Simply install the [Axiom Vercel app from here](https://vercel.com/integrations/axiom) and be streaming logs and web vitals within minutes!
3030

@@ -42,9 +42,11 @@ For function logs, if you call `console.log`, `console.warn` or `console.error`
4242

4343
Axiom supports capturing and analyzing Web Vital data directly from your user’s browser without any sampling and with more data than is available elsewhere. It is perfect to pair with Vercel’s in-built analytics when you want to get really deep into a specific problem or debug issues with a specific audience (user-agent, location, region, etc).
4444

45-
**NOTE: Web Vitals are only currently supported for Next.js websites. Expanded support is coming soon!**
45+
<Note>
46+
Web Vitals are only currently supported for Next.js websites. Expanded support is coming soon.
47+
</Note>
4648

47-
#### Installation
49+
### Installation
4850

4951
Perform the following steps to install Web Vitals:
5052

@@ -76,7 +78,9 @@ export default function RootLayout() {
7678
}
7779
```
7880

79-
**Note:** WebVitals are sent only from production deployments.
81+
<Note>
82+
WebVitals are sent only from production deployments.
83+
</Note>
8084

8185
4. Deploy your site and watch data coming into your Axiom dashboard.
8286

@@ -137,7 +141,7 @@ export const GET = withAxiom((req: AxiomRequest) => {
137141
});
138142
```
139143

140-
## Using Next.js 12 for Web Vitals
144+
## Use Next.js 12 for Web Vitals
141145

142146
If you’re using Next.js version 12, follow the instructions below to integrate Axiom for logging and capturing Web Vitals data.
143147

@@ -147,7 +151,7 @@ In your `pages/_app.js` or `pages/_app.ts` and add the following line:
147151
export { reportWebVitals } from 'next-axiom';
148152
```
149153

150-
## Upgrading to Next.js 13 from Next.js 12
154+
## Upgrade to Next.js 13 from Next.js 12
151155

152156
If you plan on upgrading to Next.js 13, you'll need to make specific changes to ensure compatibility:
153157

@@ -237,7 +241,6 @@ You can **parse** the JSON using the [parse_json function](/apl/scalar-functions
237241

238242
- Check out our [APL Documentation on how to use more functions](/apl/scalar-functions/string-functions) and run your own queries against your Vercel logs.
239243

240-
241244
## Migrate from Vercel app to next-axiom
242245

243246
In May 2024, Vercel [introduced higher costs](https://axiom.co/blog/changes-to-vercel-log-drains) for using Vercel Log Drains. Because the Axiom Vercel app depends on Log Drains, using the next-axiom library can be the cheaper option to analyze telemetry data for higher volume projects.
@@ -262,3 +265,7 @@ module.exports = withAxiom({
262265
```
263266

264267
For more configuration options, see the [documentation in the next-axiom GitHub repository](https://github.com/axiomhq/next-axiom).
268+
269+
## Send logs from Vercel preview deployments
270+
271+
To send logs from Vercel preview deployments to Axiom, enable preview deployments for the environment variable `NEXT_PUBLIC_AXIOM_INGEST_ENDPOINT`. For more information, see the [Vercel documentation](https://vercel.com/docs/projects/environment-variables/managing-environment-variables).

dashboard-elements/create.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ To create new dashboard elements:
2323
1. Optional: [Configure chart options](/dashboard-elements/configure).
2424
1. Click **Save**.
2525

26-
The new element appears in your dashboard. In the bottom, click **Save** to save your changes to the dashboard.
26+
The new element appears in your dashboard. At the bottom, click **Save** to save your changes to the dashboard.
2727

2828
## Change element’s position
2929

dashboard-elements/monitor-list.mdx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Monitor list
3+
description: 'This section explains how to create monitor list dashboard elements and add them to your dashboard.'
4+
sidebarTitle: Monitor List
5+
tags:
6+
['axiom documentation', 'documentation', 'axiom', 'dashboards', 'collaboration', 'queries', 'visualizations', 'filters', 'charts', 'simple query builder', 'advanced query builder']
7+
---
8+
9+
import Prerequisites from "/snippets/dashboard-minimal-prerequisites.mdx"
10+
11+
The monitor list dashboard element provides a visual overview of the monitors you specify. It offers a quick glance into important developments about the monitors such as their status and history.
12+
13+
<Prerequisites />
14+
{/* list separator */}
15+
- [Create a monitor](/monitor-data/monitors).
16+
17+
## Create monitor list
18+
19+
1. Go to the Dashboards tab and open the dashboard where you want to add the monitor list.
20+
1. Click <img src="/doc-assets/icons/plus.svg" className="inline-icon" alt="Add chart" /> **Add chart** in the top right corner.
21+
1. Click **Monitor list** from the list.
22+
1. In **Columns**, select the type of information you want to display for each monitor:
23+
- **Status** displays if the monitor state is normal, triggered, or disabled.
24+
- **History** provides a visual overview of the recent runs of the monitor. Green squares mean normal operation and red squares mean triggered state.
25+
- **Dataset** is the name of the dataset on which the monitor operates.
26+
- **Type** is the type of the monitor.
27+
- **Notifiers** displays the notifiers connected to the monitor.
28+
1. From the list, select the monitors you want to display on the dashboard.
29+
1. Click **Save**.
30+
31+
The new element appears in your dashboard. At the bottom, click **Save** to save your changes to the dashboard.
32+
33+
<Frame>
34+
<img src="/doc-assets/shots/monitor-list.png" alt="Example monitor list" />
35+
</Frame>

dashboard-elements/note.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ The note dashboard element adds a textbox to your dashboard that you can customi
1414

1515
## Create note
1616

17-
1. Go to the Dashboards tab and open the dashboard where you want to add the {elementName}.
17+
1. Go to the Dashboards tab and open the dashboard where you want to add the note.
1818
1. Click <img src="/doc-assets/icons/plus.svg" className="inline-icon" alt="Add chart" /> **Add chart** in the top right corner.
1919
1. Click **Note** from the list.
2020
1. Enter your text on the left in [GitHub Flavored Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) format. You see the preview of the note dashboard element on the right.
2121
1. Click **Save**.
2222

23-
The new element appears in your dashboard. In the bottom, click **Save** to save your changes to the dashboard.
23+
The new element appears in your dashboard. At the bottom, click **Save** to save your changes to the dashboard.

dashboard-elements/overview.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ Choose one of the following to learn more about a dashboard element:
2222
href="/dashboard-elements/log-stream"
2323
>
2424
</Card>
25+
<Card
26+
title="Monitor list"
27+
icon="desktop"
28+
href="/dashboard-elements/monitor-list"
29+
>
30+
</Card>
2531
<Card
2632
title="Note"
2733
icon="note-sticky"

dashboard-elements/pie-chart.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ Pie charts can illustrate the distribution of different types of event data. Eac
1818
## Example with Simple Query Builder
1919

2020
<Frame>
21-
<img src="/doc-assets/shots/pie-chart-builder.png" />
21+
<img src="/doc-assets/shots/pie-chart-builder.png" alt="Pie chart example with Simple Query Builder" />
2222
</Frame>
2323

2424
## Example with Advanced Query Language
2525

2626
<Frame>
27-
<img src="/doc-assets/shots/pie-chart-apl.png" />
27+
<img src="/doc-assets/shots/pie-chart-apl.png" alt="Pie chart example with Advanced Query Language" />
2828
</Frame>

dashboards/configure.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To specify who can access a dashboard:
2525
- Select **Just Me** to make the dashboard private. Only you can access the dashboard.
2626
- Select a group in your Axiom organization. Only members of the selected group can access the dashboard. For more information about groups, see [Access](/reference/settings#access-overview).
2727
- Select **Everyone** to make the dashboard accessible to all users in your Axiom organization.
28-
1. In the bottom, click **Save** to save your changes to the dashboard.
28+
1. At the bottom, click **Save** to save your changes to the dashboard.
2929

3030
<Note>
3131
The data that individual users see in the dashboard is determined by the datasets the users have access to. If a user has access to a dashboard but only to some of the datasets referenced in the dashboard’s charts, the user only sees data from the datasets they have access to.
@@ -40,7 +40,7 @@ To specify the types of annotations to display in all dashboard elements:
4040
- Show all annotations
4141
- Hide all annotations
4242
- Selective determine the annotations types to display
43-
1. In the bottom, click **Save** to save your changes to the dashboard.
43+
1. At the bottom, click **Save** to save your changes to the dashboard.
4444

4545
## Set dashboard as homepage
4646

doc-assets/shots/monitor-list.png

62 KB
Loading
-282 KB
Binary file not shown.
Binary file not shown.

doc-assets/shots/render-install.png

-424 KB
Binary file not shown.
-215 KB
Binary file not shown.

guides/go.mdx

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,99 @@
11
---
22
title: 'Send data from Go app to Axiom'
3-
description: 'This guide explains how to send data from a Go app to Axiom.'
3+
description: 'This page explains how to send data from a Go app to Axiom.'
44
overview: 'Open-source programming language designed for simplicity and efficiency'
55
sidebarTitle: Golang
66
url: "https://github.com/axiomhq/axiom-go"
77
tags: ['go', 'golang']
88
logoId: 'go'
99
enlargeLogo: true
1010
---
11+
12+
To send data from a Go app to Axiom, use the Axiom Go SDK.
13+
14+
<Note>
15+
The Axiom Go SDK is an open-source project and welcomes your contributions. For more information, see the [GitHub repository](https://github.com/axiomhq/axiom-go).
16+
</Note>
17+
18+
import Prerequisites from "/snippets/standard-prerequisites.mdx"
19+
20+
<Prerequisites />
21+
22+
## Install SDK
23+
24+
To install the SDK, run the following:
25+
26+
```shell
27+
go get github.com/axiomhq/axiom-go/axiom
28+
```
29+
30+
Import the package:
31+
32+
```go
33+
import "github.com/axiomhq/axiom-go/axiom"
34+
```
35+
36+
If you use the [Axiom CLI](/reference/cli), run `eval $(axiom config export -f)` to configure your environment variables. Otherwise, [create an API token](/reference/tokens) and export it as `AXIOM_TOKEN`.
37+
38+
Alternatively, configure the client using [options](https://pkg.go.dev/github.com/axiomhq/axiom-go/axiom#Option) passed to the `axiom.NewClient` function:
39+
40+
```go
41+
client, err := axiom.NewClient(
42+
axiom.SetPersonalTokenConfig("AXIOM_TOKEN"),
43+
)
44+
```
45+
46+
## Use client
47+
48+
Create and use a client in the following way:
49+
50+
```go
51+
package main
52+
53+
import (
54+
"context"
55+
"fmt"
56+
"log"
57+
58+
"github.com/axiomhq/axiom-go/axiom"
59+
"github.com/axiomhq/axiom-go/axiom/ingest"
60+
)
61+
62+
func main() {
63+
ctx := context.Background()
64+
65+
client, err := axiom.NewClient()
66+
if err != nil {
67+
log.Fatal(err)
68+
}
69+
70+
if _, err = client.IngestEvents(ctx, "my-dataset", []axiom.Event{
71+
{ingest.TimestampField: time.Now(), "foo": "bar"},
72+
{ingest.TimestampField: time.Now(), "bar": "foo"},
73+
}); err != nil {
74+
log.Fatal(err)
75+
}
76+
77+
res, err := client.Query(ctx, "['my-dataset'] | where foo == 'bar' | limit 100")
78+
if err != nil {
79+
log.Fatal(err)
80+
} else if res.Status.RowsMatched == 0 {
81+
log.Fatal("No matches found")
82+
}
83+
84+
rows := res.Tables[0].Rows()
85+
if err := rows.Range(ctx, func(_ context.Context, row query.Row) error {
86+
_, err := fmt.Println(row)
87+
return err
88+
}); err != nil {
89+
log.Fatal(err)
90+
}
91+
}
92+
```
93+
94+
For more examples, see the [examples in GitHub](https://github.com/axiomhq/axiom-go/tree/main/examples).
95+
96+
## Adapters
97+
98+
To use a logging package, see the [adapters in GitHub](https://github.com/axiomhq/axiom-go/tree/main/adapters).
99+

guides/javascript.mdx

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,102 @@
11
---
22
title: 'Send data from JavaScript app to Axiom'
3-
description: 'This guide explains how to send data from a JavaScript app to Axiom.'
3+
description: 'This page explains how to send data from a JavaScript app to Axiom.'
44
overview: 'High-level, interpreted programming language for web development'
55
sidebarTitle: JavaScript
66
url: "https://github.com/axiomhq/axiom-js"
77
tags: ['js', 'javascript', 'node', 'typescript', 'ts', 'node.js']
88
logoId: 'javascript'
99
---
10+
11+
To send data from a JavaScript app to Axiom, use the Axiom JavaScript SDK.
12+
13+
<Note>
14+
The Axiom JavaScript SDK is an open-source project and welcomes your contributions. For more information, see the [GitHub repository](https://github.com/axiomhq/axiom-js).
15+
</Note>
16+
17+
import Prerequisites from "/snippets/standard-prerequisites.mdx"
18+
19+
<Prerequisites />
20+
21+
## Install SDK
22+
23+
To install the SDK, run the following:
24+
25+
```shell
26+
npm install @axiomhq/js
27+
```
28+
29+
If you use the [Axiom CLI](/reference/cli), run `eval $(axiom config export -f)` to configure your environment variables. Otherwise, [create an API token](/reference/tokens) and export it as `AXIOM_TOKEN`.
30+
31+
You can also configure the client using options passed to the constructor of the client:
32+
33+
```ts
34+
import { Axiom } from '@axiomhq/js';
35+
36+
const axiom = new Axiom({
37+
token: process.env.AXIOM_TOKEN,
38+
});
39+
```
40+
41+
## Send data
42+
43+
The following example sends data to Axiom:
44+
45+
```ts
46+
axiom.ingest('DATASET_NAME', [{ foo: 'bar' }]);
47+
await axiom.flush();
48+
```
49+
50+
The client automatically batches events in the background. In most cases, you only want to call `flush()` before your application exits.
51+
52+
## Query data
53+
54+
The following example queries data from Axiom:
55+
56+
```ts
57+
const res = await axiom.query(`['DATASET_NAME'] | where foo == 'bar' | limit 100`);
58+
console.log(res);
59+
```
60+
61+
For more examples, see the [examples in GitHub](https://github.com/axiomhq/axiom-js/tree/main/examples).
62+
63+
## Capture errors
64+
65+
To capture errors, pass a method `onError` to the client:
66+
67+
```ts
68+
let client = new Axiom({
69+
token: '',
70+
...,
71+
onError: (err) => {
72+
console.error('ERROR:', err);
73+
}
74+
});
75+
```
76+
77+
By default, `onError` is set to `console.error`.
78+
79+
## Create annotations
80+
81+
The following example creates an annotation:
82+
83+
```ts
84+
import { annotations } from '@axiomhq/js';
85+
86+
const client = new annotations.Service({ token: process.env.AXIOM_TOKEN });
87+
88+
await annotations.create({
89+
type: 'deployment',
90+
datasets: ['DATASET_NAME'],
91+
title: 'New deployment',
92+
description: 'Deployed version 1.0.0',
93+
})
94+
```
95+
96+
## Log from Node.js
97+
98+
While the Axiom JavaScript client works on both the backend and the browsers, Axiom provides transports for some of the popular loggers:
99+
100+
- [Pino](/guides/pino)
101+
- [Winston](/guides/winston)
102+

0 commit comments

Comments
 (0)