You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
4. Create an ``Activity`` (Span). Optionally, set tags:
35
35
36
36
.. code:: csharp
37
37
38
-
using (varactivity=RegisteredActivity.StartActivity("Main"))
38
+
using (varactivity=RegisteredActivity.StartActivity("Custom Span Name"))
39
39
{
40
-
activity?.SetTag("foo", "bar1");
41
-
// your logic for Main activity
40
+
// Check if the activity is sampled and if full data collection is enabled.
41
+
// This ensures that tags and other custom attributes are only set when the activity is being recorded.
42
+
// Note: Ensure that skipping logic based on sampling does not interfere with essential business operations.
43
+
if(activity?.IsAllDataRequested)
44
+
{
45
+
// your logic for custom activity
46
+
activity.SetTag("foo", "bar1");
47
+
}
42
48
}
43
49
44
-
4. Register your ``ActivitySource`` by setting the ``OTEL_DOTNET_AUTO_TRACES_ADDITIONAL_SOURCES`` environmental variable. You can set the value to either ``Examples.ManualInstrumentations.Registered`` or to ``Examples.ManualInstrumentations.*``, which registers the entire prefix.
50
+
5. Register your ``ActivitySource`` by setting the ``OTEL_DOTNET_AUTO_TRACES_ADDITIONAL_SOURCES`` environmental variable. You can set the value to either ``Examples.ManualInstrumentations.Registered`` or to ``Examples.ManualInstrumentations.*``, which registers the entire prefix.
51
+
52
+
6. Invoke the action that generates an ``Activity``, note the trace ID of the ``Activity``, and locate the trace in Splunk APM. You should now see a span with the display name "Custom Span Name" in the trace tree.
45
53
46
54
See the :new-page:`OpenTelemetry official documentation <https://opentelemetry.io/docs/languages/net/instrumentation/#traces>` for additional information and examples.
0 commit comments