Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build distribution 📦

on:
workflow_call:
workflow_dispatch:
pull_request:

jobs:
build-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install hatch
run: |
pip install hatch --user

- name: Run tests
run: |
python3 -m hatch run test

- name: Run linting
run: |
python3 -m hatch run lint:all

- name: Build a wheel and a source tarball
run: |
python3 -m hatch build
32 changes: 7 additions & 25 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,23 @@ on:

jobs:
build-package:
name: Build distribution 📦
runs-on: ubuntu-latest
uses: ./.github/workflows/build-package.yml

check-tag:
runs-on: ubuntu-latest
steps:
- id: check_ref
run: echo "::set-output name=match::$(echo '${{ github.ref }}' | grep -Pq '^refs/tags/v\d+\.\d+\.\d+$' && echo true || echo false)"
shell: bash

- name: Check if tag is valid
if: steps.check_ref.outputs.match != 'true'
run: exit 1

upload-artifact:
needs: build-package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install hatch
run: |
pip install hatch --user

- name: Run tests
run: |
python3 -m hatch run test

- name: Run linting
run: |
python3 -m hatch run lint:all

- name: Build a wheel and a source tarball
run: |
python3 -m hatch build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion dynatrace_extension/sdk/communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def get_extension_config(self) -> str:
def get_feature_sets(self) -> dict[str, list[str]]:
# This is only called from dt-sdk run, where PyYaml is installed because of dt-cli
# Do NOT move this to the top of the file
import yaml # type: ignore
import yaml # noqa: PLC0415

# Grab the feature sets from the extension.yaml file
extension_yaml = yaml.safe_load(self.extension_config)
Expand Down
4 changes: 2 additions & 2 deletions dynatrace_extension/sdk/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class Extension:

def __new__(cls, *args, **kwargs): # noqa: ARG004
if Extension._instance is None:
Extension._instance = super(__class__, cls).__new__(cls)
Extension._instance = super().__new__(cls)
return Extension._instance

def __init__(self, name: str = "") -> None:
Expand Down Expand Up @@ -683,7 +683,7 @@ def report_dt_event_dict(self, event: dict):
msg = f"Event type must be a DtEventType enum value, got: {value}"
raise ValueError(msg)
if key == "properties":
for prop_key, prop_val in event[key].items():
for prop_key, prop_val in value.items():
if not isinstance(prop_key, str) or not isinstance(prop_val, str):
msg = f'invalid "properties" member: {prop_key}: {prop_val}, required: "str": str'
raise ValueError(msg)
Expand Down
3 changes: 3 additions & 0 deletions dynatrace_extension/sdk/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def __repr__(self):
def __eq__(self, other):
return isinstance(other, EndpointStatus) and self.__dict__ == other.__dict__

def __hash__(self):
return hash((self.endpoint, self.status, self.message))


class EndpointStatuses:
def __init__(self, total_endpoints_number=None) -> None:
Expand Down