DataDog / datadog-ci

Use Datadog from your CI.
https://datadoghq.com
Apache License 2.0
124 stars 54 forks source link

Upload sourcemaps via programatic API #192

Open TasukuUno opened 3 years ago

TasukuUno commented 3 years ago

Is your feature request related to a problem? Please describe:

Actually it is not a problem, but I would like to upload sourcemaps in build process by Webpack, not via CLI.

Describe the solution you'd like:

import path from 'path'
import { DataDogCli } from 'datadog-ci'

const datadog = new DataDogCli({ /* some account configurations */ })

datadog.sourcemaps.upload({
  dir: path.resolve(__dirname, 'build'),
  service: 'my-service',
  minifiedPathPrefix: 'https://static.datadog.com',
  release: '1.234',
}).then(() => {
  console.log('done')
})

// equivalent to:
// datadog-ci sourcemaps upload ./build \
//   --service my-service \
//   --minified-path-prefix https://static.datadog.com \
//   --release-version 1.234

Describe alternatives you've considered:

It would be better if you could also provide us webpack plugin, but I think this programatic API will be enough at first. (Someone will develop one as OSS 😄 )

Additional context:

benchmark: https://github.com/getsentry/sentry-webpack-plugin

At this moment our team is using datadog for server-side metrics, and sentry for client-side error tracking. So we would be happy to start easily to use datadog.

lraucy commented 3 years ago

Thank you for the suggestion! Indeed it looks like a nice improvement we'd like to work on at some point, we're discussing it with the team.

AndreJoaquim commented 3 years ago

Just came across this issue while searching for a way to programatically upload source maps :)

This would an amazing feature! My use case is uploading the source maps as part of an Ember.js' application deploy process using ember-cli-deploy.

broffis commented 2 years ago

This would also be really useful when working with github script actions. For something like that, I'd like to see the ability to pull the DATADOG_API_KEY from the repo secrets stored in github

DaveAllbirds commented 1 year ago

+1 please add an api. We aren't able to run as a CLI with our use case.