Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
chore/otel-collector: upgrade to v0.103.0, remove jaegerexporter (#63171
Browse files Browse the repository at this point in the history
)

Thread:
https://sourcegraph.slack.com/archives/C1JH2BEHZ/p1717797870638299

One problem caused by this upgrade is that the [deprecated
`jaegerexporter`](open-telemetry/opentelemetry-specification#2858)
no longer builds at all with the last published version, so for the
upgrade to go through it must be removed. I've updated local `sg start`
to work with this change, but some Release team support is needed for
deployment configuration + customer-facing docs changes:
https://sourcegraph.slack.com/archives/C1JH2BEHZ/p1718143249191349?thread_ts=1717797870.638299&cid=C1JH2BEHZ,
since current guidance asks customers to configure `jaegerexporter`.

Part of https://linear.app/sourcegraph/issue/SEC-1680

Closes https://linear.app/sourcegraph/issue/CORE-177

## Test plan

Followed steps shared in
https://sourcegraph.slack.com/archives/C04MYFW01NV/p1718136211292469 to
run locally, since `sg run jaeger otel-collector` alone is insufficient
to get updated images:

```diff
diff --git a/wolfi-images/opentelemetry-collector.yaml b/wolfi-images/opentelemetry-collector.yaml
index b995a3d531b..76de80d4f84 100644
--- a/wolfi-images/opentelemetry-collector.yaml
+++ b/wolfi-images/opentelemetry-collector.yaml
@@ -7,7 +7,11 @@ contents:
     - mailcap
 
     ## opentelemetry-collector packages
-    - opentelemetry-collector@sourcegraph
+    - opentelemetry-collector@branch
+  keyring:
+    - https://packages.sgdev.org/sourcegraph-melange-dev.rsa.pub
+  repositories:
+    - '@Branch https://packages.sgdev.org/branches/otel-collector-upgrade'
 
 paths:
   - path: /otel-collector
```

plus `sg wolfi lock opentelemetry-collector` will make `sg run
otel-collector` use the correct image.

**The above diffs SHOULD NOT be committed. The lock should happen
post-merge.**

Spot-checked some traces locally with:

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


![image](https://github.com/sourcegraph/sourcegraph/assets/23356519/dff88d5a-db9a-4039-b7ba-682e120bdc41)


![image](https://github.com/sourcegraph/sourcegraph/assets/23356519/7e553894-0026-47de-ae38-ba5502b94c63)


## Changelog 

- OpenTelemetry Collector: Upgraded OpenTelemetry Collector to v0.103.0
- OpenTelemetry Collector: The [deprecated `jaegerexporter` has been
removed](open-telemetry/opentelemetry-specification#2858).
Users of `exporter: { jaeger: ... }` in the OpenTelemetry Collector
should use `exporter: { otlp/jaeger: ... }` to send traces directly to
Jaeger via its OTLP receiver.
- Users of the default Jaeger configurations now need to provide
`JAEGER_OTLP_GRPC_PORT` as well as the existing `JAEGER_HOST`
configuration.

---------

Co-authored-by: Anish Lakhwara <[email protected]>
Co-authored-by: Anish Lakhwara <[email protected]>
  • Loading branch information
3 people committed Jul 10, 2024
1 parent 8d0a77f commit b73dc20
Show file tree
Hide file tree
Showing 19 changed files with 440 additions and 390 deletions.
8 changes: 4 additions & 4 deletions cmd/frontend/internal/app/otlpadapter/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ func newExporter(
case otlpenv.ProtocolGRPC:
exporterFactory = otlpexporter.NewFactory()
tempConfig := exporterFactory.CreateDefaultConfig().(*otlpexporter.Config)
tempConfig.GRPCClientSettings.Endpoint = endpoint
tempConfig.GRPCClientSettings.TLSSetting = configtls.TLSClientSetting{
tempConfig.Endpoint = endpoint
tempConfig.TLSSetting = configtls.ClientConfig{
Insecure: otlpenv.IsInsecure(endpoint),
}
signalExporterConfig = tempConfig

case otlpenv.ProtocolHTTPJSON:
exporterFactory = otlphttpexporter.NewFactory()
tempConfig := exporterFactory.CreateDefaultConfig().(*otlphttpexporter.Config)
tempConfig.HTTPClientSettings.Endpoint = endpoint
tempConfig.Endpoint = endpoint
signalExporterConfig = tempConfig

default:
Expand All @@ -52,7 +52,7 @@ func newReceiver(receiverURL *url.URL) (receiver.Factory, component.Config) {
signalReceiverConfig := receiverFactory.CreateDefaultConfig().(*otlpreceiver.Config)
signalReceiverConfig.GRPC = nil // disable gRPC receiver, we don't need it
signalReceiverConfig.HTTP = &otlpreceiver.HTTPConfig{
HTTPServerSettings: &confighttp.HTTPServerSettings{
ServerConfig: &confighttp.ServerConfig{
Endpoint: receiverURL.Host,
},
// Set explicit defaults based on docstrings of each field.
Expand Down
12 changes: 6 additions & 6 deletions cmd/frontend/internal/app/otlpadapter/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ func Register(ctx context.Context, logger log.Logger, protocol otlpenv.Protocol,
{
PathPrefix: "/v1/traces",
CreateAdapter: func() (*signalAdapter, error) {
exporter, err := exporterFactory.CreateTracesExporter(ctx, exporter.CreateSettings{
exporter, err := exporterFactory.CreateTracesExporter(ctx, exporter.Settings{
ID: component.NewIDWithName(component.DataTypeTraces, componentName),
TelemetrySettings: telemetrySettings,
}, signalExporterConfig)
if err != nil {
return nil, errors.Wrap(err, "CreateTracesExporter")
}
receiver, err := receiverFactory.CreateTracesReceiver(ctx, receiver.CreateSettings{
receiver, err := receiverFactory.CreateTracesReceiver(ctx, receiver.Settings{
ID: component.NewIDWithName(component.DataTypeTraces, componentName),
TelemetrySettings: telemetrySettings,
}, signalReceiverConfig, exporter)
Expand All @@ -82,14 +82,14 @@ func Register(ctx context.Context, logger log.Logger, protocol otlpenv.Protocol,
{
PathPrefix: "/v1/metrics",
CreateAdapter: func() (*signalAdapter, error) {
exporter, err := exporterFactory.CreateMetricsExporter(ctx, exporter.CreateSettings{
exporter, err := exporterFactory.CreateMetricsExporter(ctx, exporter.Settings{
ID: component.NewIDWithName(component.DataTypeMetrics, componentName),
TelemetrySettings: telemetrySettings,
}, signalExporterConfig)
if err != nil {
return nil, errors.Wrap(err, "CreateMetricsExporter")
}
receiver, err := receiverFactory.CreateMetricsReceiver(ctx, receiver.CreateSettings{
receiver, err := receiverFactory.CreateMetricsReceiver(ctx, receiver.Settings{
ID: component.NewIDWithName(component.DataTypeMetrics, componentName),
TelemetrySettings: telemetrySettings,
}, signalReceiverConfig, exporter)
Expand All @@ -103,14 +103,14 @@ func Register(ctx context.Context, logger log.Logger, protocol otlpenv.Protocol,
{
PathPrefix: "/v1/logs",
CreateAdapter: func() (*signalAdapter, error) {
exporter, err := exporterFactory.CreateLogsExporter(ctx, exporter.CreateSettings{
exporter, err := exporterFactory.CreateLogsExporter(ctx, exporter.Settings{
ID: component.NewIDWithName(component.DataTypeLogs, componentName),
TelemetrySettings: telemetrySettings,
}, signalExporterConfig)
if err != nil {
return nil, errors.Wrap(err, "CreateLogsExporter")
}
receiver, err := receiverFactory.CreateLogsReceiver(ctx, receiver.CreateSettings{
receiver, err := receiverFactory.CreateLogsReceiver(ctx, receiver.Settings{
ID: component.NewIDWithName(component.DataTypeLogs, componentName),
TelemetrySettings: telemetrySettings,
}, signalReceiverConfig, exporter)
Expand Down
Loading

0 comments on commit b73dc20

Please sign in to comment.