# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
segmentItems:
- serviceName: apm-toolkit-trace-scenario
  segmentSize: gt 5
  segments:
  - segmentId: not null
    spans:
    - operationName: tool-kit-set-operation-name
      parentSpanId: 0
      spanId: 1
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      skipAnalysis: true
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testTag()
      parentSpanId: 0
      spanId: 2
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      tags:
      - {key: key, value: value}
      skipAnalysis: 'true'
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testInfo(java.lang.String)
      parentSpanId: 0
      spanId: 3
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      logs:
      - logEvent:
        - {key: event, value: info}
        - {key: message, value: TestInfoMsg}
      tags:
      - {key: testTag, value: testInfoParam}
      skipAnalysis: 'true'
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testDebug()
      parentSpanId: 0
      spanId: 4
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      logs:
      - logEvent:
        - {key: event, value: debug}
        - {key: message, value: TestDebugMsg}
      skipAnalysis: 'true'
    - {operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testError(),
       parentSpanId: 0, spanId: 5, spanLayer: Unknown, startTime: nq 0, endTime: nq 0,
       componentId: 0, isError: true, spanType: Local, peer: '',
      skipAnalysis: 'true'}
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testErrorMsg()
      parentSpanId: 0
      spanId: 6
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: true
      spanType: Local
      peer: ''
      logs:
      - logEvent:
        - {key: event, value: error}
        - {key: message, value: TestErrorMsg}
      skipAnalysis: 'true'
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testErrorThrowable()
      parentSpanId: 0
      spanId: 7
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: true
      spanType: Local
      peer: ''
      logs:
      - logEvent:
        - {key: event, value: error}
        - {key: error.kind, value: java.lang.RuntimeException}
        - {key: message, value: Test-Exception}
        - {key: stack, value: not null}
      skipAnalysis: 'true'
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testTagAnnotation(java.lang.String,java.lang.String)
      parentSpanId: 0
      spanId: 8
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      tags:
      - {key: p1, value: testTagAnnotationParam1}
      - {key: p2, value: testTagAnnotationParam2}
      skipAnalysis: 'true'
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testTagAnnotationReturnInfo(java.lang.String,java.lang.Integer)
      parentSpanId: 0
      spanId: 9
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      tags:
      - {key: username, value: zhangsan}
      skipAnalysis: 'true'
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testStatic(java.lang.String,java.lang.Integer)
      parentSpanId: 0
      spanId: 10
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      tags:
      - {key: p1, value: lisi}
      - {key: p2, value: '16'}
      - {key: username, value: lisi}
      skipAnalysis: 'true'
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testTagAnnotationReturnArray(java.lang.String,java.lang.Integer)
      parentSpanId: 0
      spanId: 11
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      tags:
        - {key: username, value: lisi}
      skipAnalysis: 'true'
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testTagAnnotationReturnList(java.lang.String,java.lang.Integer)
      parentSpanId: 0
      spanId: 12
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      tags:
        - {key: username, value: wangwu}
      skipAnalysis: 'true'
    - operationName: test.apache.skywalking.apm.testcase.toolkit.controller.TestService.testTagAnnotationReturnMap(java.lang.String,java.lang.Integer)
      parentSpanId: 0
      spanId: 13
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      tags:
        - {key: username, value: zhaoliu}
      skipAnalysis: 'true'
    - operationName: GET:/case/tool-kit
      parentSpanId: -1
      spanId: 0
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 14
      isError: false
      spanType: Entry
      peer: ''
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/tool-kit'}
      - {key: http.method, value: GET}
      - {key: traceID, value: not null}
      - {key: segmentID, value: not null}
      - {key: spanID, value: not null}
      - {key: http.status_code, value: '200'}
      skipAnalysis: 'true'
      refs:
      - {parentEndpoint: /app, networkAddress: '127.0.0.1:8080', refType: CrossProcess,
        parentSpanId: 4, parentTraceSegmentId: 1.2.3, parentServiceInstance: instance,
        parentService: service, traceId: 3.4.5}

  - segmentId: not null
    spans:
    - operationName: GET:/case/asyncVisit/callable
      parentSpanId: -1
      spanId: 0
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 14
      isError: false
      spanType: Entry
      peer: ''
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/callable'}
      - {key: http.method, value: GET}
      - {key: correlation, value: correlationValueTest}
      - {key: http.status_code, value: '200'}
      refs:
      - {parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.CallableWrapper/call,
        networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 1,
        parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: apm-toolkit-trace-scenario,
        traceId: not null}
      skipAnalysis: 'true'
  - segmentId: not null
    spans:
    - operationName: /apm-toolkit-trace-scenario/case/asyncVisit/runnable
      parentSpanId: 0
      spanId: 1
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 2
      isError: false
      spanType: Exit
      peer: localhost:8080
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/runnable'}
      - {key: http.method, value: GET}
      - {key: http.status_code, value: '200'}
      skipAnalysis: 'true'
    - operationName: Thread/org.apache.skywalking.apm.toolkit.trace.RunnableWrapper/run
      parentSpanId: -1
      spanId: 0
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      refs:
      - {parentEndpoint: GET:/case/tool-kit, networkAddress: '', refType: CrossThread,
        parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not
          null, parentService: apm-toolkit-trace-scenario, traceId: not null}
      skipAnalysis: 'true'
  - segmentId: not null
    spans:
    - operationName: /apm-toolkit-trace-scenario/case/asyncVisit/callable
      parentSpanId: 0
      spanId: 1
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 2
      isError: false
      spanType: Exit
      peer: localhost:8080
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/callable'}
      - {key: http.method, value: GET}
      - {key: http.status_code, value: '200'}
      skipAnalysis: 'true'
    - operationName: Thread/org.apache.skywalking.apm.toolkit.trace.CallableWrapper/call
      parentSpanId: -1
      spanId: 0
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      refs:
      - {parentEndpoint: GET:/case/tool-kit, networkAddress: '', refType: CrossThread,
        parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not
          null, parentService: apm-toolkit-trace-scenario, traceId: not null}
      skipAnalysis: 'true'
  - segmentId: not null
    spans:
    - operationName: GET:/case/asyncVisit/runnable
      parentSpanId: -1
      spanId: 0
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 14
      isError: false
      spanType: Entry
      peer: ''
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/runnable'}
      - {key: http.method, value: GET}
      - {key: correlation, value: correlationValueTest}
      - {key: http.status_code, value: '200'}
      refs:
      - {parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.RunnableWrapper/run,
        networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 1,
        parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: apm-toolkit-trace-scenario,
        traceId: not null}
      skipAnalysis: 'true'
  - segmentId: not null
    spans:
    - operationName: /apm-toolkit-trace-scenario/case/asyncVisit/supplier
      parentSpanId: 0
      spanId: 1
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 2
      isError: false
      spanType: Exit
      peer: localhost:8080
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/supplier'}
      - {key: http.method, value: GET}
      - {key: http.status_code, value: '200'}
      skipAnalysis: 'true'
    - operationName: Thread/org.apache.skywalking.apm.toolkit.trace.SupplierWrapper/get
      parentSpanId: -1
      spanId: 0
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      refs:
      - {parentEndpoint: GET:/case/tool-kit, networkAddress: '', refType: CrossThread,
        parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not
          null, parentService: apm-toolkit-trace-scenario, traceId: not null}
      skipAnalysis: 'true'
  - segmentId: not null
    spans:
    - operationName: GET:/case/asyncVisit/supplier
      parentSpanId: -1
      spanId: 0
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 14
      isError: false
      spanType: Entry
      peer: ''
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/supplier'}
      - {key: http.method, value: GET}
      - {key: correlation, value: correlationValueTest}
      - {key: http.status_code, value: '200'}
      refs:
      - {parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.SupplierWrapper/get,
        networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 1,
        parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: apm-toolkit-trace-scenario,
        traceId: not null}
      skipAnalysis: 'true'
  - segmentId: not null
    spans:
    - operationName: /apm-toolkit-trace-scenario/case/asyncVisit/consumer
      parentSpanId: 0
      spanId: 1
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 2
      isError: false
      spanType: Exit
      peer: localhost:8080
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/consumer'}
      - {key: http.method, value: GET}
      - {key: http.status_code, value: '200'}
      skipAnalysis: 'true'
    - operationName: Thread/org.apache.skywalking.apm.toolkit.trace.ConsumerWrapper/accept
      parentSpanId: -1
      spanId: 0
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      refs:
      - {parentEndpoint: GET:/case/tool-kit, networkAddress: '', refType: CrossThread,
        parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not
          null, parentService: apm-toolkit-trace-scenario, traceId: not null}
      skipAnalysis: 'true'
  - segmentId: not null
    spans:
    - operationName: GET:/case/asyncVisit/function
      parentSpanId: -1
      spanId: 0
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 14
      isError: false
      spanType: Entry
      peer: ''
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/function'}
      - {key: http.method, value: GET}
      - {key: correlation, value: correlationValueTest}
      - {key: http.status_code, value: '200'}
      refs:
      - {parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.FunctionWrapper/apply,
        networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 1,
        parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: apm-toolkit-trace-scenario,
        traceId: not null}
      skipAnalysis: 'true'
  - segmentId: not null
    spans:
    - operationName: /apm-toolkit-trace-scenario/case/asyncVisit/function
      parentSpanId: 0
      spanId: 1
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 2
      isError: false
      spanType: Exit
      peer: localhost:8080
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/function'}
      - {key: http.method, value: GET}
      - {key: http.status_code, value: '200'}
      skipAnalysis: 'true'
    - operationName: Thread/org.apache.skywalking.apm.toolkit.trace.FunctionWrapper/apply
      parentSpanId: -1
      spanId: 0
      spanLayer: Unknown
      startTime: nq 0
      endTime: nq 0
      componentId: 0
      isError: false
      spanType: Local
      peer: ''
      refs:
      - {parentEndpoint: GET:/case/tool-kit, networkAddress: '', refType: CrossThread,
        parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not
          null, parentService: apm-toolkit-trace-scenario, traceId: not null}
      skipAnalysis: 'true'
  - segmentId: not null
    spans:
    - operationName: GET:/case/asyncVisit/consumer
      parentSpanId: -1
      spanId: 0
      spanLayer: Http
      startTime: nq 0
      endTime: nq 0
      componentId: 14
      isError: false
      spanType: Entry
      peer: ''
      tags:
      - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/consumer'}
      - {key: http.method, value: GET}
      - {key: correlation, value: correlationValueTest}
      - {key: http.status_code, value: '200'}
      refs:
      - {parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.ConsumerWrapper/accept,
        networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 1,
        parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: apm-toolkit-trace-scenario,
        traceId: not null}
      skipAnalysis: 'true'
meterItems:
- serviceName: apm-toolkit-trace-scenario
  meterSize: ge 8
  meters:
    - meterId:
        name: test_counter
        tags:
          - {name: ck1, value: cv1}
      singleValue: gt 0
    - meterId:
        name: test_gauge
        tags:
          - {name: gk1, value: gv1}
      singleValue: gt 0
    - meterId:
        name: test_histogram
        tags:
          - {name: hk1, value: hv1}
      histogramBuckets:
        - 0.0
        - 1.0
        - 5.0
        - 10.0
    - meterId:
        name: thread_pool
        tags:
          - {name: metric_type, value: core_pool_size}
          - {name: pool_name, value: tomcat_execute_pool}
      singleValue: ge 1
    - meterId:
        name: thread_pool
        tags:
          - {name: metric_type, value: max_pool_size}
          - {name: pool_name, value: tomcat_execute_pool}
      singleValue: ge 1
    - meterId:
        name: thread_pool
        tags:
          - {name: metric_type, value: pool_size}
          - {name: pool_name, value: tomcat_execute_pool}
      singleValue: ge 0
    - meterId:
        name: thread_pool
        tags:
          - {name: metric_type, value: active_size}
          - {name: pool_name, value: tomcat_execute_pool}
      singleValue: ge 0
    - meterId:
        name: thread_pool
        tags:
          - {name: metric_type, value: queue_size}
          - {name: pool_name, value: tomcat_execute_pool}
      singleValue: ge 0
