Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

trackRelease fails if git isn't available in the execution environment #27

Closed
jordaaash opened this issue Dec 9, 2015 · 1 comment
Closed
Labels

Comments

@jordaaash
Copy link

agent.trackRelease accepts a data parameter which is passed to getTracker which accepts an auto property as a default to actually use the rev option passed in rather than using git rev-parse: watson/opbeat-release-tracker@93342fc

Since the client argument is provided to getTracker but not the defaults argument, there is no way to provide this option to the release tracker, which means that the function throws an exception if executed on a server where the git executable or a parent .git isn't available.

Currently I am monkey patching this like so:

Opbeat.start({
    appId:          process.env.OPBEAT_SERVER_APP_ID,
    organizationId: process.env.OPBEAT_ORGANIZATION_ID,
    secretToken:    process.env.OPBEAT_SECRET_TOKEN
});

if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'staging') {
    // Hack defaults to prevent Opbeat from calling git
    Opbeat._httpClient.auto = false;

    Opbeat.trackRelease({ rev: process.env.GIT_COMMIT });
}

The server runs in Docker and doesn't have the project's git history. I populate GIT_COMMIT with Webpack's DefinePlugin at build time.

I'm happy to work on a PR for this in either project, but I wasn't sure if @watson would think it should be patched here or in opbeat-release-tracker. I have to say, having a defaults argument inside of a closure which acts to override the options argument passed into the actual function is a bit unintuitive. It seems semantically correct that options be merged with defaults and override them.

@watson
Copy link
Member

watson commented Jan 7, 2016

@jordansexton Thanks for reporting this. It's definitely an oversight on my part and the API could be better - so there's a lot of room for improvement. You're probably right that this should be fixed down the dependency graph as well - I'll fix this in the forthcoming release.

@watson watson added the bug label Feb 2, 2016
@watson watson closed this as completed in 4c4f478 Mar 30, 2017
watson added a commit that referenced this issue May 9, 2018
…n names (#27)

The operation name is included both in GraphQL trace names and in
GraphQL transaction names
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants