Skip to content

Commit 1155247

Browse files
authored
Merge pull request #536 from segmentio/repo-sync
repo sync
2 parents b7e4622 + dbc2e3c commit 1155247

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/connections/functions/destination-functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ All functions are scoped to your workspace, so members of other workspaces can't
1313
> info ""
1414
> Functions is available to all customer plan types with a free allotment of usage hours. Read more about [Functions usage limits](/docs/connections/functions/usage/), or see [your workspace's Functions usage stats](https://app.segment.com/goto-my-workspace/settings/usage?metric=functions){:target="_blank"}.
1515
16-
![An illusrative graphic showing information flowing from the Segment app, into code, and then into Slack](images/destination_functions_overview.png)
16+
![An illustrative graphic showing information flowing from the Segment app, into code, and then into Slack](images/destination_functions_overview.png)
1717

1818

1919
> note ""
@@ -352,7 +352,7 @@ A function can throw errors, or Segment might encounter errors while invoking yo
352352
- **Bad Request** - Any error thrown by the function code that is not covered by the other errors.
353353
- **Invalid Settings** - A configuration error prevented Segment from executing your code. If this error persists for more than an hour, [contact Segment Support](https://segment.com/help/contact/){:target="_blank"}.
354354
- **Message Rejected** - Your code threw `InvalidEventPayload` or `ValidationError` due to invalid input.
355-
- **Unsupported Event Type** - Your code does not implement a specific event type (`onTrack()`, etc.) or threw a `EventNotSupported` error.
355+
- **Unsupported Event Type** - Your code doesn't implement a specific event type (for example, `onTrack()`) or threw a `EventNotSupported` error.
356356
- **Retry** - Your code threw `RetryError` indicating that the function should be retried.
357357

358358
Segment only attempts to send the event to your destination function again if a **Retry** error occurs.

src/connections/functions/environment.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ When you create a function, write code for it, and save it, the function appears
1515

1616
Only [Functions admins](#functions-permissions) can create or edit functions.
1717

18-
1. From your workspace, go to the Catalog and click the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog).
18+
1. From your workspace, go to the Catalog and click the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog){:target="_blank"}.
1919
2. Click **New Function**.
2020
3. Select the type of function you want to build, and click **Build**.
2121

@@ -24,7 +24,7 @@ Only [Functions admins](#functions-permissions) can create or edit functions.
2424
5. Once you finish writing your function, click **Configure** to give it a name.
2525
6. Click **Create Function** to save your work and make this function available in your workspace.
2626

27-
After you click **Create Function**, the function appears on the [Functions catalog page](https://app.segment.com/goto-my-workspace/functions/catalog/) in your workspace.
27+
After you click **Create Function**, the function appears on the [Functions catalog page](https://app.segment.com/goto-my-workspace/functions/catalog/){:target="_blank"} in your workspace.
2828

2929

3030
## Editing a function
@@ -40,7 +40,7 @@ You can also choose to **Save & Deploy** to push changes to all, or specific fun
4040
> note ""
4141
> You must be a **Workspace Owner** or **Source Admin** to connect an instance of your function in your workspace.
4242
43-
1. From the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog), locate the source function you want to deploy.
43+
1. From the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog){:target="_blank"}, locate the source function you want to deploy.
4444
2. Click **Connect Source** and follow the prompts to configure the source. (You can access these settings later by navigating to the Source Settings page for your source function.)
4545
3. Locate the webhook URL for the source, either on the **Overview** or **Settings → Endpoint** page.
4646
4. Copy this URL and paste it into the upstream tool or service.

src/connections/functions/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Functions let you create your own sources and destinations directly within your
77
> info ""
88
> Functions is available to all customer plan types with a free allotment of usage hours. Read more about [Functions usage limits](/docs/connections/functions/usage/), or see [your workspace's Functions usage stats](https://app.segment.com/goto-my-workspace/settings/usage?metric=functions).
99
10-
![](images/functions_overview.png)
10+
![An image illustrating source functions and destination functions in a Segment workspace](images/functions_overview.png)
1111

1212
## What can you do with Functions?
1313
Functions can help you bring external data into Segment ([Source Functions](/docs/connections/functions/source-functions)) and send data in Segment out to external destinations ([Destination Functions](/docs/connections/functions/destination-functions)). Functions are scoped to your specific workspace. If you're a technology partner and want to build a new integration and publish it in Segment's catalog, see the [Developer Center documentation](/docs/partners/).

src/connections/functions/source-functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,9 @@ Segment.set({
254254

255255
The `Segment.set()` method accepts an object with the following fields:
256256

257-
- `collection` - Collection name.
258-
- `id` - Object's unique identifier.
259-
- `properties` - Object with free-form data.
257+
- `collection` - A collection name, which must be lowercase.
258+
- `id` - An object's unique identifier.
259+
- `properties` - An object with free-form data.
260260

261261
> warning ""
262262
> When you use the `set()` method, you won't see events in the Source Debugger. Segment only sends events to connected warehouses.

src/connections/functions/usage.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ Functions are billed to your account using the total execution time per month.
66

77
An **individual function's execution time** is the total time it takes for the function to process events, including mapping, transformations, and requests to external APIs. Generally, requests to external APIs can greatly add to your total execution time.
88

9-
Your **total execution time** is the execution time for all of your active functions accumulated over the course of a month. You can see your current execution time on the [Functions tab of the Usage page](https://app.segment.com/goto-my-workspace/settings/usage?metric=functions&period=current) in each workspace. You will receive notifications of your usage when you've reached 75%, 90% and 100% of your allotted execution time.
9+
Your **total execution time** is the execution time for all of your active functions accumulated over the course of a month. You can see your current execution time on the [Functions tab of the Usage page](https://app.segment.com/goto-my-workspace/settings/usage?metric=functions&period=current){:target="_blank"} in each workspace. You will receive notifications of your usage when you've reached 75%, 90%, and 100% of your allotted execution time.
1010

11-
The amount of time you are allotted changes depending on your [Segment pricing plan](http://segment.com/pricing).
11+
The amount of time you are allotted changes depending on your [Segment pricing plan](http://segment.com/pricing){:target="_blank"}.
1212

1313
## Measuring execution time
1414

15-
We measure execution time from when the function first receives an event to the time the function either returns successfully or throws an error. If Segment retries your function (for example, if there was a timeout), those retries also count as billable execution time.
15+
Segment measures execution time from when the function first receives an event to the time the function either returns successfully or throws an error. If Segment retries your function (for example, if there was a timeout), those retries also count as billable execution time.
1616

17-
Starting on April 8, 2021 Functions usage is measured in millisecond increments. This makes your usage and billing much more precise. Prior to this change, Functions was measured in 100ms increments, and then rounded up. For example, a function that took 80ms to complete was previously billed as 100ms. Using the new usage calculation, it is billed as 80ms.
17+
Starting on April 8, 2021 Functions usage is measured in millisecond increments. This makes your usage and billing much more precise. Prior to this change, Functions was measured in 100ms increments, and then rounded up. For example, a function that took 80ms to complete was previously billed as 100ms. Using the new usage calculation, it is billed as 80ms.
1818

1919
## Execution timeouts
2020

21-
Functions have a timeout of 5 seconds. If a function takes longer than 5 seconds, execution halts and the function is retried periodically for up to 4 hours.
21+
Functions have a timeout of five seconds. If a function takes longer than five seconds, execution halts and the function is retried periodically for up to four hours.
2222

2323

2424

@@ -40,15 +40,15 @@ You can (and should!) use [Destination Filters](/docs/connections/destinations/d
4040

4141
In the most cases, functions are slow due to external requests using the `fetch()` call. The external API may be under heavy load or it may simply take a long time to process your request.
4242

43-
If you're making many requests that could be done in parallel, ensure that you're not doing them sequentially. If the external API takes 400ms to respond and you issue 10 requests, it would take 4 seconds to do them sequentially versus 400ms to do them in parallel. For example, if you're waiting for requests to complete inside of a loop you're making your requests sequentially:
43+
If you're making many requests that could be done in parallel, ensure that you're not doing them sequentially. If the external API takes 400ms to respond and you issue 10 requests, it would take four seconds to do them sequentially versus 400ms to do them in parallel. For example, if you're waiting for requests to complete inside of a loop you're making your requests sequentially:
4444

4545
```js
4646
for (const objectId of event.properties.objects) {
4747
const response = await fetch('https://example.com/?id=' + objectId, {
4848
method: 'POST',
4949
body: event.properties
5050
})
51-
51+
5252
console.log(response.json())
5353
}
5454
```

0 commit comments

Comments
 (0)