# Apm-agent-go/echo not catch custom span

**URL:** <https://discuss.elastic.co/t/apm-agent-go-echo-not-catch-custom-span/323954>\
**Category:** APM\
**Tags:** go\
**Created:** [January 25, 2023, 4:54pm UTC](https://discuss.elastic.co/t/apm-agent-go-echo-not-catch-custom-span/323954 "2023-01-25T16:54:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggalihpp-jubelio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ggalihpp-jubelio/32/116393_2.png) [@ggalihpp-jubelio](https://discuss.elastic.co/u/ggalihpp-jubelio)\
**Post date:** [January 25, 2023, 4:54pm UTC](https://discuss.elastic.co/t/apm-agent-go-echo-not-catch-custom-span/323954/1 "2023-01-25T16:54:45Z")

</div>

Hi everyone,

I am trying to configure APM agent on top of echo webframework. Everything is working, transaction, PostgreSQL span, etc..

but when tried to create a custom span, its not working  
here's how I tried to achieve it

```auto
func blocker(c echo.Context) {
	span, _ := apm.StartSpan(c.Request().Context(), "work", "custom")
	defer span.End()

	fmt.Printf("=====================\nACTION=%s, span.Name=%s, span.Outcome=%s, span.Type=%s \n====================",
		span.Action, span.Name, span.Outcome, span.Type)

	time.Sleep(3000 * time.Millisecond)
}

```

and every value in the log is empty. What did I do wrong?

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [January 27, 2023, 5:30am UTC](https://discuss.elastic.co/t/apm-agent-go-echo-not-catch-custom-span/323954/2 "2023-01-27T05:30:17Z")

</div>

Hi @ggalihpp-jubelio, welcome to the forum!

Can you share which packages you're importing for `apmecho` and `apm`? This is a bit of a wild guess, but I'm wondering if you're mixing v1 and v2 package paths. If that were the case, then `apm.StartSpan` will not find the transaction in the context, and the returned span will be a no-op span.

---

<div class="post-metadata">

**Author:** ![ggalihpp-jubelio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ggalihpp-jubelio/32/116393_2.png) [@ggalihpp-jubelio](https://discuss.elastic.co/u/ggalihpp-jubelio)\
**Post date:** [January 29, 2023, 5:31pm UTC](https://discuss.elastic.co/t/apm-agent-go-echo-not-catch-custom-span/323954/3 "2023-01-29T17:31:30Z")

</div>

Hi @axw sorry for this late response

YES! that's why... I dumbly import `"go.elastic.co/apm"` while using `"go.elastic.co/apm/module/apmechov4/v2"`

Thank you so much!

---

<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:** [February 19, 2023, 1:31pm UTC](https://discuss.elastic.co/t/apm-agent-go-echo-not-catch-custom-span/323954/4 "2023-02-19T13:31:54Z")

</div>

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