# Elastic APM java not showings spans

**URL:** <https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667>\
**Category:** APM\
**Tags:** java\
**Created:** [December 20, 2022, 3:00pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667 "2022-12-20T15:00:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 20, 2022, 3:00pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/1 "2022-12-20T15:00:06Z")

</div>

Hi i have created a spring boot 3 application. Doing attach:  
public static void main(String args) {  
ElasticApmAttacher.attach();  
SpringApplication.run(Application.class, args);  
}

In apm only showing transaction DispatcherServlet#doGet  
should show the correct mappings here? and about spans i get this message in the debug log

DEBUG co.elastic.apm.agent.pluginapi.CaptureSpanInstrumentation - Not creating span for 123#readFile because there is no currently active span.

service\_name=pt2  
application\_packages=se.af.prestanda.spring  
secret\_token=xx  
environment=xx  
server\_url=xx  
verify\_server\_cert=false  
log\_level=DEBUG  
recording=true  
enabled=true  
disable\_instrumentations=servlet-api, servlet-api-async, servlet-api-dispatch, servlet-input-stream,  
\ spring-mvc, spring-resttemplate  
enable\_experimental\_instrumentations=true  
capture\_body=all  
capture\_headers=true

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 20, 2022, 3:00pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/2 "2022-12-20T15:00:34Z")

</div>

so no spans are showing up...

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 20, 2022, 3:31pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/3 "2022-12-20T15:31:26Z")

</div>

Everything works fine if i do this manually in the code:

```
    Transaction transaction = ElasticApm.startTransaction();
    transaction.setName("Controller#Metric");
    transaction.setType(Transaction.TYPE_REQUEST);

```

Span span1 = transaction.startSpan().setName("getWorkspaceId");  
span1.end();

transaction.end();

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [December 20, 2022, 3:33pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/4 "2022-12-20T15:33:23Z")

</div>

Hi @johanostberg ,

What frameworks are you using in your application ? Are they listed in the [supported technologies](https://www.elastic.co/guide/en/apm/agent/java/current/supported-technologies-details.html) ? What types of spans do you expect to see ? Does your service calls a database and/or another service through HTTP ?

Here the `DEBUG` message that you reported seems to indicate the the agent is able to properly instrument the library/framework creating spans, but it is ignored because there is no active transaction (transaction is a top-level span that is required here).

Could you try by removing the `disable_instrumentations` configuration ? Does it makes a difference for the captured spans ?

If further analysis is required, please capture the agent logs using [this procedure](https://www.elastic.co/guide/en/apm/agent/java/current/trouble-shooting.html#trouble-shooting-logging-procedure).

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 20, 2022, 3:44pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/5 "2022-12-20T15:44:40Z")

</div>

Hi im using springboot 3.0  
in my Controller.java class:  
@PostMapping("/postjson")  
public String postBody(@RequestBody String jsonString) throws JSONException, IOException {  
i expect this to show up as a transaction controller#postjson  
and this call to show up as a span readFile(FileName);  
no differens when i remove disable\_instrumentations..

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 20, 2022, 3:49pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/6 "2022-12-20T15:49:31Z")

</div>

20T16:44:24.047+01:00 INFO 25396 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'  
2022-12-20T16:44:24.047+01:00 INFO 25396 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'  
2022-12-20T16:44:24.048+01:00 INFO 25396 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms  
2022-12-20 16:44:24,090 [http-nio-8080-exec-1] DEBUG co.elastic.apm.agent.bci.ElasticApmAgent - Type match for instrumentation CaptureSpanInstrumentation: ((false or name(startsWith(se.af.prestanda.spring))) and not((name(contains($Proxy)) or name(contains($$)) or name(contains($JaxbAccessor)) or name(contains(CGLIB)) or name(contains(EnhancerBy)))) and declaresMethods(whereOne(declaresAnnotations(whereOne(ofAnnotationType(name(equals(co.elastic.apm.api.CaptureSpan)))))))) matches class se.af.prestanda.spring.NeoloadCompare  
2022-12-20 16:44:24,094 [http-nio-8080-exec-1] DEBUG co.elastic.apm.agent.bci.ElasticApmAgent - Method match for instrumentation CaptureSpanInstrumentation: (declaresAnnotations(whereOne(ofAnnotationType(name(equals(co.elastic.apm.api.CaptureSpan))))) and not(isAbstract())) matches public static java.util.Map se.af.prestanda.spring.NeoloadCompare.readFile(java.lang.String) throws java.io.IOException  
2022-12-20 16:44:24,120 [http-nio-8080-exec-1] DEBUG co.elastic.apm.agent.bci.IndyPluginClassLoaderFactory - Creating plugin class loader for jdk.internal.loader.ClassLoaders$AppClassLoader@1d44bcfa containing [co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$SetNameInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.CaptureSpanInstrumentation, co.elastic.apm.agent.pluginapi.TracedInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$IsSampledInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$EndWithTimestampInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.ApiScopeInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$GetTraceIdInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetDestinationServiceInstrumentation, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation$CurrentSpanInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.TransactionInstrumentation$EnsureParentIdInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation$CurrentTransactionInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$EndInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$IsSampledInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$GetIdInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation, co.elastic.apm.agent.pluginapi.TransactionInstrumentation$SetResultInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation$CaptureExceptionInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$AddNumberLabelInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$LegacyCaptureExceptionInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetStartTimestampInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$CaptureExceptionInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetDestinationAddressInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$SetTypeInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$ActivateInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$IsSampledInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$SetNameInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetNameInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$SetTypeInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$GetIdInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$InjectTraceHeadersInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetStartTimestampInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$InitializeInstrumentation, co.elastic.apm.agent.pluginapi.CaptureSpanInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$AddNumberLabelInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$AddStringLabelInstrumentation, co.elastic.apm.agent.pluginapi.HeaderInjectorBridge, co.elastic.apm.agent.pluginapi.TransactionInstrumentation$SetFrameworkNameInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$GetIdInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$ActivateInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$AddTagInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.CaptureTransactionInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetTypeInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetDestinationAddressInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$GetTraceIdInstrumentation, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation$CurrentTransactionInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.package-info, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$InjectTraceHeadersInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation$StartTransactionInstrumentation, co.elastic.apm.agent.pluginapi.TransactionInstrumentation$SetResultInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$ActivateInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$DoCreateSpanInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$IsSampledInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.CaptureExceptionInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.HeaderExtractorBridge, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation$CurrentSpanInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$EndInstrumentation, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation$StartTransactionInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetTypesInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$EndInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.TransactionInstrumentation$AddCustomContextInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$DoCreateSpanInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation$StartTransactionWithRemoteParentInstrumentation, co.elastic.apm.agent.pluginapi.TransactionInstrumentation, co.elastic.apm.agent.pluginapi.Utils, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$GetTraceIdInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$DoCreateSpanInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation$CaptureExceptionInstrumentation, co.elastic.apm.agent.pluginapi.TransactionInstrumentation$AddCustomContextInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.CaptureTransactionInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$CaptureExceptionInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetTypeInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$CaptureExceptionInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetDestinationServiceInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$DoCreateSpanInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$AddBooleanLabelInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$AddTagInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$CaptureExceptionInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$DoCreateExitSpanInstrumentation, co.elastic.apm.agent.pluginapi.TracedInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetOutcomeInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.HeadersExtractorBridge, co.elastic.apm.agent.pluginapi.TransactionInstrumentation$SetUserInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$EndInstrumentation, co.elastic.apm.agent.pluginapi.ElasticApmApiInstrumentation$StartTransactionWithRemoteParentInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$LegacyCaptureExceptionInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$AddBooleanLabelInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$EndWithTimestampInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$AddStringLabelInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.TransactionInstrumentation$SetUserInstrumentation, co.elastic.apm.agent.pluginapi.TransactionInstrumentation$EnsureParentIdInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetTypesInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$GetIdInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$DoCreateExitSpanInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.HeadersExtractorBridge$Extractor, co.elastic.apm.agent.pluginapi.ApiInstrumentation, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$ActivateInstrumentation, co.elastic.apm.agent.pluginapi.LegacySpanInstrumentation$GetTraceIdInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetOutcomeInstrumentation, co.elastic.apm.agent.pluginapi.TransactionInstrumentation$SetFrameworkNameInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$InitializeInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.AbstractSpanInstrumentation$SetNameInstrumentation$AdviceClass, co.elastic.apm.agent.pluginapi.ApiScopeInstrumentation, co.elastic.apm.agent.pluginapi.CaptureExceptionInstrumentation, co.elastic.apm.agent.bci.classloading.LookupExposer]  
2022-12-20 16:44:24,135 [http-nio-8080-exec-1] DEBUG co.elastic.apm.agent.pluginapi.CaptureSpanInstrumentation - Not creating span for NeoloadCompare#readFile because there is no currently active span.

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [December 20, 2022, 4:25pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/7 "2022-12-20T16:25:53Z")

</div>

The agent debug logs are not required for now (I was just anticipating a bit here).  
Have you tried removing `disable_instrumentations` configuration ?

When you created manually a transaction by using the agent Public API, the spans were properly captured, thus it confirms that only the transaction is missing.

You seem to be using Spring MVC framework, but you disabled its instrumentation in `disable_instrumentations` also servlet instrumentation (which is used to create transactions in this case) is also disabled which is very likely the cause of the issue here.

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 21, 2022, 6:56am UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/8 "2022-12-21T06:56:48Z")

</div>

Thank you! I forgot to remove the disable\_intrumentation and it now works kinda.  
every transaction is named DispatcherServlet#doGet it should pickup the reqeustmapping that im calling right? And for the methods that are just doing stuff internally it shows upp like a span.  
But i have another method that is doing a api call to another application for that one i just get the api call (GET web-api.app).

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 21, 2022, 7:19am UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/9 "2022-12-21T07:19:33Z")

</div>

Ok i deployed my app in ocp and now it everything works thank you!!!

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 21, 2022, 10:00am UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/10 "2022-12-21T10:00:12Z")

</div>

update now i only get do DispatcherServlet#doGet for all my transactions i dont understand why this is happening?

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [December 21, 2022, 12:21pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/11 "2022-12-21T12:21:36Z")

</div>

> [@Sylvain\_Juge](#):
>
> disable\_instrumentations

Did you completely removed the option or did you just removed servlets from `disable_instrumentations` ?

The reason I am asking this is because the Spring-MVC one is in charge of setting a proper name and would thus allow to better "qualify" the generic Servlet endpoint that is common to all of them.

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 21, 2022, 12:32pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/12 "2022-12-21T12:32:44Z")

</div>

i removed the whole option.

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [December 21, 2022, 1:51pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/13 "2022-12-21T13:51:24Z")

</div>

In this case, could you provide a code sample that shows how your endpoints are defined ?  
In some cases setting `use_path_as_transaction_name` might be useful : [HTTP configuration options | APM Java Agent Reference [1.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/java/current/config-http.html#config-use-path-as-transaction-name)

However, that can be an issue if you are using parts of the URL as parameters, which is common with REST endpoints, but at least you could see if that makes a difference.

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 21, 2022, 2:09pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/14 "2022-12-21T14:09:52Z")

</div>

with use\_path\_as\_transaction\_name i get different transaction names for my endpoints but i dont see the span anymore:  
@RequestMapping(value = "metrics")  
public ResponseEntity metrics() throws IOException {

```
        return ResponseEntity.ok()
                .headers(headers)
                .body(readFile(c:/temp/1.txt);

```

}

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 22, 2022, 8:50am UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/15 "2022-12-22T08:50:46Z")

</div>

Should spans on internal metods be created by default or do i need to annotate @CaptureSpan for every method?

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [December 22, 2022, 8:56am UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/16 "2022-12-22T08:56:15Z")

</div>

Hi,

From the annotations it seems that you are using Spring MVC, so this should definitely be supported, could you provide the version of the Spring dependencies that you are using ?

Changing the `use_path_as_transaction_name` value does not have any impact on spans capture, it only impacts how the transaction is named.

Spans are automatically captured for any instrumented method, so it means mostly external services calls like through the JDBC API (or any of the [supported technologies](https://www.elastic.co/guide/en/apm/agent/java/current/supported-technologies-details.html)).

If you want to also create spans for methods that are not instrumented automatically, you can either instrument them with `trace_methods` or annotate them like you suggested.  
Using `@CaptureSpan` will only create spans if the method is called within a transaction, it won't create a transaction.

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 22, 2022, 12:47pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/17 "2022-12-22T12:47:42Z")

</div>

thank you everything works perfect now. Just want to check can we do something similar with .net?

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [December 22, 2022, 1:45pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/18 "2022-12-22T13:45:22Z")

</div>

Yes, this should also be doable with dotnet if needed. However I don´t know the details, thus check documentation and open other posts in forum if you need further help.

---

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [December 22, 2022, 1:55pm UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/19 "2022-12-22T13:55:59Z")

</div>

ok thank you

---

<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:** [January 12, 2023, 9:56am UTC](https://discuss.elastic.co/t/elastic-apm-java-not-showings-spans/321667/20 "2023-01-12T09:56:33Z")

</div>

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