Commit Graph

19 Commits

Author SHA1 Message Date
Tony Fang
8472946799 Adding unit tests to opentelemetry tracing
Refractor newExporter and newTracer, add unit tests to them
This PR is part of issue 7493

Signed-off-by: Tony Fang <nenghui.fang@gmail.com>
2022-12-06 03:14:06 +00:00
Maksym Pavlenko
14a08721cc Remove OpenTelementry imports from remotes/docker package
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-11-15 17:32:26 -08:00
Luca Comellini
b829e6f2d3
Bump OpenTelemetry to v1.11.1
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2022-11-10 22:15:10 -08:00
Swagat Bora
7def13dde3 Add a thin wrapper around otel Span object
Signed-off-by: Swagat Bora <sbora@amazon.com>
2022-11-11 01:28:27 +00:00
Swagat Bora
ee64926a72 add SpanAttribute
Signed-off-by: Swagat Bora <sbora@amazon.com>
2022-11-03 18:34:06 +00:00
Swagat Bora
3b87d46ce2 Add tracing spans in CRI image service and pull.go
Signed-off-by: Swagat Bora <sbora@amazon.com>

Add spans around image unpack operations
Use image.ref to denote image name and image.id for the image config digest
Add top-level spand and record errors in the CRI instrumentation service
2022-11-03 17:03:43 +00:00
Joseph Sheng
fc86be5011 not init a tracing processor when not loaded
Signed-off-by: Joseph Sheng <jiajun.sheng@microfocus.com>
2022-10-18 09:47:22 +08:00
Cory Snider
927b34e41e tracing: fix panic on startup when configured
When support for http/protobuf was added, the OTLP tracing processor
plugin was mistakenly changed to return a raw OTLP exporter instance.
Consequently, the type-assertion to a trace.SpanProcessor inside the
tracing pluigin would panic if the processor plugin was configured.
Modify the OTLP plugin to return a BatchSpanProcessor derived from the
exporter once more.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2022-04-07 19:51:14 -04:00
Maksym Pavlenko
0b2a95e107 Add no_tracing tag
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-03-31 14:37:11 -07:00
Kazuyoshi Kato
cc59ae4d98 tracing: return (ctx, span) from StartSpan
OpenTelemetry's Tracer#Start() returns (ctx, span). We have no reasons
to swap them.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-01-29 00:41:21 +00:00
Kazuyoshi Kato
e751f1f44f tracing: support OTLP/HTTP in addition to gRPC
This change adds OTLP/HTTP, specifically http/protobuf support.

http/protobuf is recommended in
https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/protocol/exporter.md.

However kube-apiserver and CRI-O use gRPC, kubelet may support
gRPC in future. So we should support gRPC as well.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-01-29 00:41:18 +00:00
Kazuyoshi Kato
69ae95531c tracing: fix OTLP tracer's initialization
- insecure.NewCredential was simply wrong. It has to use
  otlptracegrpc.WithInsecure to disable TLS.
- context.WithTimeout is nice to have, in case the endpoint is not
  correctly configured.
  Otherwise, the plugin initialization blocks indefinitely.
- grpc.WithReturnConnectionError is nice to have.
  Otherwise, otlptracegrpc.New returns "context deadline exceeded"
  without underlying errors.
- TraceSamplingRatio should be 1.0 by default.
  Otherwise, users need to configure both io.containerd.internal.v1.tracing
  and io.containerd.tracing.processor.v1.otlp.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-01-13 17:50:18 +00:00
haoyun
bbe46b8c43 feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: zounengren <zouyee1989@gmail.com>
2022-01-07 10:27:03 +08:00
Kazuyoshi Kato
2ee3ce510c Use insecure.NewCredentials instead of grpc.WithInsecure
grpc.WithInsecure is being deprecated.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-12-16 23:10:06 +00:00
Brian Goff
1ee2bff0e0 Update go otel 1.0.1
This fixes the issue with the usage of the deprecated attribute.Any
function that original caused build issues.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-10-06 00:42:56 +00:00
Derek McGowan
22beecb7d9
Merge pull request #6003 from cpuguy83/add_otel_log_hook
Add open telemetry logging hook for logrus
2021-09-24 17:21:46 -07:00
Brian Goff
084387e0b4 Move tracing to plugin
This just makes the implementation a little cleaner.
It also makes the trace exporter pluggable.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-09-21 21:19:46 +00:00
Brian Goff
45c3453a7c Add open telemetry logging hook for logrus
This adds valuable logging data to the open telemetry traces.

When the trace is not recording we don't bother doing anything as it is
relatively expensive to convert logrus data to otel just due to the
nature of how logrus works.

The way this works is that we now set a context on the logrus.Entry that
gets passed around which the hook then uses to determine if there is an
active span to forward the logs to.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-09-21 21:19:28 +00:00
Alakesh Haloi
3597ac859d [otel-tracing] Initial opentelemetry support
Add basic intiialization of opentelemetry including minimum support to
be able to read open telemetry config from config.toml and initialize
exporter. Tracer is initialized and ready to be be used for creating
spans, sub spans etc. With no opentelemetry configuration enabled in
config file, this patch is a no-op.

Basic config stub to be added to use opentelemetry is to add following
in config.toml. We use otlp exporter with default port 4317.

[otel]
  exporter_name = "otlp"
  exporter_endpoint = "0.0.0.1:4317"

otel-collector binary needs to run listening at the same port.

Signed-off-by: Alakesh Haloi <alakeshh@amazon.com>
2021-08-04 14:25:01 -07:00