Repository: lightstep/otel-launcher-go
Pull request #305 (2022-10-06 17:50:42)

add distro attributes
**Description:** <Describe what has changed. 
These attributes will allow us to differentiate between users that are using the lightstep distro to emit data for implementations that are not substituting SDKs

**Testing:**
Added unit tests


codeboten: I bumped the go version for the build to 1.19.2 to see if it solves the issue


Patch:
diff --git a/launcher/config.go b/launcher/config.go
index 8457176..bb45e96 100644
--- a/launcher/config.go
+++ b/launcher/config.go
@@ -333,6 +333,8 @@ func newResource(c *Config) *resource.Resource {
 		semconv.TelemetrySDKNameKey.String("launcher"),
 		semconv.TelemetrySDKLanguageGo,
 		semconv.TelemetrySDKVersionKey.String(version),
+		attribute.String("telemetry.distro.name", "lightstep"),
+		attribute.String("telemetry.distro.version", version),
 	}
 
 	if len(c.ServiceName) > 0 {
diff --git a/lightstep/sdk/metric/exporters/otlp/internal/otlpconfig/envconfig.go b/lightstep/sdk/metric/exporters/otlp/internal/otlpconfig/envconfig.go
index 4893e4c..afb6c54 100644
--- a/lightstep/sdk/metric/exporters/otlp/internal/otlpconfig/envconfig.go
+++ b/lightstep/sdk/metric/exporters/otlp/internal/otlpconfig/envconfig.go
@@ -16,7 +16,6 @@ package otlpconfig // import "github.com/lightstep/otel-launcher-go/lightstep/sd
 
 import (
 	"crypto/tls"
-	"io/ioutil"
 	"net/url"
 	"os"
 	"path"
@@ -29,7 +28,7 @@ import (
 // DefaultEnvOptionsReader is the default environments reader.
 var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{
 	GetEnv:    os.Getenv,
-	ReadFile:  ioutil.ReadFile,
+	ReadFile:  os.ReadFile,
 	Namespace: "OTEL_EXPORTER_OTLP",
 }
 
diff --git a/lightstep/sdk/metric/exporters/otlp/internal/otlpconfig/tls.go b/lightstep/sdk/metric/exporters/otlp/internal/otlpconfig/tls.go
index f8b1bdd..7497d70 100644
--- a/lightstep/sdk/metric/exporters/otlp/internal/otlpconfig/tls.go
+++ b/lightstep/sdk/metric/exporters/otlp/internal/otlpconfig/tls.go
@@ -18,13 +18,13 @@ import (
 	"crypto/tls"
 	"crypto/x509"
 	"errors"
-	"io/ioutil"
+	"os"
 )
 
 // ReadTLSConfigFromFile reads a PEM certificate file and creates
 // a tls.Config that will use this certifate to verify a server certificate.
 func ReadTLSConfigFromFile(path string) (*tls.Config, error) {
-	b, err := ioutil.ReadFile(path)
+	b, err := os.ReadFile(path)
 	if err != nil {
 		return nil, err
 	}


Test patch:
diff --git a/launcher/config_test.go b/launcher/config_test.go
index 2fbf016..b94bf37 100644
--- a/launcher/config_test.go
+++ b/launcher/config_test.go
@@ -364,6 +364,8 @@ func (suite *testSuite) TestDefaultConfig() {
 		attribute.String("telemetry.sdk.name", "launcher"),
 		attribute.String("telemetry.sdk.language", "go"),
 		attribute.String("telemetry.sdk.version", version),
+		attribute.String("telemetry.distro.name", "lightstep"),
+		attribute.String("telemetry.distro.version", version),
 	}
 
 	expected := Config{
@@ -405,6 +407,8 @@ func (suite *testSuite) TestEnvironmentVariables() {
 		attribute.String("telemetry.sdk.name", "launcher"),
 		attribute.String("telemetry.sdk.language", "go"),
 		attribute.String("telemetry.sdk.version", version),
+		attribute.String("telemetry.distro.name", "lightstep"),
+		attribute.String("telemetry.distro.version", version),
 	}
 
 	expected := Config{
@@ -458,6 +462,8 @@ func (suite *testSuite) TestConfigurationOverrides() {
 		attribute.String("host.name", host()),
 		attribute.String("service.name", "override-service-name"),
 		attribute.String("service.version", "override-service-version"),
+		attribute.String("telemetry.distro.name", "lightstep"),
+		attribute.String("telemetry.distro.version", version),
 		attribute.String("telemetry.sdk.name", "launcher"),
 		attribute.String("telemetry.sdk.language", "go"),
 		attribute.String("telemetry.sdk.version", version),
@@ -580,6 +586,8 @@ func (suite *testSuite) TestConfigureResourcesAttributes() {
 		attribute.String("label2", "value2"),
 		attribute.String("service.name", "test-service"),
 		attribute.String("service.version", "test-version"),
+		attribute.String("telemetry.distro.name", "lightstep"),
+		attribute.String("telemetry.distro.version", version),
 		attribute.String("telemetry.sdk.language", "go"),
 		attribute.String("telemetry.sdk.name", "launcher"),
 		attribute.String("telemetry.sdk.version", version),
@@ -596,6 +604,8 @@ func (suite *testSuite) TestConfigureResourcesAttributes() {
 		attribute.String("host.name", host()),
 		attribute.String("service.name", "test-service"),
 		attribute.String("service.version", "test-version"),
+		attribute.String("telemetry.distro.name", "lightstep"),
+		attribute.String("telemetry.distro.version", version),
 		attribute.String("telemetry.sdk.language", "go"),
 		attribute.String("telemetry.sdk.name", "launcher"),
 		attribute.String("telemetry.sdk.version", version),
@@ -612,6 +622,8 @@ func (suite *testSuite) TestConfigureResourcesAttributes() {
 		attribute.String("host.name", "host123"),
 		attribute.String("service.name", "test-service-b"),
 		attribute.String("service.version", "test-version"),
+		attribute.String("telemetry.distro.name", "lightstep"),
+		attribute.String("telemetry.distro.version", version),
 		attribute.String("telemetry.sdk.language", "go"),
 		attribute.String("telemetry.sdk.name", "launcher"),
 		attribute.String("telemetry.sdk.version", version),