Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .lycheeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ localhost:14250
file:///var/log/logs.jsonl
file:///var/log/metrics.jsonl
file:///var/log/traces.jsonl
file:///path/to/file.jsonl
file:///path/to/file.jsonl
https://raw.githubusercontent.com/open-telemetry/opentelemetry.io/main/content/en/registry
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

- Removed the deprecated zipkin exporter example in `go.opentelemetry.io/contrib/examples/zipkin`. (#8501)

### Changed

- Updated the configuration schema used in `go.opentelemetry.io/contrib/otelconf` to [rc.3](https://github.com/open-telemetry/opentelemetry-configuration/releases/tag/v1.0.0-rc.3). (#8505)

<!-- Released section -->
<!-- Don't change this section unless doing release -->

Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,6 @@ update-all-otel-deps:
# The source directory for opentelemetry-configuration schema.
OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_SRC_DIR=tmp/opentelemetry-configuration

# The SHA matching the current version of the opentelemetry-configuration schema to use
OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_VERSION=v1.0.0-rc.2

# Cleanup temporary directory
genjsonschema-cleanup:
rm -Rf ${OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_SRC_DIR}
Expand All @@ -334,15 +331,15 @@ GENERATED_CONFIG=./otelconf/generated_config.go
# Generate structs for configuration from opentelemetry-configuration schema
genjsonschema: genjsonschema-cleanup $(GOJSONSCHEMA)
mkdir -p ${OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_SRC_DIR}
curl -sSL https://api.github.com/repos/open-telemetry/opentelemetry-configuration/tarball/${OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_VERSION} | tar xz --strip 1 -C ${OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_SRC_DIR}
curl -sSL https://api.github.com/repos/open-telemetry/opentelemetry-configuration/tarball/v1.0.0-rc.3 | tar xz --strip 1 -C ${OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_SRC_DIR}
$(GOJSONSCHEMA) \
--capitalization ID \
--capitalization OTLP \
--struct-name-from-title \
--package otelconf \
--only-models \
--output ${GENERATED_CONFIG} \
${OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_SRC_DIR}/schema/opentelemetry_configuration.json
${OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_SRC_DIR}/opentelemetry_configuration.json
@echo Modify jsonschema generated files.
sed -f ./otelconf/jsonschema_patch.sed ${GENERATED_CONFIG} > ${GENERATED_CONFIG}.tmp
mv ${GENERATED_CONFIG}.tmp ${GENERATED_CONFIG}
Expand Down
63 changes: 18 additions & 45 deletions otelconf/config_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ func (j *PushMetricExporter) UnmarshalJSON(b []byte) error {
}

if sh.Console != nil {
var c ConsoleExporter
var c ConsoleMetricExporter
if err := json.Unmarshal(sh.Console, &c); err != nil {
return err
}
sh.Plain.Console = c
sh.Plain.Console = &c
}
*j = PushMetricExporter(sh.Plain)
return nil
Expand Down Expand Up @@ -458,47 +458,47 @@ func (j *OpenTelemetryConfiguration) UnmarshalJSON(b []byte) error {
}

if sh.LoggerProvider != nil {
var l LoggerProviderJson
var l LoggerProvider
if err := json.Unmarshal(sh.LoggerProvider, &l); err != nil {
return errors.Join(newErrUnmarshal(j), err)
}
sh.Plain.LoggerProvider = &l
}

if sh.MeterProvider != nil {
var m MeterProviderJson
var m MeterProvider
if err := json.Unmarshal(sh.MeterProvider, &m); err != nil {
return errors.Join(newErrUnmarshal(j), err)
}
sh.Plain.MeterProvider = &m
}

if sh.TracerProvider != nil {
var t TracerProviderJson
var t TracerProvider
if err := json.Unmarshal(sh.TracerProvider, &t); err != nil {
return errors.Join(newErrUnmarshal(j), err)
}
sh.Plain.TracerProvider = &t
}

if sh.Propagator != nil {
var p PropagatorJson
var p Propagator
if err := json.Unmarshal(sh.Propagator, &p); err != nil {
return errors.Join(newErrUnmarshal(j), err)
}
sh.Plain.Propagator = &p
}

if sh.Resource != nil {
var r ResourceJson
var r Resource
if err := json.Unmarshal(sh.Resource, &r); err != nil {
return errors.Join(newErrUnmarshal(j), err)
}
sh.Plain.Resource = &r
}

if sh.InstrumentationDevelopment != nil {
var r InstrumentationJson
var r ExperimentalInstrumentation
if err := json.Unmarshal(sh.InstrumentationDevelopment, &r); err != nil {
return errors.Join(newErrUnmarshal(j), err)
}
Expand Down Expand Up @@ -530,7 +530,7 @@ func (j *OpenTelemetryConfiguration) UnmarshalJSON(b []byte) error {
} else {
// Configure the log level of the internal logger used by the SDK.
// If omitted, info is used.
sh.Plain.LogLevel = ptr("info")
sh.Plain.LogLevel = ptr(SeverityNumberInfo)
}

*j = OpenTelemetryConfiguration(sh.Plain)
Expand Down Expand Up @@ -689,21 +689,19 @@ func (j *OTLPGrpcExporter) UnmarshalJSON(b []byte) error {

// UnmarshalJSON implements json.Unmarshaler.
func (j *AttributeType) UnmarshalJSON(b []byte) error {
var v struct {
Value any
}
if err := json.Unmarshal(b, &v.Value); err != nil {
var v string
if err := json.Unmarshal(b, &v); err != nil {
return errors.Join(newErrUnmarshal(j), err)
}
var ok bool
for _, expected := range enumValuesAttributeType {
if reflect.DeepEqual(v.Value, expected) {
if reflect.DeepEqual(v, expected) {
ok = true
break
}
}
if !ok {
return newErrInvalid(fmt.Sprintf("unexpected value type %#v, expected one of %#v)", v.Value, enumValuesAttributeType))
return newErrInvalid(fmt.Sprintf("unexpected value type %#v, expected one of %#v)", v, enumValuesAttributeType))
}
*j = AttributeType(v)
return nil
Expand Down Expand Up @@ -735,14 +733,14 @@ func (j *AttributeNameValue) UnmarshalJSON(b []byte) error {
}

// json unmarshaller defaults to unmarshalling to float for int values
if sh.Type != nil && sh.Type.Value == "int" {
if sh.Type != nil && *sh.Type == AttributeTypeInt {
val, ok := sh.Plain.Value.(float64)
if ok {
sh.Plain.Value = int(val)
}
}

if sh.Type != nil && sh.Type.Value == "int_array" {
if sh.Type != nil && *sh.Type == AttributeTypeIntArray {
m, ok := sh.Plain.Value.([]any)
if ok {
var vals []any
Expand Down Expand Up @@ -806,31 +804,6 @@ func (j *SimpleSpanProcessor) UnmarshalJSON(b []byte) error {
return nil
}

// UnmarshalJSON implements json.Unmarshaler.
func (j *ZipkinSpanExporter) UnmarshalJSON(b []byte) error {
type Plain ZipkinSpanExporter
type shadow struct {
Plain
Endpoint json.RawMessage `json:"endpoint"`
}
var sh shadow
if err := json.Unmarshal(b, &sh); err != nil {
return errors.Join(newErrUnmarshal(j), err)
}
if sh.Endpoint == nil {
return newErrRequired(j, "endpoint")
}

if err := json.Unmarshal(sh.Endpoint, &sh.Plain.Endpoint); err != nil {
return err
}
if sh.Timeout != nil && 0 > *sh.Timeout {
return newErrGreaterOrEqualZero("timeout")
}
*j = ZipkinSpanExporter(sh.Plain)
return nil
}

// UnmarshalJSON implements json.Unmarshaler.
func (j *NameStringValuePair) UnmarshalJSON(b []byte) error {
type Plain NameStringValuePair
Expand Down Expand Up @@ -874,8 +847,8 @@ func (j *InstrumentType) UnmarshalJSON(b []byte) error {
}

// UnmarshalJSON implements json.Unmarshaler.
func (j *ExperimentalPeerInstrumentationServiceMappingElem) UnmarshalJSON(b []byte) error {
type Plain ExperimentalPeerInstrumentationServiceMappingElem
func (j *ExperimentalPeerServiceMapping) UnmarshalJSON(b []byte) error {
type Plain ExperimentalPeerServiceMapping
type shadow struct {
Plain
Peer json.RawMessage `json:"peer"`
Expand All @@ -898,7 +871,7 @@ func (j *ExperimentalPeerInstrumentationServiceMappingElem) UnmarshalJSON(b []by
return errors.Join(newErrUnmarshal(j), err)
}

*j = ExperimentalPeerInstrumentationServiceMappingElem(sh.Plain)
*j = ExperimentalPeerServiceMapping(sh.Plain)
return nil
}

Expand Down
Loading