Skip to content

Commit

Permalink
Merge branch 'main' into PORT-12483-add-support-for-consumer-groups-t…
Browse files Browse the repository at this point in the history
…o-ports-kafka-integration
  • Loading branch information
phalbert authored Jan 21, 2025
2 parents e068a59 + c513e6e commit 8c88119
Show file tree
Hide file tree
Showing 14 changed files with 238 additions and 20 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/kapa-weekly-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Weekly Kapa Usage Report

on:
# schedule:
# # Runs at 9:00 AM UTC every Monday
# - cron: '0 9 * * 1'
workflow_dispatch: # Allows manual triggering

jobs:
generate-and-send-report:
runs-on: ubuntu-latest
steps:
- name: Get Current Date
id: date
run: |
echo "start_date=$(date -d '7 days ago' -u +%Y-%m-%dT00:00:00Z)" >> $GITHUB_ENV
echo "end_date=$(date -u +%Y-%m-%dT23:59:59Z)" >> $GITHUB_ENV
- name: Fetch Kapa Analytics
id: fetch-analytics
run: |
response=$(curl -s -X GET \
"https://api.kapa.ai/query/v1/projects/e64464bc-19b5-4cd2-9779-2930e2ca0b81/analytics/activity/?start_date_time=${{ env.start_date }}&end_date_time=${{ env.end_date }}&aggregation_period=DAY" \
-H "X-API-KEY: ${{ secrets.KAPA_API_KEY }}")
# Save response to a file for processing
echo "$response" > kapa_response.json
# Extract key metrics and format the message
stats=$(jq -r '.aggregate_statistics' kapa_response.json)
# Create a formatted message
message="📊 *Weekly Kapa.ai Usage Report*\n"
message+="Period: $(date -d '${{ env.start_date }}' '+%B %d') - $(date -d '${{ env.end_date }}' '+%B %d, %Y')\n\n"
message+="*Key Metrics:*\n"
message+="• Total Questions: $(echo $stats | jq -r '.total_questions')\n"
message+="• Unique Users: $(echo $stats | jq -r '.total_unique_users')\n"
message+="• Support Tickets Deflected: $(echo $stats | jq -r '.total_support_tickets_deflected')\n\n"
message+="*Quality Metrics:*\n"
message+="• Upvotes: $(echo $stats | jq -r '.total_upvotes')\n"
message+="• Downvotes: $(echo $stats | jq -r '.total_downvotes')\n"
message+="• Uncertain Responses: $(echo $stats | jq -r '.total_questions_uncertain')\n"
# Calculate success rate
total_votes=$(echo "$stats" | jq -r '.total_upvotes + .total_downvotes')
if [ "$total_votes" -gt 0 ]; then
success_rate=$(echo "scale=1; $(echo $stats | jq -r '.total_upvotes') * 100 / $total_votes" | bc)
message+="\n*Success Rate:* ${success_rate}%\n"
fi
# Add integration breakdown
message+="\n*Questions by Integration:*\n"
# Process time_series data to get total counts per integration
integration_counts=$(jq -r '
.time_series |
map(.count_by_integration[]) |
group_by(.integration_type) |
map({
type: .[0].integration_type,
description: .[0].description,
total: map(.count) | add
}) |
sort_by(.total) |
reverse[]' kapa_response.json)
# Add each integration's stats to the message
echo "$integration_counts" | while IFS= read -r integration; do
type=$(echo "$integration" | jq -r '.type')
desc=$(echo "$integration" | jq -r '.description')
count=$(echo "$integration" | jq -r '.total')
if [ "$count" -gt 0 ]; then
message+="• ${desc:-$type}: $count\n"
fi
done
echo "message<<EOF" >> $GITHUB_ENV
echo "$message" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Send to Slack
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
message: ${{ env.message }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
52 changes: 51 additions & 1 deletion docs/actions-and-automations/define-automations/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,54 @@ The following example uses a [`Send Slack message`](/actions-and-automations/set
- Note the `condition` block that checks if the status of the action run has changed from `IN_PROGRESS` to `FAILURE`. Only this specific change will trigger the automation.
- The `invocationMethod` specifies a webhook that sends a message to a Slack channel.
- The message includes details about the failed deployment, such as the service name, image, and environment.
- The message also includes a link to the action run page in Port.
- The message also includes a link to the action run page in Port.

---

## Approve a self-service action based on an input value

When configuring [manual approval](/actions-and-automations/create-self-service-experiences/set-self-service-actions-rbac/#configure-manual-approval-for-actions) for a self-service action, in some cases you may want to automatically approve/decline the action if a certain input value is provided.

For example, the following automation will automatically approve a deployment if the `type` input is set to `Testing`:

```json showLineNumbers
{
"identifier": "approve_deployment_based_on_input",
"title": "Automatically approve testing deployments",
"description": "Automatically approve testing deployments",
"trigger": {
"type": "automation",
"event": {
"type": "RUN_CREATED",
"actionIdentifier": "deploy_service"
},
"condition": {
"type": "JQ",
"expressions": [
".diff.after.properties.type == \"Testing\""
],
"combinator": "and"
}
},
"invocationMethod": {
"type": "WEBHOOK",
"url": "https://api.getport.io/v1/actions/runs/{{.event.diff.after.id}}/approval",
"agent": false,
"synchronized": true,
"method": "PATCH",
"headers": {},
"body": {
"status": "APPROVE",
"description": "Approved"
}
},
"publish": true
}
```

### Explanation

- This automation is triggered whenever a new run is created for the `deploy_service` action.
- The `condition` block checks if the `type` input is set to `Testing`, and will only trigger the automation if this is the case.
- The backend of the automation directly makes an API call to approve the relevant run.
- Note that if the `condition` is not met, the automation will not be triggered.
54 changes: 54 additions & 0 deletions docs/api-reference/security.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
id: security
title: "Security"
description: ""
sidebar_label: Security
sidebar_position: 2
hide_title: true
---

import EnterpriseNote from "/docs/generalTemplates/_enterprise_feature_notice.md";

# Security

This page includes security information about Port API and the interactions of your infrastructure with it.

## Address Allowlisting

Port's REST API is served through a network of Application Load Balancers (ALBs) and as such is not served from a closed list of IP addresses.

For cases where your internal network has strict limitations on the addresses that outbound requests can be made to, you will need to add the following addresses to your network's allowlist:

- For Port's EU tenant:
- [https://api.getport.io](https://api.getport.io)
- [https://ingest.getport.io](https://ingest.getport.io)
- For Port's US tenant:
- [https://api.us.getport.io](https://api.us.getport.io)
- [https://ingest.us.getport.io](https://ingest.us.getport.io)

## AWS PrivateLink

<EnterpriseNote />

Port supports AWS PrivateLink to provide secure connectivity between your AWS [VPC](https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html) and Port's API.

AWS [PrivateLink](https://aws.amazon.com/privatelink/) is an AWS service that provides private connectivity between resources in different AWS VPCs.

With AWS PrivateLink you can make requests to Port's API from your AWS VPC, while ensuring that the traffic remains within the AWS data center, and without exposing your data to the internet.

### Setup

To setup an AWS PrivateLink between your VPC and Port, you can follow [this AWS guide](https://docs.aws.amazon.com/vpc/latest/privatelink/create-endpoint-service.html#connect-to-endpoint-service).

In step 5 of the guide, you are required to provide the **Service name**, which is the address of the PrivateLink address provided by Port, here are the Port API PrivateLink service names:

| Service | Public Address | PrivateLink Region | PrivateLink Service Name |
| ------------- | ------------------------------------------------------------ | ------------------ | --------------------------------------------------------- |
| Port API EU | [https://api.getport.io](https://api.getport.io) | `eu-west-1` | `com.amazonaws.vpce.eu-west-1.vpce-svc-02addcefd47049d3f` |
| Ingest API EU | [https://ingest.getport.io](https://ingest.getport.io) | `eu-west-1` | `com.amazonaws.vpce.eu-west-1.vpce-svc-01c8de843e5776402` |
| Port API US | [https://api.us.getport.io](https://api.us.getport.io) | `us-east-1` | `com.amazonaws.vpce.us-east-1.vpce-svc-047de27e65a0392a7` |
| Ingest API US | [https://ingest.us.getport.io](https://ingest.us.getport.io) | `us-east-1` | `com.amazonaws.vpce.us-east-1.vpce-svc-052d7ea18ebda9652` |

**Note:** In case your AWS resources are in a different region than the ones Port's PrivateLinks are hosted at, refer to step 6 of the guide to setup a cross region connection.

After following the guide, please contact Port's support team using Intercom/Slack/mail to [[email protected]](mailto:[email protected]) and we will finalize the setup.
4 changes: 4 additions & 0 deletions docs/api-reference/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const sidebar: SidebarsConfig = {
type: "doc",
id: "api-reference/rate-limits",
},
{
type: "doc",
id: "api-reference/security",
},
{
type: "html",
value: '<hr style="margin: 0.8rem">',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ This integration allows you to:
- [`Monitor`](https://docs.datadoghq.com/api/latest/monitors/#get-all-monitor-details)
- [`Service`](https://docs.datadoghq.com/api/latest/service-definition/#get-all-service-definitions)
- [`SLO`](https://docs.datadoghq.com/api/latest/service-level-objectives/#get-all-slos)
- [`SLO History`](https://docs.datadoghq.com/api/latest/service-level-objectives/#get-an-slos-history)
- [`Service Metric`](https://docs.datadoghq.com/api/latest/metrics/#query-timeseries-points)
- [`SLO History`](https://docs.datadoghq.com/api/latest/service-level-objectives/#get-an-slos-history)*
- [`Service Metric`](https://docs.datadoghq.com/api/latest/metrics/#query-timeseries-points)*
- [`User`](https://docs.datadoghq.com/api/latest/users/#list-all-users)
- [`Team`](https://docs.datadoghq.com/api/latest/teams/#get-all-teams)
<br />

*_SLO History and Service Metric resources are not collected out of the box. Follow the examples [here](https://docs.port.io/build-your-software-catalog/sync-data-to-catalog/apm-alerting/datadog/examples) to configure blueprints and resource mappings._

<br />

## Setup

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
| `OCEAN__INTEGRATION__CONFIG__JIRA_HOST` | The URL of your Jira | https://example.atlassian.net ||
| `OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_EMAIL` | The email of the user used to query Jira | [email protected] ||
| `OCEAN__INTEGRATION__CONFIG__ATLASSIAN_USER_TOKEN` | [Jira API token](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/) generated by the user | ||
| `OCEAN__INTEGRATION__CONFIG__ATLASSIAN_ORGANIZATION_ID` | Your Atlassian Organization ID is required to sync teams and team members. [Follow the Atlassian documentation](https://confluence.atlassian.com/jirakb/what-it-is-the-organization-id-and-where-to-find-it-1207189876.html) on how to find your Organization ID | ||
| `OCEAN__PORT__CLIENT_ID` | Your Port client ([How to get the credentials](https://docs.port.io/build-your-software-catalog/custom-integration/api/#find-your-port-credentials)) id | ||
| `OCEAN__PORT__CLIENT_SECRET` | Your Port client ([How to get the credentials](https://docs.port.io/build-your-software-catalog/custom-integration/api/#find-your-port-credentials)) secret | ||
| `OCEAN__PORT__BASE_URL` | Your Port API URL - `https://api.getport.io` for EU, `https://api.us.getport.io` for US | ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ This table summarizes the available parameters for the installation.
| `port.baseUrl` | Your Port API URL - `https://api.getport.io` for EU, `https://api.us.getport.io` for US | | ✅ |
| `integration.secrets.atlassianUserEmail` | The email of the user used to query Jira | [email protected] | ✅ |
| `integration.secrets.atlassianUserToken` | [Jira API token](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/) generated by the user | | ✅ |
| `integration.config.atlassianOrganizationId` | Your Atlassian Organization ID is required to sync teams and team members. [Follow the Atlassian documentation](https://confluence.atlassian.com/jirakb/what-it-is-the-organization-id-and-where-to-find-it-1207189876.html) on how to find your Organization ID | | ❌ |
| `integration.config.jiraHost` | The URL of your Jira | https://example.atlassian.net | ✅ |
| `integration.config.appHost` | The host of the Port Ocean app. Used to set up the integration endpoint as the target for webhooks created in Jira | https://my-ocean-integration.com | ✅ |
| `integration.eventListener.type` | The event listener type. Read more about [event listeners](https://ocean.getport.io/framework/features/event-listener) | | ✅ |
Expand Down Expand Up @@ -217,6 +218,7 @@ Make sure to configure the following [Github Secrets](https://docs.github.com/en
| `config -> jira_host` | The URL of your Jira | https://example.atlassian.net | ✅ |
| `config -> atlassian_user_email` | The email of the user used to query Jira | [email protected] | ✅ |
| `config -> atlassian_user_token` | [Jira API token](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/) generated by the user | | ✅ |
| `config -> atlassian_organization_id` |Your Atlassian Organization ID is required to sync teams and team members. [Follow the Atlassian documentation](https://confluence.atlassian.com/jirakb/what-it-is-the-organization-id-and-where-to-find-it-1207189876.html) on how to find your Organization ID | | ❌ |
| `initialize_port_resources` | Default true, When set to true the integration will create default blueprints and the port App config Mapping. Read more about [initializePortResources](https://ocean.getport.io/develop-an-integration/integration-configuration/#initializeportresources---initialize-port-resources) | | ❌ |
| `send_raw_data_examples` | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | | ❌ |
| `identifier` | The identifier of the integration that will be installed | | ❌ |
Expand Down
5 changes: 5 additions & 0 deletions docs/generalTemplates/_enterprise_feature_notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:::info Enterprise Feature
This feature is part of Port's Enterprise plan.

If you're interested in accessing this feature, please contact Port's sales team.
:::
Loading

0 comments on commit 8c88119

Please sign in to comment.