Skip to content

refactor: use @heroku/sdk for telemetry commands#3818

Merged
erika-wallace merged 5 commits into
v12.0.0from
ew/sdk-migration-telemetry
Jul 22, 2026
Merged

refactor: use @heroku/sdk for telemetry commands#3818
erika-wallace merged 5 commits into
v12.0.0from
ew/sdk-migration-telemetry

Conversation

@erika-wallace

@erika-wallace erika-wallace commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates the following telemetry commands commands to @heroku/sdk:

  • telemetry/add
  • telemetry/index
  • telemetry/info
  • telemetry/remove
  • telemetry/update

Details

  • telemetry/add: Migrated GET /apps/{app} call to platform.app.info(), GET /spaces/{space} call to platform.space.info(), and POST /telemetry-drains call to platform.telemetryDrain.create()
  • telemetry/index: Migrated GET /apps/{app}/telemetry-drains call to platform.telemetryDrain.listByApp() and GET /spaces/{space}/telemetry-drains call to platform.telemetryDrain.listBySpace()
  • telemetry/info: Migrated GET /telemetry-drains/{telemetry_drain_id} call to platform.telemetryDrain.info()
  • telemetry/remove: Migrated DELETE /telemetry-drains/{telemetry_drain_id} call to platform.telemetryDrain.delete(), and bulk app/space removal flow from GET + per-drain DELETE loops to platform.telemetryDrain.removeDrains({app|space})
  • telemetry/update: Migrated PATCH /telemetry-drains/{telemetry_drain_id} call to platform.telemetryDrain.update()
  • src/lib/telemetry/util.ts:
    • displayTelemetryDrain: Migrated owner lookup calls from GET /spaces/{id} and GET /apps/{id} to platform.space.info() and platform.app.info(). Replaced APIClient with HerokuSDK['platform']
    • validateAndFormatSignals: Updated the return type to match the expectations of TelemetryDrain.signals.

Type of Change

Breaking Changes (major semver update)

  • Add a ! after your change type to denote a change that breaks current behavior

Feature Additions (minor semver update)

  • feat: Introduces a new feature to the codebase

Patch Updates (patch semver update)

  • fix: Bug fix
  • deps: Dependency upgrade
  • revert: Revert a previous commit
  • chore: Change that does not affect production code
  • refactor: Refactoring existing code without changing behavior
  • test: Add/update/remove tests

Testing

Notes:

The SDK uses heroku-fetch to make API calls, which looks for a netrc file. Therefore, we must log in with HEROKU_NETRC_WRITE=true.

Requires a Fir app and Private Space that are used for testing. The following steps include destructive actions.

Steps:

  • Pull down this branch
  • npm i && npm run build
  • ./bin/run logout
  • HEROKU_NETRC_WRITE=true ./bin/run login

telemetry:add

  • ./bin/run telemetry:add https://logs.example.com --app APP
    • outputs "successfully added drain https://logs.example.com"
  • ./bin/run telemetry:add https://logs.example-two.com --space SPACE --signals logs --headers '{"x-honeycomb-team": "test-api-key", "x-honeycomb-dataset": "test-dataset"}' --transport grpc
    • outputs "successfully added drain https://logs.example-two.com"

telemetry (index/list)

  • ./bin/run telemetry --app APP
    • displays the new drain with
      • signals: traces, metrics, logs
      • endpoint: https://logs.example.com
  • ./bin/run telemetry --space SPACE
    • displays the new drain with
      • signals: logs
      • endpoint: https://logs.example-two.com

telemetry:info

  • ./bin/run telemetry:info APP_DRAIN_ID
    • === APP_DRAIN_ID
    • App: ⬢ APP
    • Signals: traces, metrics, logs
    • Endpoint: https://logs.example.com
    • Transport: HTTP
    • Headers: {}
  • ./bin/run telemetry:info SPACE_DRAIN_ID
    • === SPACE_DRAIN_ID
    • Space: ⬡ SPACE
    • Signals: logs
    • Endpoint: https://logs.example-two.com
    • Transport: gRPC
    • Headers: {"x-honeycomb-team": "test-api-key", "x-honeycomb-dataset": "test-dataset"}

telemetry:update

  • ./bin/run telemetry:update APP_DRAIN_ID --signals metrics --endpoint https://new-endpoint.example.com
    • outputs "Updating telemetry drain APP_DRAIN_ID... done"
    • displays updated drain
      • === APP_DRAIN_ID
      • App: ⬢ APP
      • Signals: metrics
      • Endpoint: https://new-endpoint.example.com
      • Transport: HTTP
      • Headers: {}
  • ./bin/run telemetry:update SPACE_DRAIN_ID --headers '{"x-honeycomb-team": "test-api-key", "x-honeycomb-dataset": "new-dataset"}' --transport http
    • outputs "Updating telemetry drain SPACE_DRAIN_ID... done"
    • displays updated drain
      • === SPACE_DRAIN_ID
      • Space: ⬡ SPACE
      • Signals: logs
      • Endpoint: https://logs.example-two.com
      • Transport: HTTP
      • Headers: {"x-honeycomb-team": "test-api-key", "x-honeycomb-dataset": "new-dataset"}

telemetry:remove

  • create additional drains to test batch deletion:
    • ./bin/run telemetry:add https://logs.example-three.com --app APP
    • ./bin/run telemetry:add https://logs.example-four.com --app APP
    • ./bin/run telemetry --app APP
      • lists new drains
    • ./bin/run telemetry:add https://logs.example-five.com --space SPACE
    • ./bin/run telemetry:add https://logs.example-six.com --space SPACE
    • ./bin/run telemetry --space SPACE
      • lists new drains
  • ./bin/run telemetry:remove APP_DRAIN_ID
    • outputs "Removing telemetry drain APP_DRAIN_ID... done"
  • ./bin/run telemetry --app APP
    • APP_DRAIN_ID no longer listed
  • ./bin/run telemetry:remove --app APP
    • outputs "Removing all telemetry drains from app APP... done"
  • ./bin/run telemetry --app APP
    • outputs "There are no telemetry drains in APP"
  • ./bin/run telemetry:remove SPACE_DRAIN_ID
    • outputs "Removing telemetry drain SPACE_DRAIN_ID... done"
  • ./bin/run telemetry --space SPACE
    • SPACE_DRAIN_ID no longer listed
  • ./bin/run telemetry:remove --space SPACE
    • outputs "Removing all telemetry drains from space SPACE... done"
  • ./bin/run telemetry --space SPACE
    • outputs "There are no telemetry drains in SPACE"

Cleanup:

  • ./bin/run logout

Screenshots (if applicable)

Related Issues

GUS work item: W-23374108

@erika-wallace
erika-wallace requested a review from a team as a code owner July 21, 2026 14:55
@erika-wallace
erika-wallace force-pushed the ew/sdk-migration-telemetry branch from 40764fa to 5a43f06 Compare July 22, 2026 15:07

@k80bowman k80bowman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just one non-blocking comment.

Comment thread src/lib/telemetry/util.ts
@erika-wallace
erika-wallace force-pushed the ew/sdk-migration-telemetry branch from 5a43f06 to b0fc43d Compare July 22, 2026 19:10
@erika-wallace
erika-wallace merged commit e8dcd4d into v12.0.0 Jul 22, 2026
17 checks passed
@erika-wallace
erika-wallace deleted the ew/sdk-migration-telemetry branch July 22, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants