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

External Services shows up as "unknown" if no Request is provided. #33

Closed
klauspost opened this issue Dec 20, 2016 · 2 comments
Closed

Comments

@klauspost
Copy link

It seems like "External Services" does not use the URL provided if Request is not set:

Simplified usage:

func BenchExternal(ctx context.Context, host string, f func()) {
	tx := newRelicTx(ctx)
	defer newrelic.ExternalSegment{
		StartTime: newrelic.StartSegmentNow(tx),
		URL:       host,
	}.End()
	f()

I know this isn't the recommended way of doing external segments, but when using API packages that is commonly what we have available. The URL field states:

	// If you do not have access to the request, this URL field should be
	// used to indicate the endpoint.
	URL string

In New Relic these all show up as "External service: unknown" when using "abc.def.com" for instance. Are there special requirements we need to fulfill for this field to be transferred?

@willnewrelic
Copy link

Hi Klaus

If the URL field is populated, the host is parsed out using the standard library's url.Parse. This function requires the http:// protocol to be present. relevant code. Due to your example "abc.def.com" which does not have a protocol, I'm guessing this is the problem?

This requirement should be better documented. I will fix that for the next release.

@willnewrelic
Copy link

1.6.0 released with the following documentation added to ExternalSegment.URL:

"NOTE: If non-empty, this field is parsed using url.Parse and therefore it MUST include the protocol (eg. "http://")".

I hope this helps!

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

No branches or pull requests

2 participants