分析共享文件系统服务¶
Profiler¶
关于 profiler 的详细描述及其配置选项,请参见 Profiler 文档。
使用 Profiler¶
要开始分析 Manila 代码,需要执行以下步骤
将以下行添加到
/etc/manila/manila.conf文件中(默认情况下禁用 profiling)。[profiler] connection_string = redis://:6379 hmac_keys = SECRET_KEY trace_sqlalchemy = True enabled = True
关于
connection_string选项的可能值示例messaging://- 使用 oslo_messaging 驱动程序发送跨度。redis://127.0.0.1:6379- 使用 redis 驱动程序发送跨度。mongodb://127.0.0.1:27017- 使用 mongodb 驱动程序发送跨度。elasticsearch://127.0.0.1:9200- 使用 elasticsearch 驱动程序发送跨度。jaeger://127.0.0.1:6831- 使用 jaeger 跟踪作为驱动程序发送跨度。
重启所有 Manila 服务和 Keystone 服务。
要使用 manilaclient 验证 profiler,请使用
--profile <key>.运行任何命令。 key(例如 SECRET_KEY)应该是 manila.conf 中提到的hmac_keys中的一个。 为了在所有服务中生成正确的 profiling 信息,至少一个 key 需要在 OpenStack 项目之间保持一致。$ manila --profile SECRET_KEY create NFS 1 --name Share1 --share-network testNetwork --share-type dhss_true +---------------------------------------+--------------------------------------+ | Property | Value | +---------------------------------------+--------------------------------------+ | id | 9703da88-25ba-41e6-827d-a6932f708dd4 | | size | 1 | | availability_zone | None | | created_at | 2021-02-23T11:21:38.000000 | | status | creating | | name | Share1 | | description | None | | project_id | c67b2fd35b054060971d28cf654ee92a | | snapshot_id | None | | share_network_id | 03754c58-1456-497f-b7d6-8f36a4d644f0 | | share_proto | NFS | | metadata | {} | | share_type | 5b1a4133-371c-4583-a801-f2b6e1ae102d | | is_public | False | | snapshot_support | False | | task_state | None | | share_type_name | dhss_true | | access_rules_status | active | | replication_type | None | | has_replicas | False | | user_id | 7ecd60ddae1448b79449dc6434460eaf | | create_share_from_snapshot_support | False | | revert_to_snapshot_support | False | | share_group_id | None | | source_share_group_snapshot_member_id | None | | mount_snapshot_support | False | | progress | None | | share_server_id | None | | host | | +---------------------------------------+--------------------------------------+ Profiling trace ID: 1705dfd8-e45a-46cd-b0e2-2e40fd9e5f22 To display trace use next command: osprofiler trace show --html 1705dfd8-e45a-46cd-b0e2-2e40fd9e5f22
要使用 openstackclient 验证 profiler,请使用
--os-profile <key>运行任何命令。$ openstack --os-profile SECRET_KEY share create NFS 1 --name Share2 --share-network testNetwork --share-type dhss_true +---------------------------------------+--------------------------------------+ | Field | Value | +---------------------------------------+--------------------------------------+ | access_rules_status | active | | availability_zone | None | | create_share_from_snapshot_support | False | | created_at | 2021-02-23T11:23:41.000000 | | description | None | | has_replicas | False | | host | | | id | 78a19734-394f-4967-9671-c226df00a023 | | is_public | False | | metadata | {} | | mount_snapshot_support | False | | name | Share2 | | progress | None | | project_id | c67b2fd35b054060971d28cf654ee92a | | replication_type | None | | revert_to_snapshot_support | False | | share_group_id | None | | share_network_id | 03754c58-1456-497f-b7d6-8f36a4d644f0 | | share_proto | NFS | | share_server_id | None | | share_type | 5b1a4133-371c-4583-a801-f2b6e1ae102d | | share_type_name | dhss_true | | size | 1 | | snapshot_id | None | | snapshot_support | False | | source_share_group_snapshot_member_id | None | | status | creating | | task_state | None | | user_id | 7ecd60ddae1448b79449dc6434460eaf | | volume_type | dhss_true | +---------------------------------------+--------------------------------------+ Trace ID: 0ca7ce01-36a9-481c-8b3d-263a3b5caa35 Short trace ID for OpenTracing-based drivers: 8b3d263a3b5caa35 Display trace data with command: osprofiler trace show --html 0ca7ce01-36a9-481c-8b3d-263a3b5caa35
要以 HTML 格式显示跟踪数据,请运行以下命令。
$ osprofiler trace show --html 0ca7ce01-36a9-481c-8b3d-263a3b5caa35 --connection-string redis://:6379 --out /opt/stack/output.html