Commit Graph

80 Commits

Author SHA1 Message Date
Erik Seliger
7dc2707fff
chore: Break dependency of internal/trace on conf (#62177)
This PR adds an initializer function that will be called from the svcmain package through the call to tracer.Init.

The reasoning behind this is that it's very easy to accidentally use a package that uses conf internally from a service like Cody Gateway, Appliance, Migrator, or other MSP services and just because we don't have any config source for the trace ID should not let the process stall entirely.
To make it absolutely clear that a dependency is safe to use from a conf perspective, this change indicates that well by dropping the dependency on it entirely and making it another packages concern to pass this type down.

Test plan:

All tests for Sourcegraph are still passing.

---------

Co-authored-by: Robert Lin <robert@bobheadxi.dev>
2024-04-30 21:12:39 +02:00
Erik Seliger
4c341b3400
conf: Move most confvalidators into common package (#61810)
Previously, some of these validators would not fire correctly, because some packages aren't imported from cmd/frontend.
The package that contributes validators MUST be imported into frontend, which is not guaranteed. By colocating the GetWarnings func and the validators in one package, this is effectively enforced.

There are a few left that were a little harder to migrate, but this feels like a useful first step (and the end of my time window for this rn 😬)

Test plan:

Moved code around, my instance can still start fine and doesn't report new errors.
2024-04-12 06:30:52 +02:00
Robert Lin
aa53b8cff0
tracer/exporters: use internalerrs loggers on OTEL gRPC exporter (#60840)
In dotcom, the OTEL SDK reports:

```
traces export: rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8
```

This isn't super helpful for narrowing down where these invalid attributes are coming from.

Luckily, we have some middleware providing some slightly more detailed diagnostics in `grpc/internalerrs`, including detailed logging for this exact problem - this hooks that middleware into the OTEL SDK to help us pin down the source of this issue.

## Test plan

```
sg start
```

Tried a `trace=1` search, nothing bad happened. This middleware is already used extensively elsewhere, and we have an escape hatch via `SRC_GRPC_INTERNAL_ERROR_LOGGING_ENABLED`. Confirmed there's no logspam from failed export due to lack of an active collector in local dev.
2024-03-04 18:45:48 +00:00
Robert Lin
c0773ed458
tracer: instrument tracer and exporter with basic counters (#60775) 2024-02-29 13:31:36 +01:00
Robert Lin
24bd456b07
tracer: enable SDK logging in debug mode, remove sync exporter (#60766)
Adds OTEL Go SDK logging enablement as part of the `tracing.debug` option. In particular, this is the only way to get the spans dropped by the batch span processor in the SDK: 1d1ecbc5f9/sdk/trace/batch_span_processor.go (L287C1-L288C1)

To make sure this is usable, I've also removed the use of the sync span exporter on debug mode. This is rarely used and shouldn't be used in production, and knobs are available for making tracing "faster" (if needed) in local dev via `OTEL_BSP_*` env vars instead.

Part of https://sourcegraph.slack.com/archives/C04MYFW01NV/p1706107280411819

## Test plan

```
sg run otel-collector jaeger
sg start
```

Logs are available under `tracer.otel` scope:

```
[     embeddings] INFO tracer.otel global/internal_logging.go:52 "level"=4 "msg"="Tracer created" "name"="github.com/XSAM/otelsql" "version"="0.27.0" "schemaURL"=""
```

When debug mode is disabled, these logs don't show up
2024-02-27 22:01:00 +00:00
Camden Cheek
51dcf97d4f
Chore: error on unknown protocol rather than panic (#60702) 2024-02-22 17:08:50 +00:00
Robert Lin
7678c7b031
chore: upgrade otel SDK packages (#59564)
This is prep for an upgrade of our otel-collector itself - we are adding a dependency on a beta receiver in https://github.com/sourcegraph/sourcegraph/pull/59561 , and want to make sure we are up to date.

This change also gets us to the stable metrics API, which is nice.
2024-01-15 20:08:54 +00:00
Jean-Hadrien Chabran
a9c3f8ce9a
chore: links/ownership devx->dev-infra (#58999) 2023-12-14 15:07:20 +00:00
Robert Lin
1a8de73b9b
internal/tracer: silence opentelemetry debug logs (#58243)
We see the OpenTelemetry debug logs emit a lot of output in Cloud - it's not all that important, and we already register an error handler, so this sets the default OpenTelemetry output to discard.
2023-11-09 19:40:14 +00:00
Robert Lin
4556b317f1
tracer: enforce trace policy entirely via Sampler (#58068)
This change updates our internal tracer to enforce policy only via a `Sampler` implementation. This has the following benefits:

1. Even when a trace should not be sampled, contexts are still populated with valid spans, rather than no-op ones. This is important to make use of trace IDs for non-tracing purposes, e.g. https://github.com/sourcegraph/sourcegraph/pull/57774 and https://github.com/sourcegraph/sourcegraph/pull/58060
2. We enforce trace policies the way they were meant to be enforced in OpenTelemetry: by simply indicating that the span should not be exported.

This was not possible before because OpenTracing did not use context propagation, hence we did not have a way to use trace policy flags set in context - but thanks to @camdencheek's work removing OpenTracing entirely, we can now do this in a more idiomatic fashion.

Thanks to this, I've removed a few places that prevented trace context from being populated based on trace policy (HTTP and GraphQL middleware, and `internal/trace`). This delegates sampling decisions to the sampler, and ensures we accept valid trace context everywhere.

## Test plan

Unit tests on a TracerProvider configured with the new sampler.

Manual testing:

```
sg run jaeger otel-collector 
sg start
```

Setting `observability.tracing.debug` to `true` we can see logs indicating the desired traits for non-`ShouldTrace` traces:

```
[         worker] INFO tracer tracer/logged_otel.go:63 Start {"spanName": "workerutil.dbworker.store.insights_query_runner_jobs_store.dequeue", "isRecording": false, "isSampled": false, "isValid": true}
```

With `observability.tracing.sampling` set to `none`, running a search with `&trace=1` only gives us spans from zoekt, which seems to have always been outside our rules here.

With `observability.tracing.sampling` set to `selective`, running a search with `&trace=1` gives us a full trace.

With `observability.tracing.sampling` set to `all`, Jaeger instantly gets loads of traces, and in logs we see:

```
[         worker] INFO tracer tracer/logged_otel.go:63 Start {"spanName": "workerutil.dbworker.store.exhaustive_search_worker_store.dequeue", "isRecording": true, "isSampled": true, "isValid": true}
```

---------

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
2023-11-02 09:00:14 -07:00
William Bezuidenhout
1ae6cc6bfd
logger: update log lib and remove use of description (#57690)
* log: remove use of description paramter in Scoped

* temporarily point to sglog branch

* bazel configure + gazelle

* remove additional use of description param

* use latest versions of zoekt,log,mountinfo

* go.mod
2023-10-18 17:29:08 +02:00
William Bezuidenhout
0b3c0e9b41
otel: set global propagator (#57254)
* init global trace propagator

* use the ACTUAL default propagator
2023-10-03 15:49:38 +00:00
Robert Lin
294fe3df22
cody-gateway: push GCP metrics or publish Prometheus metrics via OpenTelemetry (#55134)
Our first usage of [the recently stabilized OpenTelemetry
metrics](https://opentelemetry.io/docs/specs/otel/metrics/) 😁 Currently
this is Cody-Gateway-specific, nothing is added for Sourcegraph as a
whole.

We add the following:

- If a GCP project is configured, we set up a GCP exporter that pushes
metrics periodically and on shutdown. It's important this is push-based
as Cloud Run instances are ephemeral.
- Otherwise, we set up a Prometheus exporter that works the same as
using the Prometheus SDK, where metrics are exported in `/metrics` (set
up by debugserver) and Prometheus scrapes periodically.

To start off I've added a simple gauge that records concurrent ongoing
requests to upstream Cody Gateway services - see test plan below.

Closes https://github.com/sourcegraph/sourcegraph/issues/53775

## Test plan

I've only tested the Prometheus exporter. Hopefully the GCP one will
"just work" - the configuration is very similar to the one used in the
tracing equivalent, and that one "just worked".

```
sg start dotcom
sg run prometheus
```

See target picked up:

<img width="1145" alt="Screenshot 2023-07-19 at 7 09 31 PM"
src="https://github.com/sourcegraph/sourcegraph/assets/23356519/c9aa4c06-c817-400e-9086-c8ed6997844e">

Talk to Cody aggressively:

<img width="1705" alt="image"
src="https://github.com/sourcegraph/sourcegraph/assets/23356519/fbda23c7-565f-4a11-ae1b-1bdd8fbceca1">
2023-07-20 20:35:16 +00:00
Camden Cheek
dfab9c5b4b
Tracing: remove opentracing (#52978)
This removes the remainder of opentracing-related code from
sourcegraph/sourcegraph. We still use an opentracing propagator so that
downstream services that use opentracing (cough cough Zoekt) will still
work (but Zoekt is weird in a lot of ways and is kind of broken already
in some cases).
2023-06-06 11:02:15 -06:00
Jean-Hadrien Chabran
3d36d34b3d
ci: re-enable race detection (#52776)
The previous approach to enable race detection was too radical and
accidently led to build our binaries with the race flage enabled, which
caused issues when building images down the line.

This happened because putting a `test --something` in bazelrc also sets
it on `build` which is absolutely not what we wanted. Usually folks get
this one working by having a `--stamp` config setting that fixes this
when releasing binaries, which we don't at this stage, as we're still
learning Bazel.

Luckily, this was caught swiftly. The current approach insteads takes a
more granular approach, which makes the `go_test` rule uses our own
variant, which injects the `race = "on"` attribute, but only on
`go_test`.


## Test plan

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

CI, being a main-dry-run, this will cover the container building jobs,
which were the ones failing.

---------

Co-authored-by: Alex Ostrikov <alex.ostrikov@sourcegraph.com>
2023-06-05 20:41:47 +02:00
Robert Lin
a1c3cce1dd
service: allow more flexibility in conf-dependent configuration (#52039)
The primary goal of this change is to allow services more flexibility if
they opt out of `conf` integration. It removes the public-facing
`useConfPackage` argument in favour of:

1. `svcmain.SingleServiceMain`, which assumes site configuration access
and initialization.
2. `svcmain.SingleServiceMainWithoutConf`, which does _not_ assume site
configuration access, and allows custom hooks for
site-config-dependent-configuration via a new options struct
`OutOfBandConfiguration`, allowing callers to set up custom
configuration given a lack of `conf` package access

This allows services like LLM-proxy (#50726) and maybe even exeuctors
(the only other service to have `useConfPackage=false` at the moment) to
set up custom configuration for e.g. Sentry sinks on their own terms.

Some other changes:

- Remove the `validateConfig` argument - this was only set to false in
one place, and it seems to belong better in the existing
`svcmain.Config` struct, where it now lives as `SkipValidate`
- Tracing package now accepts an interface with a smaller scope, rather
than all site configuration
- Add `LLM_PROXY_SENTRY_DSN` using the new configuration options

## Test plan

CI, `sg start`, `sg start app`
2023-05-17 09:13:19 -07:00
Robert Lin
32e21969f6
llm-proxy: local tracing setup, shared propagation configuration (#51849)
1. Adds local tracing option for LLM-proxy that sends things to
OpenTelemetry
   - Moves exporter constructors to non-internal package for reuse
2. Adds propagation compatibility with Sourcegraph
- Moves propagator configuration to a package,
`internal/tracer/oteldefaults`, for import by LLM-proxy
3. Adds some comments to various parts of tracing internals

## Test plan


`&trace=1` and do a Cody interaction:


![image](https://github.com/sourcegraph/sourcegraph/assets/23356519/c4493df7-a574-4816-9577-4145e8ecaef9)
2023-05-12 08:51:12 -07:00
Dave Try
2b8fa079f0
bazel: fix buf files (#49444)
fix protoc-gen-go version
2023-03-15 20:21:38 +00:00
Dave Try
293385d5dd
bazel: update timeouts to suppress warnings (#49399)
Updates all of the BUILD fields with timeouts to suppress warnings and
reduce log spam.


## Test plan

Green CI
2023-03-15 15:04:16 +02:00
Jean-Hadrien Chabran
bc6a791710
bazel: fix remaining backend tests (#47961)
This PR fixes the last round of backend tests that are getting in the
way.

While most fixes are pertaining to adapting the code to deal with the
sandbox, or adjusting targets in some cases, we had to ignore the tests
from the database stitch migration (see
123cb55005)
(cc @efritz) because they are making strong assumptions toward running
inside the Sourcegraph repository, which is kinda non trivial to adapt.

Another one, albeit non consequential is the disabling of some tests
peforming external requests, which I think should be deleted anyway
(c83d8ebba8)

Fix https://github.com/sourcegraph/sourcegraph/issues/46837
Fix https://github.com/sourcegraph/sourcegraph/issues/46856
Fix https://github.com/sourcegraph/sourcegraph/issues/46862
Fix https://github.com/sourcegraph/sourcegraph/issues/46864
Fix https://github.com/sourcegraph/sourcegraph/issues/46833
Fix https://github.com/sourcegraph/sourcegraph/issues/46835
Fix https://github.com/sourcegraph/sourcegraph/issues/46836
Fix https://github.com/sourcegraph/sourcegraph/issues/46847
Fix https://github.com/sourcegraph/sourcegraph/issues/46838
Fix https://github.com/sourcegraph/sourcegraph/issues/46843
Fix https://github.com/sourcegraph/sourcegraph/issues/46845
Fix https://github.com/sourcegraph/sourcegraph/issues/46849
Fix https://github.com/sourcegraph/sourcegraph/issues/46851
Fix https://github.com/sourcegraph/sourcegraph/issues/46855
Fix https://github.com/sourcegraph/sourcegraph/issues/46857
Fix https://github.com/sourcegraph/sourcegraph/issues/46858
Fix https://github.com/sourcegraph/sourcegraph/issues/46859
Fix https://github.com/sourcegraph/sourcegraph/issues/46861
Fix https://github.com/sourcegraph/sourcegraph/issues/46863
Fix https://github.com/sourcegraph/sourcegraph/issues/46865
Fix https://github.com/sourcegraph/sourcegraph/issues/46867
Fix https://github.com/sourcegraph/sourcegraph/issues/46853

## Test plan

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

Ran locally with bazel.

---------

Co-authored-by: davejrt <davetry@gmail.com>
2023-03-01 17:03:01 +00:00
Robert Lin
1cb5bc4b59
internal/tracer: correctly set Tracer names in OpenTracing bridge (#40945)
The existing wrapped OpenTelemetry TracerProvider for bridging
OpenTracing API calls to OpenTelemetryAPI calls discards the name
provided to the `Tracer()` constructor on it, since it uses a fixed
tracer that we provide it.

This change leverages an upstream patch,
https://github.com/open-telemetry/opentelemetry-go/pull/3116 (dependency
update: https://github.com/sourcegraph/sourcegraph/pull/47126), that
allows wrapped tracers to be created on the fly with the provided
parameters, so that we can more accurately see the instrumentation
source.

## Test plan

Via the bridge, we can see that the Tracer used is the bridge tracer:

<img width="1322" alt="image"
src="https://user-images.githubusercontent.com/23356519/186957763-60faee32-e6a5-4bda-bb64-fddb82eacc0d.png">

Via direct usage of OpenTelemetry, we can see that the Tracer used has
the custom name set:

<img width="1448" alt="image"
src="https://user-images.githubusercontent.com/23356519/186957773-c6ff7643-3f89-498d-857b-1dd79b36508d.png">
2023-02-23 11:07:39 -08:00
Robert Lin
2176537885
tracer: only swap underlying SpanProcessor, instead of entire tracers (#47428)
The new architecture of `internal/tracer`:

1. Creates a `TracerProvider` immediately. This provider is
preconfigured with service metadata, but does not have a
`SpanProcessor`.
2. Creates an OpenTracing bridge using `TracerProvider`, such that we
have an OpenTracing Tracer and an OpenTelemetry TracerProvider that
bridges the two APIs. We register both as global defaults.
3. On site config initialization, we register a new `SpanProcessor` onto
the global `TracerProvider`.
4. From this point on, site config updates:
   a. Create a new `SpanProcessor` based on site config
   b. Register the new `SpanProcessor`, which starts processing
c. Remove the previous `SpanProcessor`, which flushes it and shuts it
down as well

Previously, we mimicked the old opentracing setup where we swapped the
global tracer, using a similar approach in OpenTelemetry to set up the
global TracerProvider. In OpenTelemetry, registering and unregistering
`SpanProcessors` is the correct way to do this it seems - the swapping
approach causes configuration propagation issues such as
https://github.com/XSAM/otelsql/pull/115 (allowing us to revert back to
upstream: https://github.com/sourcegraph/sourcegraph/pull/47429) and
possibly https://github.com/sourcegraph/sourcegraph/issues/42515 . This
correct approach was pointed out in
https://github.com/XSAM/otelsql/pull/115#issuecomment-1416777390, and
makes the setup easier to reason with:

- the previously swappable tracers now no longer need to have a locked
underlying implementation, they just add logging now
- we don't need to update 2 implementations, we make the update at a
lower level so that both ends of the OT/OTel bridge are updated
- debug mode is managed through a mutable atomic bool, instead of
through recreating entire tracers

## Test plan

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

Unit tests assert that span processor updates are propagated. Exporter
setup is functionally unchanged

---------

Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
2023-02-21 09:39:07 -08:00
Jean-Hadrien Chabran
bc5490c4bb
bazel: introduce build files for Go (#46770) 2023-01-23 14:00:01 +01:00
Jean-Hadrien Chabran
c31f4a56c8
lint: re-enable depguard in golangci-lint + fix all errors (#45270) 2022-12-06 18:16:04 +01:00
Quinn Slack
f799c27aaf
quieter info logs (#45235)
These log messages are not useful at the information level IMO, and they add a lot of log noise when running the single-Docker-container (or the future single-program) deployment methods.
2022-12-06 06:21:34 +00:00
Quinn Slack
50fe3e73d7
misc: rm erroneous println, rm incorrect mention, quiet some logs (#45123)
* quiet some logs from info to debug

I think these are all debug-level logs and do not contain useful information outside of debugging a deep problem.

* remove mention of non-existent package

* remove erroneous fmt.Println

This appears to be a debugging aid that was accidentally left in.
2022-12-04 08:54:47 +02:00
Quinn Slack
2af5e2681c
suppress warning log when no tracer type is set (#45115)
None is a valid tracer type that means "don't send traces", and using it should not cause a warning log "unknown tracer type" to be printed.
2022-12-03 11:45:45 -08:00
William Bezuidenhout
69def480a8
log15 migration: executor migrate log15 usage to sglog (#43683)
migrate log15 usage to sglog
2022-10-31 18:11:45 +02:00
Robert Lin
f7f606752f
internal/tracer: test switching tracing to sampling: none (#42524) 2022-10-04 18:14:55 -07:00
Robert Lin
75c42316a2
internal/tracer: only start OTEL spans if ShouldTrace is true (#42016)
Currently we rely on implementors to explicitly check ShouldTrace. This works implicitly through internal/trace/ot which guards against ShouldTrace and returns no-op OpenTracing tracers, which worked until we started moving code over to use OpenTelemetry libraries directly, where a similar guard was not implemented.

This wraps all tracers provided from the global switchable oteltrace.TracerProvider to only start spans when ShouldTrace evaluates to true without the caller having to do anything explicitly. It also updates ShouldTrace to respect global trace-all without requiring the context set.
2022-09-26 09:44:44 -07:00
Robert Lin
382be7fbf9
tracing: enable opentelemetry by default, remove legacy values (#41242)
Now that all our core deployment methods bundle OpenTelemetry Collector by default (#40456, #40457, #40455), we can now switch over to enabling OpenTelemetry by default. This change also:

- removes the default `traceURL` template, since the Jaeger instance it points to by default no longer exists on most deployments.
- fixes the behaviour of `observability.tracing` config, and adds testing
- refactors some things in `internal/trace` to be OpenTelemetry-first

Closes #39399
2022-09-07 17:29:52 +00:00
Robert Lin
21e4732739
otlp: treat OTEL_EXPORTER_OTLP_ENDPOINT='' as OpenTelemetry being disabled (#41243) 2022-09-02 08:17:04 -07:00
Robert Lin
09261ce73b
dev: enable OpenTelemetry by default in dev, improve tracer logging (#40946)
Since observability components are not run by default in sg start, we also amend the error logging of the exporter to suppress issues unless observability.tracing.debug is enabled.
2022-08-29 09:42:36 -07:00
Robert Lin
c17d41c170
internal/trace: back using OpenTelemetry span instead of OpenTracing (#40710)
Now that we export to Jaeger via OpenTelemetry instead of OpenTracing, we can remove a number of OpenTracing-specific things internally and instead operate purely on OpenTelemetry within internal/trace. OpenTracing calls elsewhere are all translated to OpenTelemetry via the OpenTracing bridge.

This allows us to start leveraging OpenTelemetry APIs more extensively - the codebase can now directly use go.opentelemetry.io/otel/trace, and internal/trace has been updated with the addition of:

- (*internal/trace.Trace).AddEvent - this is similar to LogFields, but now accepts a name in the OpenTelemetry spec
- (*internal/trace.Trace).SetAttributes - this is similar to TagFields, but uses the OpenTelemetry attributes API

And the deprecation of:

- (*internal/trace.Trace).LogFields (use AddEvent instead)
- (*internal/trace.Trace).TagFields (use SetAttributes instead)

As well as the removal of some old adapters that were specific to OpenTracing. Deprecated APIs will still work, passing through to the updated APIs.
2022-08-26 16:22:31 +00:00
Robert Lin
3feed36ed6
internal/tracer: use OpenTelemetry to do native Jaeger export (#40709)
Since we can provide a Jaeger exporter directly to the OpenTelemetry library, this allows us to provide capabilities similar to before while removing our dependency on OpenTracing/Jaeger, allowing us to streamline internal/trace considerably and allows the codebase to freely use OpenTracing or OpenTelemetry without worrying about compatibility (e.g. without this change, OpenTelemetry instrumentation like #39300 would not export via "observability.tracing": { "type": "jaeger" }")
2022-08-24 10:29:56 -07:00
Robert Lin
3feb8b49b4
tracer: make 'jaeger' the default, deprecate 'opentracing' option (#40442) 2022-08-17 08:06:12 -07:00
Robert Lin
51d92c3f0c
trace: allow configurable trace URL template (#39765)
Adds "observability.tracing": { "urlTemplate": "..." } for configuring where generated trace links point to. Preserves back-compat with existing behaviour if configured.
2022-08-02 17:26:25 +00:00
Robert Lin
5fca3bc904
debug: OpenTelemetry http/json tunnel on /-/debug/otlp (#39453)
Adds an OpenTelemetry protocol (OTLP) adapter tunnel through the frontend (backend), /-/debug/otlp, that accepts http/json OTLP requests and sends them to either a grpc or http/json OpenTelemetry collector (depending on the configured protocol).

We build an adapter because the OpenTelemetry collector is gRPC by default in most of its guidance, while browser environments can only support the http/json protocol. This allows admins to use their preferred OpenTelemetry backend of choice without worrying about compatibility with the http/json protocol. This is done by (ab)using OpenTelemetry collector (not the Go API) packages to partially implement an OpenTelemetry receiver on /-/debug/otlp - see the otlpadapter package for more details.
2022-08-02 14:09:41 +00:00
Robert Lin
e8a013edc3
tracer: use official otel spec for configuration (#38910)
We were previously using `OTEL_EXPORTER_OTLP_ENDPOINT` incorrectly - this update ensures we follow the official spec more closely: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options
2022-07-18 11:40:23 -07:00
Robert Lin
2d98b0901f
trace, tracer, errors, observation: add devx to CODENOTIFY (#38897) 2022-07-18 18:19:13 +02:00
Robert Lin
c85e6c57e8
internal/tracer/otel: add and use Jaeger propagator (#38503)
Turns out there's an Jaeger propagator we're supposed to use for the opentelemetry library. After enabling it and using the composite propagator on both ends of the tracer, we now have linked traces to Zoekt's opentelemetry Jaeger implementation again in Jaeger with opentelemetry enabled.
2022-07-11 21:18:21 +00:00
Robert Lin
47ba7b721b
mod: upgrade to opentelemetry-go@v1.8.0 (#38501)
This upgrades the opentelemetry-go dependency to the new 1.8.0 release,
which includes a patch to add support for TextMap baggage in the bridge tracer.
This means we no longer need our wrapper around the bridge, so we remove it.
2022-07-11 17:44:52 +00:00
Robert Lin
f8997ac5e1
internal/tracer: set swappable OpenTelemetry provider for OpenTelemetry libraries (#38499)
Allows us to leverage OpenTelemetry libraries for instrumentation.

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
2022-07-11 10:33:14 -07:00
Robert Lin
daa4e0e24c
internal/tracer: add OpenTelemetry tracer (#37984)
We extend internal/tracer to support a new tracer type, "opentelemetry", that sends everything in OpenTelemetry format using the OpenTracing bridge. See https://github.com/sourcegraph/sourcegraph/pull/37984 for more details.
2022-07-05 11:28:15 -07:00
Robert Lin
25dec337d9
internal/tracer: migrate to new logging library (#37973) 2022-06-29 16:50:48 -07:00
Robert Lin
6b5d426a3d
internal/trace: extract trace policy to OT-agnostic package (#37962)
This change extracts generic "should we trace" logic into a new package, `internal/trace/policy`, to disentangle it from the OpenTracing-specific `internal/trace/ot` package.
2022-06-29 14:31:35 -07:00
Robert Lin
9861a3a2c3
trace, profiler, router: remove datadog (#37654) 2022-06-27 14:05:11 -07:00
Keegan Carruthers-Smith
18f487ccaa
all: use any instead of interface{} (#35102)
Now that we require go1.18, we can use a builtin type alias for
"interface{}": "any". I've updated all code except lib, which can be
imported by external modules. That is currently pinned at go1.16.
Additionally I had to rerun generate since rewriting generated go code
will fail CI.

  find -name '*.go' | xargs gofmt -s -r 'interface{} -> any' -w
  git checkout lib
  go generate ./...

Test Plan: CI will exercise that the code still compiles. Otherwise this
is a noop.
2022-05-09 10:59:39 +02:00
Dax McDonald
2a20aea813
Configure Datadog analytics rate(#33984) 2022-04-19 11:23:24 -07:00
Dax McDonald
cf60895fa2
Support traceURLs with Datadog (#32024)
Add the same support for viewing traces on Sourcegraph Cloud as Grafana

Co-authored-by: Joe Chen <joe@sourcegraph.com>
2022-04-12 09:04:12 -07:00