Skip to content

Commit bc28b76

Browse files
authored
Standardise use of placeholders (#161)
1 parent a476dd5 commit bc28b76

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+303
-213
lines changed

apps/cloudflare-workers.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tags:
77
---
88

99
import Prerequisites from "/snippets/standard-prerequisites.mdx"
10-
import Replacement from "/snippets/standard-replacement.mdx"
10+
import ReplaceDatasetToken from "/snippets/replace-dataset-token.mdx"
1111

1212
The Axiom Cloudflare Workers app provides granular detail about the traffic coming in from your monitored sites. This includes edge requests, static resources, client auth, response duration, and status. Axiom gives you an all-at-once view of key Cloudflare Workers metrics and logs, out of the box, with our dynamic Cloudflare Workers dashboard.
1313

@@ -34,7 +34,7 @@ Axiom Cloudflare Workers is an open-source project and welcomes your contributio
3434
const axiomToken = "API_TOKEN"
3535
```
3636

37-
<Replacement />
37+
<ReplaceDatasetToken />
3838

3939
1. Add triggers for the worker. For example, add a route trigger using the [Cloudflare documentation](https://developers.cloudflare.com/workers/configuration/routing/routes/#set-up-a-route-in-the-dashboard).
4040

guides/javascript.mdx

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ popularityOrder: 8
1111
---
1212

1313
import Prerequisites from "/snippets/standard-prerequisites.mdx"
14-
import Replacement from "/snippets/api-token-replacement.mdx"
14+
import ReplaceDataset from "/snippets/replace-dataset.mdx"
1515

1616
JavaScript is a versatile, high-level programming language primarily used for creating dynamic and interactive web content.
1717

@@ -66,8 +66,6 @@ Configure the environment variables in one of the following ways:
6666
});
6767
```
6868

69-
<Replacement />
70-
7169
- Install the [Axiom CLI](/reference/cli), and then run the following command:
7270

7371
```sh
@@ -83,6 +81,8 @@ axiom.ingest('DATASET_NAME', [{ foo: 'bar' }]);
8381
await axiom.flush();
8482
```
8583

84+
<ReplaceDataset />
85+
8686
The client automatically batches events in the background. In most cases, call `flush()` only before your application exits.
8787

8888
### Query data
@@ -94,6 +94,8 @@ const res = await axiom.query(`['DATASET_NAME'] | where foo == 'bar' | limit 100
9494
console.log(res);
9595
```
9696

97+
<ReplaceDataset />
98+
9799
For more examples, see the [examples in GitHub](https://github.com/axiomhq/axiom-js/tree/main/examples).
98100

99101
### Capture errors
@@ -163,8 +165,6 @@ const logger = new Logger(
163165
logger.info("Hello, world!");
164166
```
165167

166-
<Replacement />
167-
168168
#### Transports
169169

170170
The `@axiomhq/logging` library includes the following transports:

guides/opentelemetry-cloudflare-workers.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ main = "index.ts"
8686

8787
# Define environment variables here
8888
[vars]
89-
AXIOM_API_TOKEN = "$API_TOKEN" # Replace $API_TOKEN with your actual Axiom API token
90-
AXIOM_DATASET = "$DATASET" # Replace $DATASET with your actual Axiom dataset name
89+
AXIOM_API_TOKEN = "API_TOKEN" # Replace API_TOKEN with your actual Axiom API token
90+
AXIOM_DATASET = "DATASET_NAME" # Replace DATASET_NAME with your actual Axiom dataset name
9191
```
9292
9393
## Install Dependencies

guides/opentelemetry-django.mdx

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ provider = TracerProvider(resource=resource)
117117
otlp_exporter = OTLPSpanExporter(
118118
endpoint="https://api.axiom.co/v1/traces",
119119
headers={
120-
"Authorization": "Bearer YOUR_API_TOKEN", # Replace with your actual API token
121-
"X-Axiom-Dataset": "YOUR_DATASET_NAME" # Replace with your dataset name
120+
"Authorization": "Bearer API_TOKEN", # Replace with your actual API token
121+
"X-Axiom-Dataset": "DATASET_NAME" # Replace with your dataset name
122122
}
123123
)
124124

@@ -222,7 +222,7 @@ def configure_opentelemetry():
222222
trace.set_tracer_provider(TracerProvider(resource=resource))
223223
otlp_exporter = OTLPSpanExporter(
224224
endpoint="https://api.axiom.co/v1/traces",
225-
headers={"Authorization": "Bearer YOUR_API_TOKEN", "X-Axiom-Dataset": "YOUR_DATASET_NAME"}
225+
headers={"Authorization": "Bearer API_TOKEN", "X-Axiom-Dataset": "DATASET_NAME"}
226226
)
227227
span_processor = BatchSpanProcessor(otlp_exporter)
228228
trace.get_tracer_provider().add_span_processor(span_processor)
@@ -308,7 +308,7 @@ def configure_opentelemetry():
308308
trace.set_tracer_provider(TracerProvider(resource=resource))
309309
otlp_exporter = OTLPSpanExporter(
310310
endpoint="https://api.axiom.co/v1/traces",
311-
headers={"Authorization": "Bearer YOUR_API_TOKEN", "X-Axiom-Dataset": "YOUR_DATASET_NAME"}
311+
headers={"Authorization": "Bearer API_TOKEN", "X-Axiom-Dataset": "DATASET_NAME"}
312312
)
313313
span_processor = BatchSpanProcessor(otlp_exporter)
314314
trace.get_tracer_provider().add_span_processor(span_processor)

guides/opentelemetry-dotnet.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ Sdk.CreateTracerProviderBuilder()
255255
.AddOtlpExporter(options =>
256256
{
257257
options.Endpoint = new Uri("https://api.axiom.co/v1/traces");
258-
// Ensure to replace YOUR_API_TOKEN and YOUR_DATASET_NAME with your actual API token and dataset name
259-
options.Headers = $"Authorization=Bearer YOUR_API_TOKEN, X-Axiom-Dataset=YOUR_DATASET_NAME";
258+
// Replace API_TOKEN and DATASET_NAME with your actual API token and dataset name
259+
options.Headers = $"Authorization=Bearer API_TOKEN, X-Axiom-Dataset=DATASET_NAME";
260260
})
261261
.Build();
262262
```

guides/opentelemetry-go.mdx

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ tags: ['guides', 'golang', 'go', 'otel', 'opentelemetry']
77
logoId: 'openTelemetry'
88
---
99

10+
import ReplaceDatasetToken from "/snippets/replace-dataset-token.mdx"
11+
1012
OpenTelemetry offers a [single set of APIs and libraries](https://opentelemetry.io/docs/languages/go/instrumentation/) that standardize how you collect and transfer telemetry data. This guide focuses on setting up OpenTelemetry in a Go app to send traces to Axiom.
1113

1214
## Prerequisites
@@ -222,7 +224,7 @@ const (
222224
serviceName = "axiom-go-otel" // Name of the service for tracing.
223225
serviceVersion = "0.1.0" // Version of the service.
224226
otlpEndpoint = "api.axiom.co" // OTLP collector endpoint.
225-
bearerToken = "Bearer $API_TOKEN" // Authorization token.
227+
bearerToken = "Bearer API_TOKEN" // Authorization token.
226228
deploymentEnvironment = "production" // Deployment environment.
227229
)
228230

@@ -247,7 +249,7 @@ func InstallExportPipeline(ctx context.Context) (func(context.Context) error, er
247249
otlptracehttp.WithEndpoint(otlpEndpoint),
248250
otlptracehttp.WithHeaders(map[string]string{
249251
"Authorization": bearerToken,
250-
"X-AXIOM-DATASET": "$DATASET_NAME",
252+
"X-AXIOM-DATASET": "DATASET_NAME",
251253
}),
252254
otlptracehttp.WithTLSClientConfig(&tls.Config{}),
253255
)
@@ -272,6 +274,8 @@ func InstallExportPipeline(ctx context.Context) (func(context.Context) error, er
272274
}
273275
```
274276

277+
<ReplaceDatasetToken />
278+
275279
## Run the app
276280

277281
To run the app, execute both `exporter.go` and `main.go`. Use the command `go run main.go exporter.go` to start the app. Once your app is running, traces collected by your app are exported to Axiom. The server starts on the specified port, and you can interact with it by sending requests to the `/rolldice` endpoint.

guides/opentelemetry-java.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ logoId: 'openTelemetry'
88
---
99

1010
import Prerequisites from "/snippets/standard-prerequisites.mdx"
11-
import Replacement from "/snippets/standard-replacement.mdx"
11+
import ReplaceDatasetToken from "/snippets/replace-dataset-token.mdx"
1212

1313
OpenTelemetry provides a unified approach to collecting telemetry data from your Java applications. This page demonstrates how to configure OpenTelemetry in a Java app to send telemetry data to Axiom using the OpenTelemetry SDK.
1414

@@ -144,7 +144,7 @@ public class OtelConfiguration {
144144
}
145145
```
146146

147-
<Replacement />
147+
<ReplaceDatasetToken />
148148

149149
## Configure project
150150

guides/opentelemetry-nextjs.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ export function register() {
293293
url: 'https://api.axiom.co/v1/traces',
294294
headers: {
295295
Authorization: `Bearer ${process.env.API_TOKEN}`,
296-
'X-Axiom-Dataset': `${process.env.DATASET_NAME_NAME}`,
296+
'X-Axiom-Dataset': `${process.env.DATASET_NAME}`,
297297
},
298298
})
299299
),

guides/opentelemetry-nodejs.mdx

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ tags: ['guides', 'nodejs', 'typescript', 'javascript', 'js', 'ts', 'otel', 'open
77
logoId: 'openTelemetry'
88
---
99

10+
import ReplaceDatasetToken from "/snippets/replace-dataset-token.mdx"
11+
1012
OpenTelemetry provides a [unified approach to collecting telemetry data](https://opentelemetry.io/docs/languages/js/instrumentation/) from your Node.js and TypeScript apps. This guide demonstrates how to configure OpenTelemetry in a Node.js app to send telemetry data to Axiom using OpenTelemetry SDK.
1113

1214
## Prerequisites
@@ -110,8 +112,8 @@ import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'
110112
const traceExporter = new OTLPTraceExporter({
111113
url: 'https://api.axiom.co/v1/traces',
112114
headers: {
113-
'Authorization': 'Bearer $API_TOKEN',
114-
'X-Axiom-Dataset': '$DATASET'
115+
'Authorization': 'Bearer API_TOKEN',
116+
'X-Axiom-Dataset': 'DATASET_NAME'
115117
},
116118
});
117119

@@ -136,6 +138,8 @@ const sdk = new NodeSDK({
136138
sdk.start();
137139
```
138140

141+
<ReplaceDatasetToken />
142+
139143
## Installing the Dependencies
140144

141145
Navigate to the root directory of your project and run the following command to install the required dependencies:

guides/send-logs-from-apache-log4j.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ enlargeLogo: true
99
---
1010

1111
import Prerequisites from "/snippets/standard-prerequisites.mdx"
12-
import Replacement from "/snippets/standard-replacement.mdx"
12+
import ReplaceDatasetToken from "/snippets/replace-dataset-token.mdx"
1313

1414
Log4j is a Java logging framework developed by the Apache Software Foundation and widely used in the Java community. This page covers how to get started with Log4j, configure it to forward log messages to Fluentd, and send logs to Axiom.
1515

@@ -369,7 +369,7 @@ To configure Fluentd, create a configuration file. Create a new file named `flue
369369
</match>
370370
```
371371

372-
<Replacement />
372+
<ReplaceDatasetToken />
373373

374374
This configuration does the following:
375375

guides/send-logs-from-laravel.mdx

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ tags: ['guides', 'laravel', 'php']
77
logoId: 'laravel'
88
---
99

10+
import ReplaceDatasetToken from "/snippets/replace-dataset-token.mdx"
11+
1012
This guide explains integrating Axiom as a logging solution in a Laravel app. Using Axiom’s capabilities with a custom log channel, you can efficiently send your app’s logs to Axiom for storage, analysis, and monitoring. This integration uses Monolog, Laravel’s underlying logging library, to create a custom logging handler that forwards logs to Axiom.
1113

1214
## Prerequisites
@@ -130,12 +132,14 @@ The `default` configuration specifies the primary channel Laravel uses for loggi
130132

131133
```bash
132134
LOG_CHANNEL=axiom
133-
AXIOM_API_TOKEN=$API_TOKEN
134-
AXIOM_DATASET=$DATASET
135+
AXIOM_API_TOKEN=API_TOKEN
136+
AXIOM_DATASET=DATASET_NAME
135137
LOG_LEVEL=debug
136138
LOG_DEPRECATIONS_CHANNEL=null
137139
```
138140

141+
<ReplaceDatasetToken />
142+
139143
### Deprecations log channel
140144

141145
The `deprecations` channel is configured to handle logs about deprecated features in PHP and libraries, helping you prepare for updates. By default, it’s set to ignore these warnings, but you can adjust this to direct deprecation logs to a specific channel if needed.

guides/send-logs-from-ruby-on-rails.mdx

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ tags: ['guides', 'ruby on rails', 'faraday']
77
logoId: 'ruby'
88
---
99

10+
import ReplaceDatasetToken from "/snippets/replace-dataset-token.mdx"
11+
1012
This guide provides step-by-step instructions on how to send logs from a Ruby on Rails application to Axiom using the Faraday library. By following this guide, you configure your Rails app to send logs to Axiom, allowing you to monitor and analyze your application logs effectively.
1113

1214
## Prerequisites
@@ -48,7 +50,7 @@ require 'json'
4850
class AxiomLogger
4951
def self.send_log(log_data)
5052
dataset_name = "DATASET_NAME"
51-
axiom_ingest_api_url = "https://api.axiom.co/v1/datasets/#{dataset_name}/ingest"
53+
axiom_ingest_api_url = "https://api.axiom.co/v1/datasets/DATASET_NAME/ingest"
5254
ingest_token = "API_TOKEN"
5355

5456
conn = Faraday.new(url: axiom_ingest_api_url) do |faraday|
@@ -75,8 +77,7 @@ end
7577

7678
In the code above, make the following changes:
7779

78-
- Replace `API_TOKEN` with your Axiom API key.
79-
- Replace `DATASET_NAME` with the name of the Axiom dataset where you want to send data.
80+
<ReplaceDatasetToken />
8081

8182
## Test with the Axiom logger
8283

guides/winston.mdx

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ tags: ['js', 'pino', 'winston', 'node', 'javascript', 'typescript', 'ts']
77
logoId: 'winston'
88
---
99

10+
import ReplaceDatasetToken from "/snippets/replace-dataset-token.mdx"
1011
import Prerequisites from "/snippets/standard-prerequisites.mdx"
1112

1213
<Prerequisites />
@@ -36,13 +37,15 @@ const logger = winston.createLogger({
3637
// You can pass an option here. If you don’t, the transport is configured automatically
3738
// using environment variables like `AXIOM_DATASET` and `AXIOM_TOKEN`
3839
new AxiomTransport({
39-
dataset: 'my-dataset',
40-
token: 'my-token',
40+
dataset: 'DATASET_NAME',
41+
token: 'API_TOKEN',
4142
}),
4243
],
4344
});
4445
```
4546

47+
<ReplaceDatasetToken />
48+
4649
After setting up the Axiom transport for Winston, use the logger as usual:
4750

4851
```js

restapi/endpoints/deleteDataset.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Delete dataset
3-
openapi: "v1 delete /datasets/{id}"
3+
openapi: "v1 delete /datasets/{dataset_name}"
44
---

restapi/endpoints/getDataset.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Retrieve dataset
3-
openapi: "v1 get /datasets/{id}"
3+
openapi: "v1 get /datasets/{dataset_name}"
44
---
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Ingest data
3-
openapi: "v1 post /datasets/{id}/ingest"
3+
openapi: "v1 post /datasets/{dataset_name}/ingest"
44
---

restapi/endpoints/queryDataset.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Run query (legacy)
3-
openapi: "v1 post /datasets/{id}/query"
3+
openapi: "v1 post /datasets/{dataset_name}/query"
44
---

restapi/endpoints/trimDataset.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Trim dataset
3-
openapi: "v1 post /datasets/{id}/trim"
3+
openapi: "v1 post /datasets/{dataset_name}/trim"
44
---

restapi/endpoints/updateDataset.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Update dataset
3-
openapi: "v1 put /datasets/{id}"
3+
openapi: "v1 put /datasets/{dataset_name}"
44
---

restapi/ingest.mdx

+8-8
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ The following example request contains grouped events. The structure of the `JSO
5959
### Example Request using JSON
6060

6161
```bash
62-
curl -X 'POST' 'https://api.axiom.co/v1/datasets/$DATASET_NAME/ingest' \
63-
-H 'Authorization: Bearer $API_TOKEN' \
62+
curl -X 'POST' 'https://api.axiom.co/v1/datasets/{dataset_name}/ingest' \
63+
-H 'Authorization: Bearer API_TOKEN' \
6464
-H 'Content-Type: application/json' \
6565
-d '[
6666
{
@@ -92,8 +92,8 @@ A successful POST Request returns a `200` response code JSON with details:
9292
### Example Request using Nested Arrays
9393

9494
```bash
95-
curl -X 'POST' 'https://api.axiom.co/v1/datasets/$DATASET_NAME/ingest' \
96-
-H 'Authorization: Bearer $API_TOKEN' \
95+
curl -X 'POST' 'https://api.axiom.co/v1/datasets/{dataset_name}/ingest' \
96+
-H 'Authorization: Bearer API_TOKEN' \
9797
-H 'Content-Type: application/json' \
9898
-d '[
9999
{
@@ -155,8 +155,8 @@ A successful POST Request returns a `200` response code JSON with details:
155155
### Example Request using Objects, Strings, and Arrays
156156

157157
```bash
158-
curl -X 'POST' 'https://api.axiom.co/v1/datasets/$DATASET_NAME/ingest' \
159-
-H 'Authorization: Bearer $API_TOKEN' \
158+
curl -X 'POST' 'https://api.axiom.co/v1/datasets/{dataset_name}/ingest' \
159+
-H 'Authorization: Bearer API_TOKEN' \
160160
-H 'Content-Type: application/json' \
161161
-d '[{ "axiom": {
162162
"logging": {
@@ -213,8 +213,8 @@ The following example request contains events. The structure of the `CSV` payloa
213213
### Example Request using CSV
214214

215215
```bash
216-
curl -X 'POST' 'https://api.axiom.co/v1/datasets/$DATASET_NAME/ingest' \
217-
-H 'Authorization: Bearer $API_TOKEN' \
216+
curl -X 'POST' 'https://api.axiom.co/v1/datasets/{dataset_name}/ingest' \
217+
-H 'Authorization: Bearer API_TOKEN' \
218218
-H 'Content-Type: text/csv' \
219219
-d 'user, name
220220
foo, bar'

0 commit comments

Comments
 (0)