Comments (7)
How are timestamps supposed to be serialized when exporting OpenTelemetry metrics in JSON format? Is it nanoseconds since epoch or RFC 3339?
It is not RFC 3339. See the time_unix_nano field definition here:
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
// 1970.
There seems to be conflicting guidelines in the spec:
- OpenTelemetry file exporter provides examples where timestamps are serialized as the number of nanoseconds since epoch, e.g.
"endTimeUnixNano":"1581452773000000789"
- The file is https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/file-exporter.md
The example is correct.
- In the JSON protobuf encoding, there is a link to https://protobuf.dev/programming-guides/proto3/#json, which states timestamps should be encoded as RFC 3339, e.g.,
"1972-01-01T10:00:20.021Z"
This guidance is not applicable to OTLP. The timestamp fields in OTLP are fixed64
. The guidance you are referring to is about Timestamp data type that is distinct from fixed64
.
The applicable language in OTLP spec is the following:
Note that according to [Protobuf specs](
https://developers.google.com/protocol-buffers/docs/proto3#json) 64-bit integer
numbers in JSON-encoded payloads are encoded as decimal strings, and either
numbers or strings are accepted when decoding.
We can add clarification to the spec to make it clearer, I created an issue for that: #460
from opentelemetry-proto.
I have a bunch of metrics and logs examples in JSON, that I use to try things out, as it's easier to create arbitrary JSON OTLP. If you want I can try working on this :)
from opentelemetry-proto.
I have a bunch of metrics and logs examples in JSON, that I use to try things out, as it's easier to create arbitrary JSON OTLP. If you want I can try working on this :)
It would be great to have some examples. Please feel free to submit a PR.
from opentelemetry-proto.
Zipkin also shows how it would be rendered in GUI https://zipkin.io/pages/data_model.html
from opentelemetry-proto.
How are timestamps supposed to be serialized when exporting OpenTelemetry metrics in JSON format? Is it nanoseconds since epoch or RFC 3339? There seems to be conflicting guidelines in the spec:
- OpenTelemetry file exporter provides examples where timestamps are serialized as the number of nanoseconds since epoch, e.g.
"endTimeUnixNano":"1581452773000000789"
- The file is https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/file-exporter.md - In the JSON protobuf encoding, there is a link to https://protobuf.dev/programming-guides/proto3/#json, which states timestamps should be encoded as RFC 3339, e.g.,
"1972-01-01T10:00:20.021Z"
Presumably the JSON protobuf encoding section is normative (hence RFC 3339), whereas the examples in the "file exporter" section are just examples that may not have been updated? Or maybe the intent was that somehow the timestamps for the file exporter in JSON format are supposed to use the number of nanoseconds since the epoch?
from opentelemetry-proto.
I moved this issue to https://github.com/open-telemetry/opentelemetry-proto since that's where the OTLP spec is now.
from opentelemetry-proto.
I put up a PR for it #463.
from opentelemetry-proto.
Related Issues (20)
- Unclear whether Span.flags represents span's parent or own flags HOT 10
- Fix releasing notes HOT 3
- Allow consumers to use map<string, AnyValue> instead of repeated KeyValue HOT 3
- Generated OpenAPI files wrongly encode enums
- Improve metrics.proto by mentioning Resource Attributes and Scope HOT 1
- How to use Java service to receive data in the OpenTelemetry (Otel) protocol? HOT 4
- Supporting JSON as-is encoding in OTLP HOT 2
- SPAN_FLAGS_TRACE_FLAGS_MASK is not defined HOT 3
- Fail to push limit HOT 5
- Retryable HTTP Statuses should be configurable HOT 3
- Specify version of the proto that introduced a field in the comments
- File Makefile with executable permissions HOT 2
- Fix outdated attribute examples in comments
- Example not available for Exponential Histogram & Summary metric types
- Define relationship between profile messages and pprof HOT 1
- Consider generalizing profile attributes optimization to other signals
- Why is AggregationTemporality redefined pprofextended.proto HOT 2
- profiling spec - definition of common string values HOT 2
- In pprofextended proto, consider moving Location.type_index to Mapping HOT 4
- Probably unintentional proto field ID gaps in the Sample message in pprofextended
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentelemetry-proto.