# Creating a traceparent header in the .net agent

**URL:** <https://discuss.elastic.co/t/creating-a-traceparent-header-in-the-net-agent/338402>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [July 14, 2023, 10:42am UTC](https://discuss.elastic.co/t/creating-a-traceparent-header-in-the-net-agent/338402 "2023-07-14T10:42:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![csurfleet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/csurfleet/32/123446_2.png) [@csurfleet](https://discuss.elastic.co/u/csurfleet)\
**Post date:** [July 14, 2023, 10:42am UTC](https://discuss.elastic.co/t/creating-a-traceparent-header-in-the-net-agent/338402/1 "2023-07-14T10:42:31Z")

</div>

I have some .net core APIs with APM enabled. They are taking requests and when making sub-calls to other APIs is attaching various trace data such as trace.id, transaction.id, transaction.span\_count etc, but traceparent isn't one of them. This means that our services never get connected together in the service map, and we get duplication of items (e.g. a service in our services list is also shown as dependency - APM doesn't recognise them as the same thing)

We will often get transactions starting like this - with no UI being involved and an external system triggering an endpoint, so I need to find a way of creating traceparent items if they aren't provided and injecting to the APM settings somehow?

I'm on the lastest version of the .net core agent (1.22.0) and we're pushing to elastic cloud

Thanks!

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [July 17, 2023, 9:54am UTC](https://discuss.elastic.co/t/creating-a-traceparent-header-in-the-net-agent/338402/2 "2023-07-17T09:54:51Z")

</div>

Hi @csurfleet,

a few resources that may help:

this config enables you to control how the agent treats the incoming `traceparent` header: [HTTP configuration options | APM .NET Agent Reference [1.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-http.html#config-trace-continuation-strategy)

And this is the API that enables you to take an incoming `traceparent` value as a string and apply it to a newly created transaction:

> **[Public API | APM .NET Agent Reference \[1.x\] | Elastic](https://www.elastic.co/guide/en/apm/agent/dotnet/current/public-api.html#manually-propagating-distributed-tracing-context)**

If the elastic APM agent is present in all the apps and they call each other via HTTP, this should work out-of-the-box.

To be honest I wasn't able to fully understand your use-case - but these 2 configs usually cover similar scenarios.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 14, 2023, 9:55am UTC](https://discuss.elastic.co/t/creating-a-traceparent-header-in-the-net-agent/338402/3 "2023-08-14T09:55:43Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
