File: osprofiler-post.yaml

package info (click to toggle)
python-osprofiler 4.3.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 764 kB
  • sloc: python: 4,825; makefile: 170; sh: 161
file content (58 lines) | stat: -rw-r--r-- 1,911 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
- hosts: controller
  vars:
    osprofiler_traces_dir: '/opt/stack/osprofiler-traces'
  tasks:
    - name: Create directory for traces
      become: True
      become_user: stack
      file:
        path: '{{ osprofiler_traces_dir }}'
        state: directory
        owner: stack
        group: stack

    - name: Read connection string from a file
      command: "cat /opt/stack/.osprofiler_connection_string"
      register: osprofiler_connection_string

    - debug:
        msg: "OSProfiler connection string is: {{ osprofiler_connection_string.stdout }}"

    - name: Get list of traces
      command: "osprofiler trace list --connection-string {{ osprofiler_connection_string.stdout }}"
      become: True
      become_user: stack
      register: osprofiler_trace_list

    - debug:
        msg: "{{ osprofiler_trace_list }}"

    - name: Save traces to files
      shell: |
        osprofiler trace list --connection-string {{ osprofiler_connection_string.stdout }} > {{ osprofiler_traces_dir }}/trace_list.txt
        cat {{ osprofiler_traces_dir }}/trace_list.txt | tail -n +4 | head -n -1 | awk '{print $2}' > {{ osprofiler_traces_dir }}/trace_ids.txt

        while read p; do
          osprofiler trace show --connection-string {{ osprofiler_connection_string.stdout }} --html $p > {{ osprofiler_traces_dir }}/trace-$p.html
        done < {{ osprofiler_traces_dir }}/trace_ids.txt
      become: True
      become_user: stack

    - name: Gzip trace files
      become: yes
      become_user: stack
      shell: "gzip * -9 -q | true"
      args:
        chdir: '{{ osprofiler_traces_dir }}'

    - name: Sync trace files to Zuul
      become: yes
      synchronize:
        src: "{{ osprofiler_traces_dir }}"
        dest: "{{ zuul.executor.log_root }}"
        mode: pull
        copy_links: true
        verify_host: true
        rsync_opts:
          - "--include=/**"
          - "--include=*/"