opentelemetry-dotnet: Don't record child activities

I am trying to create an instrumentation for the Elasticsearch.Net client. Internally, it’s using HttpClient. I’d like to only record the Elasticsearch call and the details about it and have it show up as a db.system of type elasticsearch. I’ve got that much working, but the problem is that it’s also recording the internal HttpClient call. Is there some way I can cancel recording all child activities after starting the Elasticsearch call activity so that it won’t capture the HttpClient call? I know that I can provide a filter function for the HttpClient instrumentation, but I was really hoping to not have to do that.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 18 (17 by maintainers)

Most upvoted comments

Given I have done this several times in different languages, I won’t be afraid to do it again in this repo 😄 If I got enough 👍 I am happy to send a small PR on this:

  1. I think we can do this in the OpenTelemetry API/SDK.
  2. I think it is unlikely to get this in the spec before GA, but we can try.
  3. I don’t think we should/can push .NET to make this as part of the .NET framework API.

@rajkumar-rangaraj is working to make this configurage in gRPC client instrumentation. Once done we can review it and make it the recommendation for every instrumentation authors.

I’ve been harping on this since November! Glad to see everyone finally coming on board 🤣

I’ve added this to OpenCensus 3 years ago and still having trouble today convincing people it is important 😄

@cijothomas is this duplicated with #809 or a different thing?

Related, yes. But not exact duplicate. 809 is for users to filter early. This issue if more for InstrumentationLibrary authors.