Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the correct way to set "user-agent" header? #1468

Closed
mayurkale22 opened this issue Dec 1, 2018 · 7 comments
Closed

What's the correct way to set "user-agent" header? #1468

mayurkale22 opened this issue Dec 1, 2018 · 7 comments
Assignees
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@mayurkale22
Copy link
Member

mayurkale22 commented Dec 1, 2018

Hello,

This is Mayur from OpenCensus team. Recently we've been working on adding the user-agent header to our Stackdriver Monitoring exporters for all languages. This allows Stackdriver Monitoring to group the uploaded metrics by different sources (e.g from OpenCensus vs. from other libraries), by looking at the value of the user-agent header.

This is my Pull Request : census-instrumentation/opencensus-node#214

Is this the correct way for setting headers?

@JustinBeckwith JustinBeckwith added triage me I really want to be triaged. type: question Request for information or clarification. Not an issue. and removed triage me I really want to be triaged. labels Dec 1, 2018
@mayurkale22
Copy link
Member Author

any update here?

@mayurkale22
Copy link
Member Author

Any advice would be appreciated...

@mayurkale22
Copy link
Member Author

any update here?

@JustinBeckwith JustinBeckwith self-assigned this Jan 20, 2019
@JustinBeckwith JustinBeckwith added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: question Request for information or clarification. Not an issue. labels Jan 20, 2019
@JustinBeckwith
Copy link
Contributor

The short answer is that today you can't. However - I have a PR over here that will add the ability to do it:
googleapis/nodejs-googleapis-common#76

Once that gets merged we'll cut a release, upgrade the version here, and then we'll be set :)

@crwilcox
Copy link

crwilcox commented Dec 6, 2019

@bcoe recommended the following to another user. It seems this should work.

const {google} = require('googleapis');
google.options({
  userAgentDirectives: [{product: 'frog', version: '1.0', comment: 'jumps'}]
});
const blogger = google.blogger({
  version: 'v3',
  // All requests made with this service client will contain the
  // blogId query parameter unless overridden in individual API calls.
  params: {
    blogId: 3213900
  }
});

@crwilcox crwilcox assigned crwilcox and unassigned JustinBeckwith Dec 6, 2019
@crwilcox
Copy link

crwilcox commented Dec 6, 2019

Closing for now since this seems more a question. Feel free to reach out further if needed though.

@crwilcox crwilcox closed this as completed Dec 6, 2019
@JustinBeckwith
Copy link
Contributor

👋 we did actually go do that work, and it's available now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants