Skip to content

fix: OTLP JSON Event example body#666

Merged
reyang merged 3 commits intoopen-telemetry:mainfrom
IgorPidik:ip/fix-event-example
Jun 17, 2025
Merged

fix: OTLP JSON Event example body#666
reyang merged 3 commits intoopen-telemetry:mainfrom
IgorPidik:ip/fix-event-example

Conversation

@IgorPidik
Copy link
Copy Markdown
Contributor

What

  • fix events.json example by wrapping kvlistValue content in a values property
  • fix indentation

Why

Following the example README and running

$ curl -X POST -H "Content-Type: application/json" -d @events.json -i localhost:4318/v1/logs

results in

HTTP/1.1 400 Bad Request
Content-Type: application/json
Vary: Origin
Date: Sat, 31 May 2025 13:29:10 GMT
Content-Length: 253

{"code":3,"message":"ReadObjectCB: expect { or n, but found [, error found in #10 byte of ...|tValue\": [          |..., bigger context ...|         \"body\": {                \"kvlistValue\": [                  {                    \"key\": \"typ|..."}%

Seems like the kvlistValue(KeyValueList) values need to be wrapped in a values property.

After fixing the example the request response and collector output seem fine:

HTTP/1.1 200 OK
Content-Type: application/json
Vary: Origin
Date: Sat, 31 May 2025 12:31:00 GMT
Content-Length: 21

{"partialSuccess":{}}

collector output:

collector-otel-collector-1  | 2025-05-31T13:29:24.995Z  info    Logs    {"resource": {}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "logs", "resource logs": 1, "log records": 1}
collector-otel-collector-1  | 2025-05-31T13:29:24.996Z  info    ResourceLog #0
collector-otel-collector-1  | Resource SchemaURL:
collector-otel-collector-1  | Resource attributes:
collector-otel-collector-1  |      -> service.name: Str(my.service)
collector-otel-collector-1  | ScopeLogs #0
collector-otel-collector-1  | ScopeLogs SchemaURL:
collector-otel-collector-1  | InstrumentationScope my.library 1.0.0
collector-otel-collector-1  | InstrumentationScope attributes:
collector-otel-collector-1  |      -> my.scope.attribute: Str(some scope attribute)
collector-otel-collector-1  | LogRecord #0
collector-otel-collector-1  | ObservedTimestamp: 2018-12-13 14:51:00.3 +0000 UTC
collector-otel-collector-1  | Timestamp: 2018-12-13 14:51:00.3 +0000 UTC
collector-otel-collector-1  | SeverityText:
collector-otel-collector-1  | SeverityNumber: Info(9)
collector-otel-collector-1  | Body: Map({"referrer":"https://wwww.google.com","title":"Free Online GUID Generator","type":0,"url":"https://www.guidgenerator.com/online-guid-generator.aspx"})
collector-otel-collector-1  | Attributes:
collector-otel-collector-1  |      -> event.name: Str(browser.page_view)
collector-otel-collector-1  | Trace ID:
collector-otel-collector-1  | Span ID:
collector-otel-collector-1  | Flags: 0
collector-otel-collector-1  |   {"resource": {}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "logs"}

Tested using docker image otel/opentelemetry-collector-contrib:0.127.0

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 31, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: IgorPidik / name: Igor Pidik (df49074, b586e42)
  • ✅ login: reyang / name: Reiley Yang (a2bbb1e)

@IgorPidik IgorPidik marked this pull request as ready for review May 31, 2025 14:05
@IgorPidik IgorPidik requested a review from a team May 31, 2025 14:05
Comment thread examples/events.json Outdated
@reyang reyang merged commit b594790 into open-telemetry:main Jun 17, 2025
13 of 15 checks passed
@pellared pellared mentioned this pull request Aug 29, 2025
tigrannajaryan pushed a commit that referenced this pull request Sep 2, 2025
### Changed

- profiles: drop gzip requirement. [#661](#661)
- profiles: avoid `optional` keyword usage. [#659](#659)
- profiles: make `profile_id` optional. [#665](#665)
- profiles: use single `Profile.sample_type` and clarify use of timestamps. [#649](#649)
- all: add notes about the attribute values restrictions. [#683](https://github.com/open-telemetry/opentelemetry-proto/pull/683)<br>⚠️ **IMPORTANT**: These restrictions can be dropped in a future minor release.
- profiles: clarify usage of the zero value as the first element of tables in `ProfilesDictionary`. [#688](#688), [#698](#698)
- profiles: unsigned `time_nanos` and `duration_nanos` in `Profile`. [#692](#692)
- profiles: improve attribute encoding in `ProfilesDictionary`. [#672](#672)
- profiles: simplify profile stack trace representation. [#708](#708)

### Fixed

- examples: fix OTLP JSON Event example body. [#666](#666)
- docs: minor specification fixes around `UNAVAILABLE` and `RetryInfo`. [#669](#669)

### Removed

- profiles: remove `default_sample_type`. [#679](#679)
- profiles: remove `has_*` debug info fields, they are moving to attributes. [#595](#595)
- profiles: remove `Location.is_folded`. [#690](#690)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants