Skip to content

Commit 4bfc848

Browse files
docs: update README with env and service_name examples
- Add env to all usage examples (now required) - Add service_name to relevant examples - Update inputs table with new fields - Add APM correlation section explaining service_name and env - Add monorepo example - Fix custom_attributes examples Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6ecb6de commit 4bfc848

File tree

1 file changed

+52
-13
lines changed

1 file changed

+52
-13
lines changed

README.md

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Add this step to your workflow after deployment:
2323
with:
2424
refresh_token: ${{ secrets.LAST9_REFRESH_TOKEN }}
2525
org_slug: 'your-org-slug'
26+
env: production
2627
```
2728
2829
### Track Both Start and Stop Events
@@ -40,6 +41,7 @@ jobs:
4041
with:
4142
refresh_token: ${{ secrets.LAST9_REFRESH_TOKEN }}
4243
org_slug: 'your-org-slug'
44+
env: production
4345
event_state: 'start'
4446

4547
- name: Deploy application
@@ -53,9 +55,24 @@ jobs:
5355
with:
5456
refresh_token: ${{ secrets.LAST9_REFRESH_TOKEN }}
5557
org_slug: 'your-org-slug'
58+
env: production
5659
event_state: 'stop'
5760
```
5861
62+
### With Explicit Service Name
63+
64+
For monorepos or repos with multiple services, override the default service name:
65+
66+
```yaml
67+
- name: Mark deployment
68+
uses: last9/deployment-marker-action@v1
69+
with:
70+
refresh_token: ${{ secrets.LAST9_REFRESH_TOKEN }}
71+
org_slug: 'your-org-slug'
72+
service_name: 'payment-service'
73+
env: production
74+
```
75+
5976
### With Custom Attributes
6077
6178
```yaml
@@ -64,11 +81,10 @@ jobs:
6481
with:
6582
refresh_token: ${{ secrets.LAST9_REFRESH_TOKEN }}
6683
org_slug: 'your-org-slug'
84+
env: production
6785
custom_attributes: |
6886
{
69-
"environment": "production",
7087
"version": "${{ github.ref_name }}",
71-
"service": "api-server",
7288
"team": "platform"
7389
}
7490
```
@@ -79,12 +95,14 @@ jobs:
7995
|-------|----------|---------|-------------|
8096
| `refresh_token` | **Yes** | - | Last9 API refresh token (store in GitHub Secrets) |
8197
| `org_slug` | **Yes** | - | Your Last9 organization slug |
82-
| `api_base_url` | No | `https://app.last9.io` | Last9 API base URL |
83-
| `event_name` | No | `deployment` | Name for the deployment event |
98+
| `env` | **Yes** | - | Deployment environment (e.g. `production`, `staging`). Must match your APM environment label exactly. |
99+
| `service_name` | No | Repository name | Service name for APM correlation. Must match your APM service name exactly. |
84100
| `event_state` | No | `stop` | Event state: `start`, `stop`, or `both` |
101+
| `event_name` | No | `deployment` | Name for the deployment event |
85102
| `data_source_name` | No | - | Last9 cluster/data source name |
103+
| `api_base_url` | No | `https://app.last9.io` | Last9 API base URL |
86104
| `include_github_attributes` | No | `true` | Include GitHub context attributes |
87-
| `custom_attributes` | No | - | Custom attributes as JSON object |
105+
| `custom_attributes` | No | - | Additional attributes as JSON object |
88106
| `max_retry_attempts` | No | `3` | Maximum number of retry attempts |
89107
| `retry_backoff_ms` | No | `1000` | Initial retry backoff in milliseconds |
90108
| `max_retry_backoff_ms` | No | `30000` | Maximum retry backoff in milliseconds |
@@ -143,12 +161,22 @@ For more information, see the [Last9 API documentation](https://last9.io/docs/ge
143161

144162
See [Usage](#usage) examples above.
145163

164+
## APM Dashboard Correlation
165+
166+
The `service_name` and `env` attributes must match your APM service labels **exactly** for deployment markers to appear as overlays on Last9 dashboards.
167+
168+
- `service_name`: defaults to the repository name if not set
169+
- `env`: must be provided explicitly (e.g. `production`, `staging`)
170+
171+
When they match, deployment markers appear as red vertical lines on your APM charts, making it easy to correlate deployments with changes in latency, error rate, and throughput.
172+
146173
## GitHub Context Attributes
147174

148175
When `include_github_attributes` is `true` (default), the following attributes are automatically included:
149176

150177
- `repository` - Repository full name (e.g., `owner/repo`)
151-
- `service_name` - Repository name (e.g., `repo`)
178+
- `service_name` - From `service_name` input (defaults to repo name)
179+
- `env` - From `env` input
152180
- `workflow` - Workflow name
153181
- `run_id` - Workflow run ID
154182
- `run_number` - Workflow run number
@@ -172,6 +200,7 @@ To prevent deployment failures from blocking your workflow, set `if: always()`:
172200
with:
173201
refresh_token: ${{ secrets.LAST9_REFRESH_TOKEN }}
174202
org_slug: 'your-org-slug'
203+
env: production
175204
```
176205

177206
## Troubleshooting
@@ -213,13 +242,9 @@ jobs:
213242
with:
214243
refresh_token: ${{ secrets.LAST9_REFRESH_TOKEN }}
215244
org_slug: 'acme'
245+
service_name: 'api'
246+
env: production
216247
event_state: 'start'
217-
custom_attributes: |
218-
{
219-
"environment": "production",
220-
"namespace": "default",
221-
"service": "api"
222-
}
223248
224249
- name: Deploy to Kubernetes
225250
run: kubectl apply -f k8s/
@@ -230,6 +255,8 @@ jobs:
230255
with:
231256
refresh_token: ${{ secrets.LAST9_REFRESH_TOKEN }}
232257
org_slug: 'acme'
258+
service_name: 'api'
259+
env: production
233260
event_state: 'stop'
234261
```
235262

@@ -264,13 +291,25 @@ jobs:
264291
with:
265292
refresh_token: ${{ secrets.LAST9_REFRESH_TOKEN }}
266293
org_slug: 'acme'
294+
env: ${{ inputs.environment }}
267295
custom_attributes: |
268296
{
269-
"environment": "${{ inputs.environment }}",
270297
"version": "${{ github.sha }}"
271298
}
272299
```
273300

301+
### Monorepo with Multiple Services
302+
303+
```yaml
304+
- name: Mark payment-service deployment
305+
uses: last9/deployment-marker-action@v1
306+
with:
307+
refresh_token: ${{ secrets.LAST9_REFRESH_TOKEN }}
308+
org_slug: 'acme'
309+
service_name: 'payment-service'
310+
env: production
311+
```
312+
274313
## Contributing
275314

276315
Contributions are welcome! Please open an issue or pull request.

0 commit comments

Comments
 (0)