apiVersion: v1
kind: ConfigMap
metadata:
  name: oap-config
  namespace: skywalking
data:
  application.yml: |-
    cluster:
      kubernetes:
        watchTimeoutSeconds: ${SW_CLUSTER_K8S_WATCH_TIMEOUT:60}
        namespace: ${SW_CLUSTER_K8S_NAMESPACE:skywalking}   #注意这里名称空间哦
        labelSelector: ${SW_CLUSTER_K8S_LABEL:app=oap,release=skywalking}
        uidEnvName: ${SW_CLUSTER_K8S_UID:SKYWALKING_COLLECTOR_UID}
    core:
      default:
        role: ${SW_CORE_ROLE:Mixed} # Mixed/Receiver/Aggregator
        restHost: ${SW_CORE_REST_HOST:0.0.0.0}
        restPort: ${SW_CORE_REST_PORT:12800}
        restContextPath: ${SW_CORE_REST_CONTEXT_PATH:/}
        gRPCHost: ${SW_CORE_GRPC_HOST:0.0.0.0}
        gRPCPort: ${SW_CORE_GRPC_PORT:11800}
        downsampling:
        - Hour
        - Day
        - Month
        enableDataKeeperExecutor: ${SW_CORE_ENABLE_DATA_KEEPER_EXECUTOR:true} # Turn it off then automatically metrics data delete will be close.
        recordDataTTL: ${SW_CORE_RECORD_DATA_TTL:90} # Unit is minute
        recordDataTTL: ${SW_CORE_RECORD_DATA_TTL:90} # Unit is minute
        minuteMetricsDataTTL: ${SW_CORE_MINUTE_METRIC_DATA_TTL:90} # Unit is minute
        hourMetricsDataTTL: ${SW_CORE_HOUR_METRIC_DATA_TTL:36} # Unit is hour
        dayMetricsDataTTL: ${SW_CORE_DAY_METRIC_DATA_TTL:45} # Unit is day
        monthMetricsDataTTL: ${SW_CORE_MONTH_METRIC_DATA_TTL:18} # Unit is month
        enableDatabaseSession: ${SW_CORE_ENABLE_DATABASE_SESSION:true}
    storage:
      mysql:
        metadataQueryMaxSize: ${SW_STORAGE_H2_QUERY_MAX_SIZE:5000}
    receiver-sharing-server:
      default:
        restHost: ${SW_RECEIVER_SHARING_REST_HOST:0.0.0.O}
        restPort: ${SW_RECEIVER_SHARING_REST_PORT:0}
        restContextPath: ${SW_RECEIVER_SHARING_REST_CONTEXT_PATH:/}
        gRPCHost: ${SW_RECEIVER_SHARING_GRPC_HOST:0.0.0.O}
        gRPCPort: ${SW_RECEIVER_SHARING_GRPC_PORT:0}
        maxConcurrentCallsPerConnection: ${SW_RECEIVER_SHARING_MAX_CONCURRENT_CALL:0}
        maxMessageSize: ${SW_RECEIVER_SHARING_MAX_MESSAGE_SIZE:0}
        gRPCThreadPoolSize: ${SW_RECEIVER_SHARING_GRPC_THREAD_POOL_SIZE:0}
        gRPCThreadPoolQueueSize: ${SW_RECEIVER_SHARING_GRPC_THREAD_POOL_QUEUE_SIZE:0}
    receiver-register:
      default:
    receiver-trace:
      default:
        bufferPath: ${SW_RECEIVER_BUFFER_PATH:../trace-buffer/}  # Path to trace buffer files, suggest to use absolute path
        bufferOffsetMaxFileSize: ${SW_RECEIVER_BUFFER_OFFSET_MAX_FILE_SIZE:100} # Unit is MB
        bufferDataMaxFileSize: ${SW_RECEIVER_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB
        bufferFileCleanWhenRestart: ${SW_RECEIVER_BUFFER_FILE_CLEAN_WHEN_RESTART:false}
        sampleRate: ${SW_TRACE_SAMPLE_RATE:10000} # The sample rate precision is 1/10000. 10000 means 100% sample in default.
        slowDBAccessThreshold: ${SW_SLOW_DB_THRESHOLD:default:200,mongodb:100} # The slow database access thresholds. Unit ms.
    receiver-jvm:
      default:
    receiver-clr:
      default:
    service-mesh:
      default:
        bufferPath: ${SW_SERVICE_MESH_BUFFER_PATH:../mesh-buffer/}  # Path to trace buffer files, suggest to use absolute path
        bufferOffsetMaxFileSize: ${SW_SERVICE_MESH_OFFSET_MAX_FILE_SIZE:100} # Unit is MB
        bufferDataMaxFileSize: ${SW_SERVICE_MESH_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB
        bufferFileCleanWhenRestart: ${SW_SERVICE_MESH_BUFFER_FILE_CLEAN_WHEN_RESTART:false}
    istio-telemetry:
      default:
    query:
      graphql:
        path: ${SW_QUERY_GRAPHQL_PATH:/graphql}
    alarm:
      default:
    telemetry:
      none:
    configuration:
      none:
    envoy-metric:
      default:
  log4j2.xml: |-
    <Configuration status="INFO">
        <Appenders>
            <Console name="Console" target="SYSTEM_OUT">
                <PatternLayout charset="UTF-8" pattern="%d - %c -%-4r [%t] %-5p %x - %m%n"/>
            </Console>
        </Appenders>
        <Loggers>
            <logger name="org.eclipse.jetty" level="INFO"/>
            <logger name="org.apache.zookeeper" level="INFO"/>
            <logger name="org.elasticsearch.common.network.IfConfig" level="INFO"/>
            <logger name="io.grpc.netty" level="INFO"/>
            <Root level="INFO">
                <AppenderRef ref="Console"/>
            </Root>
        </Loggers>
    </Configuration>
  datasource-settings.properties: |-
        jdbcUrl: jdbc:mysql://172.16.77.53:32666/skywalking
        dataSource.user: root
        dataSource.password: bnsbdl
        dataSource.cachePrepStmts: true
        dataSource.prepStmtCacheSize: 250
        dataSource.prepStmtCacheSqlLimit: 2048
        dataSource.useServerPrepStmts: true
        dataSource.useLocalSessionState: true
        dataSource.rewriteBatchedStatements: true
        dataSource.cacheResultSetMetadata: true
        dataSource.cacheServerConfiguration: true
        dataSource.elideSetAutoCommits: true
        dataSource.maintainTimeStats: false
  alarm-settings.yml: |-
    rules:
      service_resp_time_rule:
        metrics-name: service_resp_time
        threshold: 200
        op: ">"
        period: 1
        silence-period: 1
        count: 1
        message: Response time of service {name} is more than 200ms in last 1 minutes.
      webhooks:
  gateways.yml: |-
  official_analysis.oal: |-
    // All scope metrics
    all_p99 = from(All.latency).p99(10);
    all_p95 = from(All.latency).p95(10);
    all_p90 = from(All.latency).p90(10);
    all_p75 = from(All.latency).p75(10);
    all_p50 = from(All.latency).p50(10);
    all_heatmap = from(All.latency).thermodynamic(100, 20);
    // Service scope metrics
    service_resp_time = from(Service.latency).longAvg();
    service_sla = from(Service.*).percent(status == true);
    service_cpm = from(Service.*).cpm();
    service_p99 = from(Service.latency).p99(10);
    service_p95 = from(Service.latency).p95(10);
    service_p90 = from(Service.latency).p90(10);
    service_p75 = from(Service.latency).p75(10);
    service_p50 = from(Service.latency).p50(10);

    // Service relation scope metrics for topology
    service_relation_client_cpm = from(ServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).cpm();
    service_relation_server_cpm = from(ServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).cpm();
    service_relation_client_call_sla = from(ServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).percent(status == true);
    service_relation_server_call_sla = from(ServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).percent(status == true);
    service_relation_client_resp_time = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).longAvg();
    service_relation_server_resp_time = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).longAvg();
    service_relation_client_p99 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p99(10);
    service_relation_server_p99 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p99(10);
    service_relation_client_p95 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p95(10);
    service_relation_server_p95 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p95(10);
    service_relation_client_p90 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p90(10);
    service_relation_server_p90 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p90(10);
    service_relation_client_p75 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p75(10);
    service_relation_server_p75 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p75(10);
    service_relation_client_p50 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p50(10);
    service_relation_server_p50 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p50(10);

    // Service Instance Scope metrics
    service_instance_sla = from(ServiceInstance.*).percent(status == true);
    service_instance_resp_time= from(ServiceInstance.latency).longAvg();
    service_instance_cpm = from(ServiceInstance.*).cpm();

    // Endpoint scope metrics
    endpoint_cpm = from(Endpoint.*).cpm();
    endpoint_avg = from(Endpoint.latency).longAvg();
    endpoint_sla = from(Endpoint.*).percent(status == true);
    endpoint_p99 = from(Endpoint.latency).p99(10);
    endpoint_p95 = from(Endpoint.latency).p95(10);
    endpoint_p90 = from(Endpoint.latency).p90(10);
    endpoint_p75 = from(Endpoint.latency).p75(10);
    endpoint_p50 = from(Endpoint.latency).p50(10);

    // Endpoint relation scope metrics
    endpoint_relation_cpm = from(EndpointRelation.*).filter(detectPoint == DetectPoint.SERVER).cpm();
    endpoint_relation_resp_time = from(EndpointRelation.rpcLatency).filter(detectPoint == DetectPoint.SERVER).longAvg();

    // JVM instance metrics
    instance_jvm_cpu = from(ServiceInstanceJVMCPU.usePercent).doubleAvg();
    instance_jvm_memory_heap = from(ServiceInstanceJVMMemory.used).filter(heapStatus == true).longAvg();
    instance_jvm_memory_noheap = from(ServiceInstanceJVMMemory.used).filter(heapStatus == false).longAvg();
    instance_jvm_memory_heap_max = from(ServiceInstanceJVMMemory.max).filter(heapStatus == true).longAvg();
    instance_jvm_memory_noheap_max = from(ServiceInstanceJVMMemory.max).filter(heapStatus == false).longAvg();
    instance_jvm_young_gc_time = from(ServiceInstanceJVMGC.time).filter(phrase == GCPhrase.NEW).sum();
    instance_jvm_old_gc_time = from(ServiceInstanceJVMGC.time).filter(phrase == GCPhrase.OLD).sum();
    instance_jvm_young_gc_count = from(ServiceInstanceJVMGC.count).filter(phrase == GCPhrase.NEW).sum();
    instance_jvm_old_gc_count = from(ServiceInstanceJVMGC.count).filter(phrase == GCPhrase.OLD).sum();

    database_access_resp_time = from(DatabaseAccess.latency).longAvg();
    database_access_sla = from(DatabaseAccess.*).percent(status == true);
    database_access_cpm = from(DatabaseAccess.*).cpm();
    database_access_p99 = from(DatabaseAccess.latency).p99(10);
    database_access_p95 = from(DatabaseAccess.latency).p95(10);
    database_access_p90 = from(DatabaseAccess.latency).p90(10);
    database_access_p75 = from(DatabaseAccess.latency).p75(10);
    database_access_p50 = from(DatabaseAccess.latency).p50(10);

    // CLR instance metrics
    instance_clr_cpu = from(ServiceInstanceCLRCPU.usePercent).doubleAvg();
    instance_clr_gen0_collect_count = from(ServiceInstanceCLRGC.gen0CollectCount).sum();
    instance_clr_gen1_collect_count = from(ServiceInstanceCLRGC.gen1CollectCount).sum();
    instance_clr_gen2_collect_count = from(ServiceInstanceCLRGC.gen2CollectCount).sum();
    instance_clr_heap_memory = from(ServiceInstanceCLRGC.heapMemory).longAvg();
    instance_clr_available_completion_port_threads = from(ServiceInstanceCLRThread.availableCompletionPortThreads).max();
    instance_clr_available_worker_threads = from(ServiceInstanceCLRThread.availableWorkerThreads).max();
    instance_clr_max_completion_port_threads = from(ServiceInstanceCLRThread.maxCompletionPortThreads).max();
    instance_clr_max_worker_threads = from(ServiceInstanceCLRThread.maxWorkerThreads).max();

    // Envoy instance metrics
    envoy_heap_memory_max_used = from(EnvoyInstanceMetric.value).filter(metricName == "server.memory_heap_size").maxDouble();
    envoy_total_connections_used = from(EnvoyInstanceMetric.value).filter(metricName == "server.total_connections").maxDouble();
    envoy_parent_connections_used = from(EnvoyInstanceMetric.value).filter(metricName == "server.parent_connections").maxDouble();

    // Disable unnecessary hard core sources
    /////////
    // disable(segment);
    // disable(endpoint_relation_server_side);
    // disable(top_n_database_statement);
    // disable(zipkin_span);
    // disable(jaeger_span);
  component-libraries.yml: |-
    Tomcat:
       id: 1
       languages: Java
    HttpClient:
       id: 2
       languages: Java,C#,Node.js
    Dubbo:
       id: 3
       languages: Java
    H2:
       id: 4
       languages: Java
    Mysql:
       id: 5
       languages: Java,C#,Node.js
    ORACLE:
       id: 6
       languages: Java
    Redis:
       id: 7
       languages: Java,C#,Node.js
    Motan:
       id: 8
       languages: Java
    MongoDB:
       id: 9
       languages: Java,C#,Node.js
    Resin:
       id: 10
       languages: Java
    Feign:
       id: 11
       languages: Java
    OKHttp:
       id: 12
       languages: Java
    SpringRestTemplate:
       id: 13
       languages: Java
    SpringMVC:
       id: 14
       languages: Java
    Struts2:
       id: 15
       languages: Java
    NutzMVC:
       id: 16
       languages: Java
    NutzHttp:
       id: 17
       languages: Java
    JettyClient:
       id: 18
       languages: Java
    JettyServer:
       id: 19
       languages: Java
    Memcached:
       id: 20
       languages: Java
    ShardingJDBC:
       id: 21
       languages: Java
    PostgreSQL:
       id: 22
       languages: Java,C#,Node.js
    GRPC:
       id: 23
       languages: Java
    ElasticJob:
       id: 24
       languages: Java
    RocketMQ:
       id: 25
       languages: Java
    httpasyncclient:
       id: 26
       anguages: Java
    Kafka:
       id: 27
       languages: Java
    ServiceComb:
       id: 28
       languages: Java
    Hystrix:
       id: 29
       languages: Java
    Jedis:
       id: 30
       languages: Java
    SQLite:
       id: 31
       languages: Java,C#
    h2-jdbc-driver:
       id: 32
       languages: Java
    mysql-connector-java:
       id: 33
       languages: Java
    ojdbc:
       id: 34
       languages: Java
    Spymemcached:
       id: 35
       languages: Java
    Xmemcached:
       id: 36
       languages: Java
    postgresql-jdbc-driver:
       id: 37
       languages: Java
    rocketMQ-producer:
       id: 38
       languages: Java
    rocketMQ-consumer:
       id: 39
       languages: Java
    kafka-producer:
       id: 40
       languages: Java
    kafka-consumer:
       id: 41
       languages: Java
    mongodb-driver:
       id: 42
       languages: Java
    SOFARPC:
       id: 43
       languages: Java
    ActiveMQ:
       id: 44
       languages: Java
    activemq-producer:
       id: 45
       languages: Java
    activemq-consumer:
       id: 46
       languages: Java
    Elasticsearch:
       id: 47
       languages: Java
    transport-client:
       id: 48
       languages: Java
    http:
       id: 49
       languages: Java,C#,Node.js
    rpc:
       id: 50
       languages: Java,C#,Node.js
    RabbitMQ:
       id: 51
       languages: Java
    rabbitmq-producer:
       id: 52
       languages: Java
    rabbitmq-consumer:
       id: 53
       languages: Java
    Canal:
       id: 54
       languages: Java
    Gson:
       id: 55
       languages: Java
    Redisson:
       id: 56
       languages: Java
    Lettuce:
       id: 57
       languages: Java
    Zookeeper:
       id: 58
       languages: Java
    Vertx:
       id: 59
       languages: Java
    ShardingSphere:
       id: 60
       languages: Java
    spring-cloud-gateway:
       id: 61
       languages: Java
    RESTEasy:
       id: 62
       languages: Java
    SolrJ:
       id: 63
       languages: Java
    Solr:
       id: 64
       languages: Java
    SpringAsync:
       id: 65
       languages: Java
    JdkHttp:
       id: 66
       languages: Java
    spring-webflux:
       id: 67
       languages: Java
    Play:
       id: 68
       languages: Java,Scala
    AspNetCore:
       id: 3001
       languages: C#
    EntityFrameworkCore:
       id: 3002
       languages: C#
    SqlClient:
       id: 3003
       languages: C#
    CAP:
       id: 3004
       languages: C#
    StackExchange.Redis:
       id: 3005
       languages: C#
    SqlServer:
       id: 3006
       languages: C#
    Npgsql:
       id: 3007
       languages: C#
    MySqlConnector:
       id: 3008
       languages: C#
    EntityFrameworkCore.InMemory:
       id: 3009
       languages: C#
    EntityFrameworkCore.SqlServer:
       id: 3010
       languages: C#
    EntityFrameworkCore.Sqlite:
       id: 3011
       languages: C#
    Pomelo.EntityFrameworkCore.MySql:
       id: 3012
       languages: C#
    Npgsql.EntityFrameworkCore.PostgreSQL:
       id: 3013
       languages: C#
    InMemoryDatabase:
       id: 3014
       languages: C#
    AspNet:
       id: 3015
       languages: C#
    SmartSql:
       id: 3016
       languages: C#
    HttpServer:
       id: 4001
       languages: Node.js
    express:
       id: 4002
       languages: Node.js
    Egg:
       id: 4003
       languages: Node.js
    Koa:
       id: 4004
       languages: Node.js
    Component-Server-Mappings:
       mongodb-driver: MongoDB
       rocketMQ-producer: RocketMQ
       rocketMQ-consumer: RocketMQ
       kafka-producer: Kafka
       kafka-consumer: Kafka
       activemq-producer: ActiveMQ
       activemq-consumer: ActiveMQ
       rabbitmq-producer: RabbitMQ
       rabbitmq-consumer: RabbitMQ
       postgresql-jdbc-driver: PostgreSQL
       Xmemcached: Memcached
       Spymemcached: Memcached
       h2-jdbc-driver: H2
       mysql-connector-java: Mysql
       Jedis: Redis
       StackExchange.Redis: Redis
       Redisson: Redis
       Lettuce: Redis
       Zookeeper: Zookeeper
       SqlClient: SqlServer
       Npgsql: PostgreSQL
       MySqlConnector: Mysql
       EntityFrameworkCore.InMemory: InMemoryDatabase
       EntityFrameworkCore.SqlServer: SqlServer
       EntityFrameworkCore.Sqlite: SQLite
       Pomelo.EntityFrameworkCore.MySql: Mysql
       Npgsql.EntityFrameworkCore.PostgreSQL: PostgreSQL
       transport-client: Elasticsearch
       SolrJ: Solr




















