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

支持达梦国产数据库 #5

Closed
lrwh opened this issue May 19, 2023 · 1 comment
Closed

支持达梦国产数据库 #5

lrwh opened this issue May 19, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@lrwh
Copy link
Collaborator

lrwh commented May 19, 2023

具体详见 GuanceCloud/dd-trace-java#39

@lrwh lrwh added the enhancement New feature or request label May 19, 2023
@lrwh lrwh self-assigned this May 19, 2023
@lrwh
Copy link
Collaborator Author

lrwh commented May 22, 2023

otel jdbc 主要是对java.sql.Driver 做了集成操作,而市面上几乎所有的关系型 db,特别是 java 领域,都是基于java.sql.Driver来实现驱动链接。所以基本上在不做任何改造的情况下,支持达梦数据库,这一点和 ddtrace 略有不同。

otel jdbc driver Instrumentation

  @Override
  public ElementMatcher<TypeDescription> typeMatcher() {
    return implementsInterface(named("java.sql.Driver"));
  }

对于实现 jdbc driver 的 db ,如果在 otel 为识别到类型,则会显示成other_sql

可以手动添加 dm 类型:

private static String toDbSystem(String type) {
    switch (type) {
      ...
      case "microsoft":
      case "sqlserver": // Microsoft SQL Server
        return DbSystemValues.MSSQL;
      case "sap": // SAP Hana
        return DbSystemValues.HANADB;
      case "dm": // dm database
        return "dm";
      default:
        return DbSystemValues.OTHER_SQL; // Unknown DBMS

效果如下:

1684723168003

lrwh pushed a commit that referenced this issue May 22, 2023
@lrwh lrwh closed this as completed May 26, 2023
@lrwh lrwh mentioned this issue May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant