Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default span/transaction type for OTel #6834

Merged
merged 3 commits into from
Dec 7, 2021

Conversation

axw
Copy link
Member

@axw axw commented Dec 7, 2021

Motivation/summary

Align OpenTelemetry span type/subtype with the agent bridge spec:

  • default to app.internal for internal spans
  • default to unknown for non-internal spans
  • default to unknown for transactions
  • remove the special ${component} attribute handling

Checklist

How to test these changes

  1. Send some custom internal OTLP spans, check they get type "app", subtype "internal".
  2. Send some custom non-internal OTLP spans, check they get type "unknown"

Related issues

Closes #6543

@axw axw added v8.0.0 backport-8.0 Automated backport with mergify labels Dec 7, 2021
@axw axw force-pushed the align-otel-span-type branch from b093d8b to 33b23c5 Compare December 7, 2021 06:44
@axw axw force-pushed the align-otel-span-type branch from 33b23c5 to 0c0e517 Compare December 7, 2021 06:45
@apmmachine
Copy link
Contributor

apmmachine commented Dec 7, 2021

❕ Build Aborted

There is a new build on-going so the previous on-going builds have been aborted.

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Reason: Aborted from #5

  • Start Time: 2021-12-07T07:59:32.704+0000

  • Duration: 43 min 34 sec

  • Commit: cbbef8a

Test stats 🧪

Test Results
Failed 0
Passed 5149
Skipped 18
Total 5167

Steps errors 1

Expand to view the steps failures

Print Message
  • Took 0 min 0 sec . View more details here
  • Description: �[39;49m[INFO] Can not determine redirect link!!!�[0m

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /hey-apm : Run the hey-apm benchmark.

  • /package : Generate and publish the docker images.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@axw axw requested a review from a team December 7, 2021 06:48
@axw axw marked this pull request as ready for review December 7, 2021 06:48
@axw axw enabled auto-merge (squash) December 7, 2021 07:59
@axw axw disabled auto-merge December 7, 2021 09:22
@axw axw merged commit b571545 into elastic:master Dec 7, 2021
@axw axw deleted the align-otel-span-type branch December 7, 2021 09:22
mergify bot pushed a commit that referenced this pull request Dec 7, 2021
(cherry picked from commit b571545)

# Conflicts:
#	changelogs/head.asciidoc
axw added a commit that referenced this pull request Dec 7, 2021
…6841)

* Update default span/transaction type for OTel (#6834)

(cherry picked from commit b571545)

# Conflicts:
#	changelogs/head.asciidoc

* Delete head.asciidoc

Co-authored-by: Andrew Wilkins <[email protected]>
@apmmachine
Copy link
Contributor

❕ Build Aborted

Either there was a build timeout or someone aborted the build.

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Start Time: 2021-12-07T08:38:54.695+0000

  • Duration: 123 min 0 sec

  • Commit: 9606dc1

Test stats 🧪

Test Results
Failed 0
Passed 4356
Skipped 15
Total 4371

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /hey-apm : Run the hey-apm benchmark.

  • /package : Generate and publish the docker images.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@stuartnelson3
Copy link
Contributor

Confirmed with 50edba1

package main

import (
	"context"
	"log"

	"go.opentelemetry.io/otel"
	"go.opentelemetry.io/otel/attribute"
	"go.opentelemetry.io/otel/exporters/otlp"
	"go.opentelemetry.io/otel/exporters/otlp/otlpgrpc"
	"go.opentelemetry.io/otel/propagation"
	"go.opentelemetry.io/otel/sdk/resource"
	sdktrace "go.opentelemetry.io/otel/sdk/trace"
	oteltrace "go.opentelemetry.io/otel/trace"
)

var tracer = otel.Tracer("mux-server")

func main() {
	tp := initTracer()
	defer func() {
		if err := tp.Shutdown(context.Background()); err != nil {
			log.Printf("Error shutting down tracer provider: %v", err)
		}
	}()
	// Change SpanKind here.
	_, span := tracer.Start(context.Background(), "span", oteltrace.WithSpanKind(oteltrace.SpanKindClient))
	defer span.End()
}

func initTracer() *sdktrace.TracerProvider {
	ctx := context.Background()

	endpoint := "localhost:8200"
	driver := otlpgrpc.NewDriver(
		otlpgrpc.WithInsecure(),
		otlpgrpc.WithEndpoint(endpoint),
	)
	exporter, err := otlp.NewExporter(ctx, driver)
	if err != nil {
		log.Fatal(err)
	}

	resources := resource.NewWithAttributes(
		attribute.String("host.name", "slaptop"),
	)
	tp := sdktrace.NewTracerProvider(
		sdktrace.WithSampler(sdktrace.AlwaysSample()),
		sdktrace.WithBatcher(exporter),
		sdktrace.WithResource(resources),
	)
	otel.SetTracerProvider(tp)
	otel.SetTextMapPropagator(
		propagation.NewCompositeTextMapPropagator(
			propagation.TraceContext{},
			propagation.Baggage{},
		),
	)
	return tp
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Align span/transaction type/subtype for OTel intake with agent bridge spec
5 participants