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

feat(otlp): tracing parse body #2

Merged
merged 6 commits into from
Oct 20, 2023

Conversation

yuanbohan
Copy link
Collaborator

@yuanbohan yuanbohan commented Oct 19, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

to_grpc_insert_requests implementation

Please explain IN DETAIL what the changes are in this PR and why they are needed:

  • help to parse ExportTraceServiceRequest into grpc_insert_requests

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)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has totally checked 1352 files.

Valid Invalid Ignored Fixed
978 1 373 0
Click to see the invalid file list
  • src/servers/src/otlp/plugin.rs

src/servers/src/otlp/plugin.rs Show resolved Hide resolved
@yuanbohan yuanbohan force-pushed the feat/otlp_tracing_parse_body branch from eb5b549 to cdb1bfb Compare October 19, 2023 09:35
@yuanbohan yuanbohan changed the title Feat/otlp tracing parse body feat: Feat/otlp tracing parse body Oct 19, 2023
@yuanbohan yuanbohan changed the title feat: Feat/otlp tracing parse body feat(otlp): tracing parse body Oct 19, 2023
src/frontend/src/instance/otlp.rs Outdated Show resolved Hide resolved
src/servers/src/otlp/trace.rs Outdated Show resolved Hide resolved
src/servers/src/otlp/trace.rs Outdated Show resolved Hide resolved
@yuanbohan
Copy link
Collaborator Author

mysql> select * from traces_preview_v01 limit 1 \G;
*************************** 1. row ***************************
           trace_id: faf7c7d93c7af3ca7645667e36bed738
            span_id: 64647632db529e69
     parent_span_id: c3ce0598546e7434
           resource: {"telemetry.sdk.language":"python","service.name":"greptime-llm-langchain-example","telemetry.sdk.version":"1.20.0","telemetry.sdk.name":"opentelemetry"}
         scope_name: greptime-langchain-instrument
      scope_version: 0.1.0
   scope_attributes: {}
        trace_state:
          span_name: llm
          span_kind: SPAN_KIND_INTERNAL
   span_status_code: STATUS_CODE_OK
span_status_message:
    span_attributes: {"user_id":"2222"}
        span_events: ["{\"attrs\":\"{\\\"messages\\\":\\\"System: You are a helpful assistant\\\\nHuman: give me a boy name\\\",\\\"tags\\\":\\\"[]\\\",\\\"params\\\":\\\"{'model': 'gpt-3.5-turbo', 'model_name': 'gpt-3.5-turbo', 'request_timeout': None, 'max_tokens': None, 'stream': False, 'n': 1, 'temperature': 0.7, '_type': 'openai-chat', 'stop': None}\\\",\\\"type\\\":\\\"ChatOpenAI\\\",\\\"serialized\\\":\\\"{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'chat_models', 'openai', 'ChatOpenAI'], 'kwargs': {'openai_api_key': {'lc': 1, 'type': 'secret', 'id': ['OPENAI_API_KEY']}}}\\\",\\\"metadata\\\":\\\"{'user_id': '2222'}\\\"}\",\"name\":\"chat_model_start\",\"time\":\"[TimeNanosecond: 1697727227416701000]\"}","{\"attrs\":\"{\\\"model\\\":\\\"gpt-3.5-turbo\\\",\\\"outputs\\\":\\\"[\\\\\\\"{'text': 'Here are some popular boy names:\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\n1. Liam\\\\\\\\\\\\\\\\n2. Noah\\\\\\\\\\\\\\\\n3. Ethan\\\\\\\\\\\\\\\\n4. Oliver\\\\\\\\\\\\\\\\n5. Benjamin\\\\\\\\\\\\\\\\n6. William\\\\\\\\\\\\\\\\n7. James\\\\\\\\\\\\\\\\n8. Henry\\\\\\\\\\\\\\\\n9. Alexander\\\\\\\\\\\\\\\\n10. Samuel', 'finish_reason': 'stop', 'log_probability': None, 'additional_kwargs': {}, 'type': 'ai'}\\\\\\\"]\\\",\\\"prompt_tokens\\\":\\\"21\\\",\\\"completion_tokens\\\":\\\"46\\\"}\",\"name\":\"llm_end\",\"time\":\"[TimeNanosecond: 1697727234269515000]\"}"]
         span_links: []
              start: 2023-10-19 22:53:47.416695
                end: 2023-10-19 22:53:54.269533
     greptime_value: 6852.838
 greptime_timestamp: 2023-10-19 22:53:47.416
1 row in set (0.04 sec)

ERROR:
No query specified

mysql> show create table traces_preview_v01;
+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table              | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| traces_preview_v01 | CREATE TABLE IF NOT EXISTS `traces_preview_v01` (
  `trace_id` STRING NULL,
  `span_id` STRING NULL,
  `parent_span_id` STRING NULL,
  `resource` STRING NULL,
  `scope_name` STRING NULL,
  `scope_version` STRING NULL,
  `scope_attributes` STRING NULL,
  `trace_state` STRING NULL,
  `span_name` STRING NULL,
  `span_kind` STRING NULL,
  `span_status_code` STRING NULL,
  `span_status_message` STRING NULL,
  `span_attributes` STRING NULL,
  `span_events` STRING NULL,
  `span_links` STRING NULL,
  `start` TIMESTAMP(9) NULL,
  `end` TIMESTAMP(9) NULL,
  `greptime_value` DOUBLE NULL,
  `greptime_timestamp` TIMESTAMP(3) NOT NULL,
  TIME INDEX (`greptime_timestamp`),
  PRIMARY KEY (`trace_id`, `span_id`, `parent_span_id`)
)

ENGINE=mito
WITH(
  regions = 1
) |
+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

@yuanbohan yuanbohan force-pushed the feat/otlp_tracing_parse_body branch from e2bd452 to d3761df Compare October 20, 2023 02:44
@yuanbohan yuanbohan merged commit 752843a into feat/otlp_tracing Oct 20, 2023
7 of 10 checks passed
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