Unable to see span data from sample program using custom API

Kibana version:6.5.4

Elasticsearch version: 6.5.4

APM Server version:6.5.4

APM Agent language and version:6.5.4

Browser version:

Original install method (e.g. download page, yum, deb, from source, etc.) and version:

Fresh install or upgraded from other version? Fresh

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
I am trying out a simple program to understand the usage of the APIs.
I can see the transaction in Kibana APM, but could not get the information related to span

//Code

ElasticApmAttacher.attach();

    Transaction transaction = ElasticApm.startTransaction();
    try {
        transaction.setName("transactionName");
       //Do Something

        Span span = ElasticApm.currentSpan().startSpan();
        try (final Scope scope = span.activate()) {
            span.setName("customSpan");
            //Do Something

        } catch (Exception e) {
            span.captureException(e);
            throw e;
        } finally {
            span.end();
        }
    } catch (Exception e) {
        transaction.captureException(e);
    } finally {
        transaction.end();
    }

Errors in browser console (if relevant):
In http://localhost:8200/intake/v2/events i get this error
{"accepted":0,"errors":[{"message":"only POST requests are supported"}]}

Hi and welcome to the forum!
Since you only created a transaction without activating it, you cannot get it through currentSpan() (see notes in documentation), so you are not creating a child span as you expect.
I hope this helps.

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