Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adjust traces schema order #17

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

shuiyisong
Copy link

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This pr does

  1. re-order the schema of trace table
    • rename greptime_timestamp to timestamp, and remove start as it's virtually timestamp
    • rename end to timestamp_end
    • rename greptime_value to duration_nano and use nano-second resolution
  2. remove uplifted_span_attributes as it's not used by now

previous it's

resource_attributes: {"service.name":"telemetrygen"}
   scope_attributes: {}
    span_attributes: {"net.peer.ip":"1.2.3.4","peer.service":"telemetrygen-server"}
        span_events: []
         span_links: []
         scope_name: telemetrygen
      scope_version:
        trace_state:
          span_name: lets-go
          span_kind: SPAN_KIND_CLIENT
   span_status_code: STATUS_CODE_UNSET
span_status_message:
              start: 2024-11-06 06:22:27.165664
                end: 2024-11-06 06:22:27.165787
     greptime_value: 0.123
 greptime_timestamp: 2024-11-06 06:22:27.165664

current schema order looks like this

mysql> desc table opentelemetry_traces;
+---------------------+---------------------+------+------+---------+---------------+
| Column              | Type                | Key  | Null | Default | Semantic Type |
+---------------------+---------------------+------+------+---------+---------------+
| timestamp           | TimestampNanosecond | PRI  | NO   |         | TIMESTAMP     |
| timestamp_end       | TimestampNanosecond |      | YES  |         | FIELD         |
| duration_nano       | UInt64              |      | YES  |         | FIELD         |
| trace_id            | String              | PRI  | YES  |         | TAG           |
| span_id             | String              | PRI  | YES  |         | TAG           |
| parent_span_id      | String              | PRI  | YES  |         | TAG           |
| span_kind           | String              |      | YES  |         | FIELD         |
| span_name           | String              |      | YES  |         | FIELD         |
| span_status_code    | String              |      | YES  |         | FIELD         |
| span_status_message | String              |      | YES  |         | FIELD         |
| trace_state         | String              |      | YES  |         | FIELD         |
| span_attributes     | Json                |      | YES  |         | FIELD         |
| span_events         | Json                |      | YES  |         | FIELD         |
| span_links          | Json                |      | YES  |         | FIELD         |
| scope_name          | String              |      | YES  |         | FIELD         |
| scope_version       | String              |      | YES  |         | FIELD         |
| scope_attributes    | Json                |      | YES  |         | FIELD         |
| resource_attributes | Json                |      | YES  |         | FIELD         |
+---------------------+---------------------+------+------+---------+---------------+

mysql> select * from opentelemetry_traces limit 1 \G
*************************** 1. row ***************************
          timestamp: 2024-11-06 09:00:08.683361
      timestamp_end: 2024-11-06 09:00:08.683484
      duration_nano: 123000
           trace_id: 00199db0d11280be936dcebca7ba9242
            span_id: 780762eca93c875b
     parent_span_id: ee86ff781d286405
          span_kind: SPAN_KIND_SERVER
          span_name: okey-dokey-0
   span_status_code: STATUS_CODE_UNSET
span_status_message:
        trace_state:
    span_attributes: {"net.peer.ip":"1.2.3.4","peer.service":"telemetrygen-client"}
        span_events: []
         span_links: []
         scope_name: telemetrygen
      scope_version:
   scope_attributes: {}
resource_attributes: {"service.name":"telemetrygen"}
1 row in set (0.01 sec)

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@paomian paomian merged commit e9f36b3 into paomian:otlp/trace Nov 7, 2024
33 of 35 checks passed
@shuiyisong shuiyisong deleted the chore/adjust_otlp branch November 7, 2024 08:31
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.

2 participants